Permalink
Browse files

Merge tag '2.2.0' into stable

2.2.0
  • Loading branch information...
crayfishx committed Jul 21, 2017
2 parents b16421c + c828610 commit 02612df8d7ed50c75f52ea635cf9f3ad45afacbe
Showing with 43 additions and 4 deletions.
  1. +7 −0 CHANGELOG.md
  2. +1 −0 lib/jerakia.rb
  3. +2 −0 lib/jerakia/cli.rb
  4. +20 −0 lib/jerakia/cli/config.rb
  5. +3 −3 lib/jerakia/cli/server.rb
  6. +5 −0 lib/jerakia/config.rb
  7. +4 −0 lib/jerakia/launcher.rb
  8. +1 −1 lib/jerakia/version.rb
@@ -1,5 +1,12 @@
# Jerakia Release Notes

## 2.2.0
* New feature: `config` CLI option to display current runtime configuration
* Fix: Better descrption of --verbose and --debug for server CLI options
* Fix: `plugindir` default of `/var/lib/jerakia/plugins` added
* Fix: More meaningful error message when a policy is not found, now throws a proper `Jerakia::PolicyError` exception


## 2.1.0
* Tighter permissions on logfile and configuration file when installing with system packages (https://github.com/crayfishx/jerakia/pull/85)
* Bugfix: An issue in 2.0.0 meant that if you use `stop` with a `confine` or `exclude` statement in a lookup, that the lookup never actually gets invoked (https://github.com/crayfishx/jerakia/pull/86)
@@ -42,6 +42,7 @@ def initialize(options = {})
end

def lookup(request)
raise Jerakia::PolicyError, "Policy '#{request.policy}' not defined" unless launcher.policy_exists?(request.policy)
launcher.policies[request.policy.to_sym].run(request)
end

@@ -6,13 +6,15 @@
require 'jerakia/cli/token'
require 'jerakia/cli/lookup'
require 'jerakia/cli/secret'
require 'jerakia/cli/config'

class Jerakia
class CLI < Thor
include Jerakia::CLI::Server
include Jerakia::CLI::Lookup
include Jerakia::CLI::Token
include Jerakia::CLI::Secret
include Jerakia::CLI::Config


desc 'version', 'Version information'
@@ -0,0 +1,20 @@
class Jerakia
class CLI < Thor
module Config
def self.included(thor)
thor.class_eval do
desc 'config <options>', 'Print the runtime configuration options'
option :config,
aliases: :c,
type: :string,
desc: 'Configuration file'
def config
require 'yaml'
jerakia = Jerakia.new(:config => options[:config])
puts jerakia.config.to_hash.to_yaml
end
end
end
end
end
end
@@ -3,7 +3,7 @@ class CLI < Thor
module Server
def self.included(thor)
thor.class_eval do
desc 'server', 'Start the Jerakia REST server'
desc 'server <options>', 'Start the Jerakia REST server'
option :config,
aliases: :c,
type: :string,
@@ -15,11 +15,11 @@ def self.included(thor)
option :verbose,
aliases: :v,
type: :boolean,
desc: 'Print verbose information'
desc: 'Log to STDOUT in verbose mode'
option :debug,
aliases: :D,
type: :boolean,
desc: 'Debug information to console, implies --log-level debug'
desc: 'Log to STDOUT in debug mode'
def server
case true
when options[:verbose]
@@ -20,6 +20,7 @@ def initialize(config = {})
def defaults
{
'policydir' => '/etc/jerakia/policy.d',
'plugindir' => '/var/lib/jerakia/plugins',
'logfile' => '/var/log/jerakia/jerakia.log',
'databasedir' => '/var/db/jerakia',
'loglevel' => 'info',
@@ -29,6 +30,10 @@ def defaults
}
end

def to_hash
@configdata
end

def [](key)
@configdata[key.to_s]
end
@@ -19,6 +19,10 @@ def initialize
end
end

def policy_exists?(policy)
@policies.has_key?(policy.to_sym)
end

def policy_dir
Jerakia.config.policydir
end
@@ -3,5 +3,5 @@ class Jerakia
#
# This should be updated when a new gem is released and it is read from the gemspec file
#
VERSION = '2.1.0'.freeze
VERSION = '2.2.0'.freeze
end

0 comments on commit 02612df

Please sign in to comment.