Class: Rubyipmi::Freeipmi::Connection
- Inherits:
-
Object
- Object
- Rubyipmi::Freeipmi::Connection
- Defined in:
- lib/rubyipmi/freeipmi/connection.rb
Instance Attribute Summary collapse
-
#debug ⇒ Object
Returns the value of attribute debug.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #bmc ⇒ Object
- #chassis ⇒ Object
- #drivers_map ⇒ Object
- #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.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/rubyipmi/freeipmi/connection.rb', line 17 def initialize(user, pass, host, opts) @debug = opts[:debug] @options = Rubyipmi::ObservableHash.new raise("Must provide a host to connect to") unless host @options["hostname"] = host # Credentials can also be stored in the freeipmi configuration file # So they are not required @options["username"] = user if user @options["password"] = pass if pass if opts.has_key?(:privilege) @options["privilege-level"] = opts[:privilege] # privilege type end # Note: rubyipmi should auto detect which driver to use so its unnecessary to specify the driver unless # the user really wants to. @options['driver-type'] = drivers_map[opts[:driver]] unless drivers_map[opts[:driver]].nil? end |
Instance Attribute Details
#debug ⇒ Object
Returns the value of attribute debug.
14 15 16 |
# File 'lib/rubyipmi/freeipmi/connection.rb', line 14 def debug @debug end |
#options ⇒ Object
Returns the value of attribute options.
14 15 16 |
# File 'lib/rubyipmi/freeipmi/connection.rb', line 14 def @options end |
Instance Method Details
#bmc ⇒ Object
50 51 52 |
# File 'lib/rubyipmi/freeipmi/connection.rb', line 50 def bmc @bmc ||= Rubyipmi::Freeipmi::Bmc.new(@options) end |
#chassis ⇒ Object
54 55 56 |
# File 'lib/rubyipmi/freeipmi/connection.rb', line 54 def chassis @chassis ||= Rubyipmi::Freeipmi::Chassis.new(@options) end |
#drivers_map ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/rubyipmi/freeipmi/connection.rb', line 34 def drivers_map { 'lan15' => 'LAN', 'lan20' => 'LAN_2_0', 'open' => 'OPENIPMI' } end |
#fru ⇒ Object
46 47 48 |
# File 'lib/rubyipmi/freeipmi/connection.rb', line 46 def fru @fru ||= Rubyipmi::Freeipmi::Fru.new(@options) end |
#get_diag ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/rubyipmi/freeipmi/connection.rb', line 62 def get_diag data = {} data['provider'] = provider if @fru data['frus'] = @fru.getfrus end if @sensors data['sensors'] = @sensors.getsensors end if @bmc data['bmc_info'] = @bmc.info end end |
#provider ⇒ Object
42 43 44 |
# File 'lib/rubyipmi/freeipmi/connection.rb', line 42 def provider 'freeipmi' end |