Class: Puppetfactory::Plugins::Logs
- Inherits:
-
Puppetfactory::Plugins
- Object
- Puppetfactory::Plugins
- Puppetfactory::Plugins::Logs
- Defined in:
- lib/puppetfactory/plugins/logs.rb
Instance Attribute Summary
Attributes inherited from Puppetfactory::Plugins
Instance Method Summary collapse
- #data ⇒ Object
-
#initialize(options) ⇒ Logs
constructor
A new instance of Logs.
- #tabs(privileged = false) ⇒ Object
Constructor Details
#initialize(options) ⇒ Logs
Returns a new instance of Logs.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/puppetfactory/plugins/logs.rb', line 5 def initialize() super() return unless [:puppetfactory] @logfile = [:logfile] server = [: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 |
Instance Method Details
#data ⇒ Object
31 32 33 |
# File 'lib/puppetfactory/plugins/logs.rb', line 31 def data File.read(@logfile) rescue "Cannot read logfile #{@logfile}" end |
#tabs(privileged = false) ⇒ Object
24 25 26 27 28 29 |
# 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 |