Class: Rubyipmi::Ipmitool::Connection
- Inherits:
-
Object
- Object
- Rubyipmi::Ipmitool::Connection
- Defined in:
- lib/rubyipmi/ipmitool/connection.rb
Constant Summary collapse
- DRIVERS_MAP =
{ 'lan15' => 'lan', 'lan20' => 'lanplus', 'open' => 'open' }
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #bmc ⇒ Object
- #chassis ⇒ Object
-
#connection_works? ⇒ Boolean
test the connection to ensure we can at least make a single call.
- #fru ⇒ Object
- #get_diag ⇒ Object
-
#initialize(user, pass, host, opts) ⇒ Connection
constructor
A new instance of Connection.
- #provider ⇒ Object
- #sensors ⇒ Object
Constructor Details
#initialize(user, pass, host, opts) ⇒ Connection
Returns a new instance of Connection.
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/rubyipmi/ipmitool/connection.rb', line 21 def initialize(user, pass, host, opts) @options = Rubyipmi::ObservableHash.new raise("Must provide a host to connect to") unless host @options["H"] = host # Credentials can also be stored in the freeipmi configuration file # So they are not required @options["U"] = user if user @options["P"] = pass if pass @options["L"] = opts[:privilege] if opts.key?(:privilege) # Note: rubyipmi should auto detect which driver to use so its unnecessary to specify the driver unless # the user really wants to. @options['I'] = DRIVERS_MAP[opts[:driver]] unless DRIVERS_MAP[opts[:driver]].nil? end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
13 14 15 |
# File 'lib/rubyipmi/ipmitool/connection.rb', line 13 def @options end |
Instance Method Details
#bmc ⇒ Object
50 51 52 |
# File 'lib/rubyipmi/ipmitool/connection.rb', line 50 def bmc @bmc ||= Rubyipmi::Ipmitool::Bmc.new(@options) end |
#chassis ⇒ Object
58 59 60 |
# File 'lib/rubyipmi/ipmitool/connection.rb', line 58 def chassis @chassis ||= Rubyipmi::Ipmitool::Chassis.new(@options) end |
#connection_works? ⇒ Boolean
test the connection to ensure we can at least make a single call
36 37 38 39 40 |
# File 'lib/rubyipmi/ipmitool/connection.rb', line 36 def connection_works? ! (bmc.info.nil? || bmc.info.empty?) rescue false end |
#fru ⇒ Object
42 43 44 |
# File 'lib/rubyipmi/ipmitool/connection.rb', line 42 def fru @fru ||= Rubyipmi::Ipmitool::Fru.new(@options) end |
#get_diag ⇒ Object
62 63 64 65 66 67 68 69 70 |
# File 'lib/rubyipmi/ipmitool/connection.rb', line 62 def get_diag data = {} data[:provider] = provider data[:frus] = fru.getfrus data[:sensors] = sensors.getsensors data[:bmc_info] = bmc.info data[:version] = bmc.version data end |
#provider ⇒ Object
46 47 48 |
# File 'lib/rubyipmi/ipmitool/connection.rb', line 46 def provider 'ipmitool' end |