Sha256: dab18229ef675b981878edc0295f6ff68fbd7b7d142d39813b8ccaa191360476
Contents?: true
Size: 1.25 KB
Versions: 1
Compression:
Stored size: 1.25 KB
Contents
require 'rubygems' require 'yaml' require 'json' require 'sinatra' require 'haml' require File.expand_path('../helpers/puppetdb', __FILE__) require File.expand_path('../helpers/process', __FILE__) require File.expand_path('../model/endpoint', __FILE__) class PuppetDBRunDeck < Sinatra::Base def initialize(app = nil, params = {}) super(app) puppetdb_helper = Helpers::PuppetDB.new(settings.puppetdb_host, settings.puppetdb_port) @endpoint = EndPoint.new(puppetdb_helper, settings.cache_timeout, settings.thread_count) end get '/' do redirect to('/api') end get '/api' do haml :api end get '/api/yaml' do content_type 'text/yaml' content = @endpoint.to_yaml(true) end get '/api/xml' do content_type 'application/xml' content = @endpoint.to_xml(true) end get '/api/json' do content_type 'application/json' content = @endpoint.to_json(true) end get '/cache' do haml :cache end get '/cache/clear' do @endpoint.clear_cache end end # This allows app.rb to be run in isolation without the need for the executable if (!defined? settings.puppetdb_host) and (!defined? settings.puppetdb_port) PuppetDBRunDeck.set :puppetdb_host, 'localhost' PuppetDBRunDeck.set :puppetdb_port, '8080' end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
puppetdb_rundeck-1.0.0 | lib/app.rb |