jerakia 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5ee5eb2a4faf74cf645495edd5114d0178dfbb99
4
- data.tar.gz: 5a81e8e5210436fe37fc6bbeb928403cfe6e2cb4
3
+ metadata.gz: f3e8936250f4d06c2553fe8569715bd13c94b58d
4
+ data.tar.gz: 807773e2bf5c2792e553ad5db456426938aa2348
5
5
  SHA512:
6
- metadata.gz: d4ef37d1c685dda04906927edcafcdc580053e76b3302dacbd3e19b87dd01bf60876d3994b43c11c033b970b2d796d836769a146df90532fad16dc4413ad991e
7
- data.tar.gz: f2784346815525259012798a2a5ab40dd3497d26373c29b2a972caa3fa419d200f662d3c533efcb1c383eda98acbf996f4057fc2e6d3674643f8d604bb00fbff
6
+ metadata.gz: a7f5db5f4147dbc412eb503f812b30cc223a9e3f6464c5ce08b5bc9f398bf5dae76dbc42a271b03b067becfa742356093305a607c1f16eafe0105ba87eebff94
7
+ data.tar.gz: f21fc2d475838dbb4302c8bcb498a6e69eefec2e1aed6f27facbac5ef091ec5d16c74bdb4570f4cd66b1c612a42a79ff4bc21df9892bd3c27935c749b2712de8
data/lib/jerakia/cli.rb CHANGED
@@ -37,19 +37,36 @@ class Jerakia
37
37
  aliases: :l,
38
38
  type: :string,
39
39
  desc: 'Log level'
40
+ option :debug,
41
+ aliases: :D,
42
+ type: :boolean,
43
+ desc: 'Debug information to console, implies --log-level debug'
40
44
  option :metadata,
41
45
  aliases: :d,
42
46
  type: :hash,
43
47
  desc: 'Key/value pairs to be used as metadata for the lookup'
44
48
  def lookup(key)
45
- jac = Jerakia.new({:config => options[:config]})
49
+
50
+ if options[:debug]
51
+ loglevel = "debug"
52
+ logfile = STDOUT
53
+ else
54
+ logfile = nil
55
+ loglevel = options[:log_level]
56
+ end
57
+
58
+ jac = Jerakia.new({
59
+ :config => options[:config],
60
+ :loglevel => options[:log_level],
61
+ :logfile => logfile,
62
+ :loglevel => loglevel,
63
+ })
46
64
  req = Jerakia::Request.new(
47
65
  :key => key,
48
66
  :namespace => options[:namespace].split(/::/),
49
67
  :policy => options[:policy].to_sym,
50
68
  :lookup_type => options[:type].to_sym,
51
69
  :merge => options[:merge_type].to_sym,
52
- :loglevel => options[:log_level],
53
70
  :metadata => options[:metadata]
54
71
  )
55
72
 
data/lib/jerakia/log.rb CHANGED
@@ -1,9 +1,8 @@
1
1
  class Jerakia::Log < Jerakia
2
2
 
3
3
  require 'logger'
4
- def initialize(level=:info)
5
- @@logfile ||= config[:logfile] || '/var/log/jerakia.log'
6
- @@logger ||= Logger.new(@@logfile)
4
+ def initialize(level=:info,file='/var/log/jerakia.log')
5
+ @@logger ||= Logger.new(file)
7
6
  @@level ||= level
8
7
  case @@level
9
8
  when :info
@@ -4,6 +4,6 @@ class Jerakia
4
4
  #
5
5
  # This should be updated when a new gem is released and it is read from the gemspec file
6
6
  #
7
- VERSION = "0.4.2"
7
+ VERSION = "0.4.3"
8
8
 
9
9
  end
data/lib/jerakia.rb CHANGED
@@ -20,7 +20,8 @@ class Jerakia
20
20
 
21
21
  @@filecache = {}
22
22
  loglevel = options[:loglevel] || @@config["loglevel"] || "info"
23
- @@log = Jerakia::Log.new(loglevel.to_sym)
23
+ logfile = options[:logfile] || @@config["logfile"] || "/var/log/jerakia.log"
24
+ @@log = Jerakia::Log.new(loglevel.to_sym, logfile)
24
25
  @@log.debug("Jerakia initialized")
25
26
  end
26
27
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jerakia
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Craig Dunn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-24 00:00:00.000000000 Z
11
+ date: 2015-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -80,7 +80,7 @@ files:
80
80
  - lib/jerakia/version.rb
81
81
  - lib/puppet/indirector/data_binding/jerakia.rb
82
82
  - lib/puppet/indirector/data_binding/jerakia_rest.rb
83
- homepage: http://github.com/crayfishx/jerakia
83
+ homepage: http://jerakia.io
84
84
  licenses:
85
85
  - Apache 2.0
86
86
  metadata: {}