Class: Puppet::ReportAllTheThings::ScribeReporter

Inherits:
Object
  • Object
show all
Includes:
Util::MethodHelper
Defined in:
lib/puppet/reportallthethings/scribe_reporter.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) client



25
26
27
# File 'lib/puppet/reportallthethings/scribe_reporter.rb', line 25

def client
  @client ||= Scribe.new hosts, prefix
end

- (Object) config

Raises:

  • (Puppet::ParseError)


37
38
39
40
41
42
# File 'lib/puppet/reportallthethings/scribe_reporter.rb', line 37

def config
  return @config if @config
  configfile = File.join(Puppet.settings[:confdir], "scribe.yaml")
  raise(Puppet::ParseError, "Scribe report config file #{configfile} not readable") unless File.exist?(configfile)
  @config = symbolize_options(YAML.load_file(configfile))
end

- (Object) hosts



33
34
35
# File 'lib/puppet/reportallthethings/scribe_reporter.rb', line 33

def hosts
  config[:hosts]
end

- (Object) log(data)



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/puppet/reportallthethings/scribe_reporter.rb', line 13

def log(data)
  begin
    client.log data.strip
  rescue Thrift::TransportException
    Puppet.warning 'The scribe server did not respond.'
    return nil
  rescue ThriftClient::NoServersAvailable
    Puppet.warning 'No scribe servers are available.'
    return nil
  end
end

- (Object) prefix



29
30
31
# File 'lib/puppet/reportallthethings/scribe_reporter.rb', line 29

def prefix
  config[:prefix]
end