lookup_http 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/lookup_http.rb +5 -4
  3. metadata +7 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1c04f52622862bcbdc77f95eb81149c1c74f1892
4
- data.tar.gz: 52a734dfb486e3ba47607a0fedc66dd78ca4ad25
3
+ metadata.gz: 79c1b64f1e7d74df7921b67a8c197f82579f80f0
4
+ data.tar.gz: a799ea370509ab5e7b0a5294ff21f8262fb07d11
5
5
  SHA512:
6
- metadata.gz: e170cbb6d0b52406cfd6baae3c3c603a59281e08f256ef95ede9c442f78685bbd425f15b4b081ec399b40666649138276e73f531efd0bc787ee7c5675c05ccd5
7
- data.tar.gz: 577778de1f77e2f4dea599c6058364c6d662ede95af0554ebc58269e44216a777454fc083623210ac0b778c45cb4bcdcd824aebd4c5406333824095d489ed07f
6
+ metadata.gz: 7b0113244297b6521b73cc9c63cbb663a85d008137bef62fe57abfb3cc33fe09f544db21961140cd8f457a05de692fa461732de52a5c250cfe02e6cfa3d0d1dd
7
+ data.tar.gz: edb327ae08b0b4cd4f17ec065aee6fe3188c5e82a593434dbe16d6d9fd74951c7d34aa86c47b12df82265b026937c188a21ee030f8af2ef2fe2daf0277dad0c1
data/lib/lookup_http.rb CHANGED
@@ -1,5 +1,8 @@
1
1
  class LookupHttp
2
2
 
3
+ class LookupError < Error
4
+ end
5
+
3
6
  def initialize(opts={})
4
7
  require 'net/http'
5
8
  require 'net/https'
@@ -53,7 +56,6 @@ class LookupHttp
53
56
  # and return its structured representation. Currently we support YAML and JSON
54
57
  #
55
58
  def parse_json(answer)
56
- require 'rubygems'
57
59
  require 'json'
58
60
  JSON.parse(answer)
59
61
  end
@@ -80,8 +82,7 @@ class LookupHttp
80
82
  begin
81
83
  httpres = @http.request(httpreq)
82
84
  rescue Exception => e
83
- Hiera.warn("[lookup_http]: Net::HTTP threw exception #{e.message}")
84
- raise Exception, e.message unless @config[:failure] == 'graceful'
85
+ raise LookupHttp::LookupError, e.message unless @config[:failure] == 'graceful'
85
86
  return
86
87
  end
87
88
 
@@ -89,7 +90,7 @@ class LookupHttp
89
90
  log_debug("[lookup_http]: bad http response from #{@config[:host]}:#{@config[:port]}#{path}")
90
91
  log_debug("HTTP response code was #{httpres.code}")
91
92
  unless httpres.code == '404' && @config[:ignore_404]
92
- raise Exception, 'Bad HTTP response' unless @config[:failure] == 'graceful'
93
+ raise LookupHttp::LookupError, 'Bad HTTP response' unless @config[:failure] == 'graceful'
93
94
  end
94
95
  return
95
96
  end
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lookup_http
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.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: 2015-10-07 00:00:00.000000000 Z
11
+ date: 2017-04-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 1.1.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 1.1.1
27
27
  description: 'Library for data lookup tools (eg: hiera/jerakia) for looking up data
@@ -41,17 +41,17 @@ require_paths:
41
41
  - lib
42
42
  required_ruby_version: !ruby/object:Gem::Requirement
43
43
  requirements:
44
- - - '>='
44
+ - - ">="
45
45
  - !ruby/object:Gem::Version
46
46
  version: '0'
47
47
  required_rubygems_version: !ruby/object:Gem::Requirement
48
48
  requirements:
49
- - - '>='
49
+ - - ">="
50
50
  - !ruby/object:Gem::Version
51
51
  version: '0'
52
52
  requirements: []
53
53
  rubyforge_project:
54
- rubygems_version: 2.0.14
54
+ rubygems_version: 2.5.1
55
55
  signing_key:
56
56
  specification_version: 4
57
57
  summary: HTTP library for data lookup tools