jerakia 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- MzQ2YTJkNGRkY2ViNGVmMjFlNWFlYjlkYmE4OTY2NzY2YTE1NjQ0YQ==
5
- data.tar.gz: !binary |-
6
- YWJmMWVmZjUzYzk2OTFjZDZmM2MzYmEzZTY1NGU5NWZmMjU3Yjc2OA==
2
+ SHA1:
3
+ metadata.gz: c6acac89ddfc15c52ab520f40f8742b41bfff43c
4
+ data.tar.gz: 3d38c1f23615cf0d768e1ee570c336eafc4dd305
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- NWQ0ZjNkMmRhNTQ2NGM2MDdiNzE2ZjY2NDA2MTAxNmE2MmI1ZTY0MGFiZjMz
10
- M2FjZTg3Mzk2OTcwY2FmMWVhNWJmMDIzYTk3MjgyMzRlMmQ4MGQ4MTU5MmMx
11
- MzJhNDMwN2NlZTUxYzMyMmViOTMyMDA0M2UwYWFmYWQzZjdkM2U=
12
- data.tar.gz: !binary |-
13
- ODVlMWY3NjMyYmUwMDI2NjkwNTRmMzYxYjIyYzRkYzQ4NjE1NDgyNWNhMDBi
14
- YTRkMjM3MjkxNmNhOTk0MzE4NTZlNDhhN2QwOGY2YzUwZTY5NmUzMDRhZTQz
15
- NDk5MmVmMDQ3ZDM1MDgwMTA2ZGExYjE0NzU1MDRiM2MxNDIzYTc=
6
+ metadata.gz: 8c7d34fa57d58252f3e8e60be1d4eee70e2bb5e96edb5667273394366eae282a9af473afcb298aee9c67a05789ff477411fe0405d92112d18af71d53c9152372
7
+ data.tar.gz: d469edcfd9ac14665944b372e29f8533eed8bce3c507f04073056af67363ebf273bb650a211f4bc19a94ee11c70bf1f91502f2afe3fae5f4175e45554f38d94a
@@ -26,7 +26,10 @@ class Jerakia::Datasource
26
26
  end
27
27
 
28
28
  def option(opt, data={})
29
- @options[opt] ||= data[:default] || nil
29
+ if @options[opt].nil? and data.key?(:default)
30
+ @options[opt] = data[:default]
31
+ end
32
+
30
33
  Jerakia.log.debug("[#{whoami}]: options[#{opt}] to #{options[opt]} [#{options[opt].class}]")
31
34
  if @options[opt].nil?
32
35
  raise Jerakia::PolicyError, "#{opt} option must be supplied for datasource #{@name} in lookup #{lookup.name}" if data[:mandatory]
@@ -54,14 +54,23 @@ class Jerakia::Datasource
54
54
  options[:paths].flatten.each do |path|
55
55
  Jerakia.log.debug("Attempting to load data from #{path}")
56
56
  return unless response.want?
57
+
57
58
  data=http_lookup.get_parsed(path)
58
- Jerakia.log.debug("Datasource provided #{data} looking for key #{lookup.request.key}")
59
- unless data[lookup.request.key].nil?
60
- Jerakia.log.debug("Found data #{data[lookup.request.key]}")
61
- response.submit data[lookup.request.key]
59
+ Jerakia.log.debug("Datasource provided #{data} (#{data.class}) looking for key #{lookup.request.key}")
60
+
61
+ if data.is_a?(Hash)
62
+ unless data[lookup.request.key].nil?
63
+ Jerakia.log.debug("Found data #{data[lookup.request.key]}")
64
+ response.submit data[lookup.request.key]
65
+ end
66
+ else
67
+ unless options[:output] == 'plain' or options[:failure] == 'graceful'
68
+ raise Jerakia::Error, "HTTP request did not return a hash for #{lookup.request.key} #{whoami}"
69
+ end
70
+ response.submit data
62
71
  end
72
+
63
73
  end
64
-
65
74
  end
66
75
  end
67
76
  end
@@ -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 = "1.1.0"
7
+ VERSION = "1.1.1"
8
8
 
9
9
  end
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: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Craig Dunn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-22 00:00:00.000000000 Z
11
+ date: 2016-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -42,14 +42,14 @@ dependencies:
42
42
  name: lookup_http
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ! '>='
45
+ - - '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: 1.0.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ! '>='
52
+ - - '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: 1.0.0
55
55
  description: Extendable and flexible data lookup system
@@ -107,17 +107,17 @@ require_paths:
107
107
  - lib
108
108
  required_ruby_version: !ruby/object:Gem::Requirement
109
109
  requirements:
110
- - - ! '>='
110
+ - - '>='
111
111
  - !ruby/object:Gem::Version
112
112
  version: '0'
113
113
  required_rubygems_version: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ! '>='
115
+ - - '>='
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  requirements: []
119
119
  rubyforge_project:
120
- rubygems_version: 2.2.5
120
+ rubygems_version: 2.2.2
121
121
  signing_key:
122
122
  specification_version: 4
123
123
  summary: Extendable and flexible ata lookup system