Sha256: e5d85b3451a73d9a7680f8f861ab92a208467dd986134fef38ccb7083a1be8ef

Contents?: true

Size: 734 Bytes

Versions: 17

Compression:

Stored size: 734 Bytes

Contents

require 'puppetfactory'

class Puppetfactory::Plugins::Logs < Puppetfactory::Plugins

  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

  def tabs(privileged = false)
    return unless privileged # only show this tab to admin users

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

  def data
    File.read(@logfile) rescue "Cannot read logfile #{@logfile}"
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
puppetfactory-0.6.5 lib/puppetfactory/plugins/logs.rb
puppetfactory-0.6.4 lib/puppetfactory/plugins/logs.rb
puppetfactory-0.6.3 lib/puppetfactory/plugins/logs.rb
puppetfactory-0.6.2 lib/puppetfactory/plugins/logs.rb
puppetfactory-0.6.1 lib/puppetfactory/plugins/logs.rb
puppetfactory-0.6.0 lib/puppetfactory/plugins/logs.rb
puppetfactory-0.5.9 lib/puppetfactory/plugins/logs.rb
puppetfactory-0.5.8 lib/puppetfactory/plugins/logs.rb
puppetfactory-0.5.7 lib/puppetfactory/plugins/logs.rb
puppetfactory-0.5.6 lib/puppetfactory/plugins/logs.rb
puppetfactory-0.5.5 lib/puppetfactory/plugins/logs.rb
puppetfactory-0.5.4 lib/puppetfactory/plugins/logs.rb
puppetfactory-0.5.3 lib/puppetfactory/plugins/logs.rb
puppetfactory-0.5.2 lib/puppetfactory/plugins/logs.rb
puppetfactory-0.5.1 lib/puppetfactory/plugins/logs.rb
puppetfactory-0.5.0 lib/puppetfactory/plugins/logs.rb
puppetfactory-0.4.0 lib/puppetfactory/plugins/logs.rb