class Beaker::Host::PuppetConfigReader

This class provides array syntax for using puppet –configprint on a host

Public Class Methods

new(host, command) click to toggle source
# File lib/beaker/host.rb, line 26
def initialize(host, command)
  @host = host
  @command = command
end

Public Instance Methods

[](k) click to toggle source
# File lib/beaker/host.rb, line 39
def [](k)
  cmd = PuppetCommand.new(@command, "--configprint #{k}")
  @host.exec(cmd).stdout.strip
end
has_key?(k) click to toggle source
# File lib/beaker/host.rb, line 31
def has_key?(k)
  cmd = PuppetCommand.new(@command, '--configprint all')
  keys = @host.exec(cmd).stdout.split("\n").collect do |x|
    x[/^[^\s]+/]
  end
  keys.include?(k)
end