class Serverspec::Type::Puppet

Public Class Methods

new() click to toggle source
Calls superclass method
# File lib/puppetfactory/dashboard/serverspec_helper.rb, line 19
def initialize
  super
  return unless @settings.nil?

  @settings = {}
  data = @runner.run_command('puppet agent --configprint all').stdout
  data.split("\n").each do |line|
    key, value = line.split(' = ')
    @settings[key.to_sym] = value

    self.class.send(:define_method, key) { value }
    #define_method(key) { value }
  end
end

Public Instance Methods

classified_with?(klass) click to toggle source
# File lib/puppetfactory/dashboard/serverspec_helper.rb, line 54
def classified_with?(klass)
  #@runner.check_file_contains(@settings[:classfile], /^klass$/)
  @classfile ||= @runner.get_file_content(@settings[:classfile]).stdout
  @classfile =~ /^#{klass}$/
end
disabled?() click to toggle source
# File lib/puppetfactory/dashboard/serverspec_helper.rb, line 42
def disabled?
  @runner.check_file_is_file(@settings[:agent_disabled_lockfile])
end
enabled?() click to toggle source
# File lib/puppetfactory/dashboard/serverspec_helper.rb, line 38
def enabled?
  not disabled?
end
has_resource?(resource) click to toggle source
# File lib/puppetfactory/dashboard/serverspec_helper.rb, line 60
def has_resource?(resource)
  #@runner.check_file_contains(@settings[:resourcefile], resource)
  @resourcefile ||= @runner.get_file_content(@settings[:resourcefile]).stdout

  case resource
  when String
    @resourcefile.include? resource
  when Regexp
    @resourcefile =~ /^#{resource}$/
  else
    false
  end
end
has_run_puppet?() click to toggle source
# File lib/puppetfactory/dashboard/serverspec_helper.rb, line 50
def has_run_puppet?
  @runner.check_file_is_file(@settings[:lastrunreport])
end
has_signed_cert?() click to toggle source
# File lib/puppetfactory/dashboard/serverspec_helper.rb, line 46
def has_signed_cert?
  @runner.check_file_is_file(@settings[:hostcert])
end
to_s() click to toggle source
# File lib/puppetfactory/dashboard/serverspec_helper.rb, line 34
def to_s
  'Puppet managed attributes'
end