Class: Keystone::Os::Linux

Inherits:
Unix show all
Defined in:
lib/keystone/os/linux.rb

Direct Known Subclasses

Centos

Instance Attribute Summary

Attributes inherited from AbstractOs

#version

Class Method Summary collapse

Methods inherited from Unix

#bin_or_usrbin, #disk, #hostname, #ip_address, #netstat, #process_list

Methods inherited from AbstractOs

#disk, #dump, #hostname, #ip_address, #netstat, #process_list

Class Method Details

.getObject



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/keystone/os/linux.rb', line 4

def self.get
  Dir.glob("/etc/*{-release,_version}").each do |file|
    content = File.open(file).read
    if content =~ /CentOS release (\d*)/
      os = Centos.new
      os.version = $1.to_i
      return os
    end
  end
  return Linux.new
end