class Puppetfactory::Plugins::Logs

Public Class Methods

new(options) click to toggle source
Calls superclass method Puppetfactory::Plugins::new
# File lib/puppetfactory/plugins/logs.rb, line 5
def initialize(options)
  super(options)
  return unless options[:puppetfactory]

  @logfile = options[:logfile]
  server   = options[:puppetfactory]

  # Add a web route to the puppetfactory server. Must happen in the initializer
  server.get '/logs' do
    protected!
    erb :logs
  end

  server.get '/logs/data' do
    protected!
    plugin(:Logs, :data)
  end
end

Public Instance Methods

data() click to toggle source
# File lib/puppetfactory/plugins/logs.rb, line 31
def data
  File.read(@logfile) rescue "Cannot read logfile #{@logfile}"
end
tabs(privileged = false) click to toggle source
# File lib/puppetfactory/plugins/logs.rb, line 24
def tabs(privileged = false)
  return unless privileged # only show this tab to admin users

  # url path => display title
  { 'logs' => 'Logs' }
end