Module: KnifeSolo::Bootstraps

Defined in:
lib/knife-solo/bootstraps.rb,
lib/knife-solo/bootstraps/linux.rb,
lib/knife-solo/bootstraps/darwin.rb,
lib/knife-solo/bootstraps/sun_os.rb,
lib/knife-solo/bootstraps/freebsd.rb

Defined Under Namespace

Modules: Delegates, InstallCommands Classes: Base, Darwin, FreeBSD, Linux, OperatingSystemNotImplementedError, SunOS

Class Method Summary collapse

Class Method Details

.class_exists_for?(os_name) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
11
12
13
14
# File 'lib/knife-solo/bootstraps.rb', line 8

def self.class_exists_for?(os_name)
  begin
    true if self.class_for_operating_system(os_name).class == Class
  rescue
    false
  end
end

.class_for_operating_system(os_name) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/knife-solo/bootstraps.rb', line 16

def self.class_for_operating_system(os_name)
  begin
    os_class_name = os_name.gsub(/\s/,'')
    KnifeSolo::Bootstraps.const_get(os_class_name)
  rescue
    raise OperatingSystemNotImplementedError.new("#{os_name.inspect} not implemented.  Feel free to add a bootstrap implementation in KnifeSolo::Bootstraps::#{os_class_name}")
  end
end