Class: Pero::Puppet::Base
- Inherits:
-
Object
- Object
- Pero::Puppet::Base
- Defined in:
- lib/pero/puppet/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#os_info ⇒ Object
readonly
Returns the value of attribute os_info.
-
#specinfra ⇒ Object
readonly
Returns the value of attribute specinfra.
Instance Method Summary collapse
- #check_command(*args) ⇒ Object
-
#initialize(specinfra, os) ⇒ Base
constructor
A new instance of Base.
- #run_specinfra(type, *args) ⇒ Object
Constructor Details
#initialize(specinfra, os) ⇒ Base
Returns a new instance of Base.
5 6 7 8 |
# File 'lib/pero/puppet/base.rb', line 5 def initialize(specinfra, os) @specinfra = specinfra @os_info = os end |
Instance Attribute Details
#os_info ⇒ Object (readonly)
Returns the value of attribute os_info.
4 5 6 |
# File 'lib/pero/puppet/base.rb', line 4 def os_info @os_info end |
#specinfra ⇒ Object (readonly)
Returns the value of attribute specinfra.
4 5 6 |
# File 'lib/pero/puppet/base.rb', line 4 def specinfra @specinfra end |
Instance Method Details
#check_command(*args) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/pero/puppet/base.rb', line 19 def check_command(*args) unless args.last.is_a?(Hash) args << {} end specinfra.run_command(*args).exit_status == 0 end |
#run_specinfra(type, *args) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/pero/puppet/base.rb', line 10 def run_specinfra(type, *args) command = specinfra.command.get(type, *args) if type.to_s.start_with?("check_") check_command(command) else specinfra.run_command(command) end end |