Module: Maestro::OperatingSystem

Defined in:
lib/maestro/operating_system.rb,
lib/maestro/operating_system/debian.rb,
lib/maestro/operating_system/fedora.rb,
lib/maestro/operating_system/ubuntu.rb,
lib/maestro/operating_system/cent_os.rb

Defined Under Namespace

Classes: Base, CentOs, Debian, Debian5, Debian6, Fedora, Ubuntu, Ubuntu1004, Ubuntu804, Ubuntu810, Ubuntu904, Ubuntu910

Class Method Summary collapse

Class Method Details

.create_from_etc_issue(etc_issue_str) ⇒ Object

Reads the given string containing the contents of /etc/issue and returns an OperatingSystem object matching the Linux version. Raises an exception if the operating system cannot be determined or is unsupported by Maestro.

Raises:

  • (StandardError)


6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/maestro/operating_system.rb', line 6

def self.create_from_etc_issue(etc_issue_str)
  raise StandardError, "Invalid etc_issue_str" if (etc_issue_str.nil? || etc_issue_str.empty?)
  if etc_issue_str.include?("Ubuntu 10.04")
    Ubuntu1004.new(etc_issue_str)
  elsif etc_issue_str.include?("Ubuntu 9.10")
    Ubuntu910.new(etc_issue_str)
  elsif etc_issue_str.include?("Ubuntu 9.04")
    Ubuntu904.new(etc_issue_str)
  elsif etc_issue_str.include?("Ubuntu 8.10")
    Ubuntu810.new(etc_issue_str)
  elsif etc_issue_str.include?("Ubuntu 8.04")
    Ubuntu804.new(etc_issue_str)
  elsif etc_issue_str.include?("Ubuntu")
    Ubuntu.new(etc_issue_str)
  elsif etc_issue_str.include?("Debian GNU/Linux 6.0")
    Debian6.new(etc_issue_str)
  elsif etc_issue_str.include?("Debian GNU/Linux 5.0")
    Debian5.new(etc_issue_str)
  elsif  etc_issue_str.include?("Debian")
    Debian.new(etc_issue_str)
  elsif etc_issue_str.include?("Fedora")
    Fedora.new(etc_issue_str)
  elsif  etc_issue_str.include?("CentOS")
    CentOs.new(etc_issue_str)
  else
    raise StandardError, "ERROR: Unsupported Linux Distro: #{etc_issue_str}"
  end
end