Class: Pero::Puppet::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/pero/puppet/base.rb

Direct Known Subclasses

Redhat

Instance Attribute Summary collapse

Instance Method Summary collapse

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_infoObject (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

#specinfraObject (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