Class: DRACCommandBase
- Inherits:
-
CommandBase
- Object
- CommandBase
- DRACCommandBase
- Defined in:
- lib/setup_oob/command/drac.rb
Overview
A slight extension of the Command class to add some DRAC-specific utility functions. Will be the base class for all DRAC commands
Direct Known Subclasses
DRACCommands::Ddns, DRACCommands::Hostname, DRACCommands::Networkmode, DRACCommands::Networksrc, DRACCommands::Ntp, DRACCommands::Password
Instance Attribute Summary
Attributes inherited from CommandBase
Instance Method Summary collapse
- #basecmd(_defaultpass = false) ⇒ Object
- #getval(key) ⇒ Object
- #getvals(key) ⇒ Object
- #setval(key, val) ⇒ Object
Methods inherited from CommandBase
#converge!, #converged?, #initialize
Constructor Details
This class inherits a constructor from CommandBase
Instance Method Details
#basecmd(_defaultpass = false) ⇒ Object
46 47 48 49 50 51 52 |
# File 'lib/setup_oob/command/drac.rb', line 46 def basecmd(_defaultpass = false) if @host == 'localhost' ['racadm'] else fail NotImplementedError end end |
#getval(key) ⇒ Object
24 25 26 27 |
# File 'lib/setup_oob/command/drac.rb', line 24 def getval(key) s = run(basecmd + ['get', key]) s.stdout.lines[1].strip.split('=')[1] end |
#getvals(key) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/setup_oob/command/drac.rb', line 33 def getvals(key) s = run(basecmd + ['get', key]) data = {} s.stdout.each_line do |line| next if line.start_with?('[') next if line.strip.empty? k, v = line.strip.split('=') data[k] = v end data end |
#setval(key, val) ⇒ Object
29 30 31 |
# File 'lib/setup_oob/command/drac.rb', line 29 def setval(key, val) run(basecmd + ['set', key, val]) end |