octocatalog-diff 1.4.0 → 1.4.1

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: 5f0b3862bc04c59a30e41e90cf689f508cb68dd6
4
- data.tar.gz: 4e67157b3a0ba173d2d1099d1e0aec79027a8f3b
3
+ metadata.gz: 5486804b0688c2ffe926240984edc29adb1548c9
4
+ data.tar.gz: 31b6c0d0a659f8e9e02bed8d1a5e2bc8cd3c2892
5
5
  SHA512:
6
- metadata.gz: aa208efdde5e60a3bfdd1ced747632bc00d0fec7f916fed1765f9c8e7fe8de99160a7ef673e694fa043a90713af3df2c6eec620f9e792d2c0332864d04baf694
7
- data.tar.gz: 228113ef4f77899dfe3185b839b9d67f41db4ae9db0901f9aa7aa3307d0c67d8983982118c8e2dff433f37f428cccc8c1ca755f83c41e9a8a9965a6027bd4952
6
+ metadata.gz: 41e1c3d7d1a84b1a170cbc778257207da0f056d2b4e924ec455da0853fbfccb3c03c76e2f4b54b32c2f720e28252704a9b5ac30c7e7b99de80500afa5676e361
7
+ data.tar.gz: 7ef44432275da7754d00645fdb6c8ae2199881706703e30b5ec040dc35c1e33af7011e9e04c997f7aca3ba33a0a3680fd9bb8d1d129249c43a67e9d8c50c44aa
data/.version CHANGED
@@ -1 +1 @@
1
- 1.4.0
1
+ 1.4.1
@@ -8,6 +8,13 @@
8
8
  </tr>
9
9
  </thead><tbody>
10
10
  <tr valign=top>
11
+ <td>1.4.1</td>
12
+ <td>2017-10-02</td>
13
+ <td>
14
+ <li><a href="https://github.com/github/octocatalog-diff/pull/149">#149</a>: (Internal) Set ports on PuppetDB URLs without altering constants</li>
15
+ </td>
16
+ </tr>
17
+ <tr valign=top>
11
18
  <td>1.4.0</td>
12
19
  <td>2017-08-03</td>
13
20
  <td>
@@ -5,16 +5,12 @@ require_relative 'util/httparty'
5
5
 
6
6
  require 'uri'
7
7
 
8
- # Redefine constants to match PuppetDB defaults.
9
- # This code avoids warnings about redefining constants.
10
- URI::HTTP.send(:remove_const, :DEFAULT_PORT) if URI::HTTP.const_defined?(:DEFAULT_PORT)
11
- URI::HTTP.const_set(:DEFAULT_PORT, 8080)
12
- URI::HTTPS.send(:remove_const, :DEFAULT_PORT) if URI::HTTPS.const_defined?(:DEFAULT_PORT)
13
- URI::HTTPS.const_set(:DEFAULT_PORT, 8081)
14
-
15
8
  module OctocatalogDiff
16
9
  # A standard way to connect to PuppetDB from the various scripts in this repository.
17
10
  class PuppetDB
11
+ DEFAULT_HTTPS_PORT = 8081
12
+ DEFAULT_HTTP_PORT = 8080
13
+
18
14
  # Allow connections to be read (used in tests for now)
19
15
  attr_reader :connections
20
16
 
@@ -54,7 +50,7 @@ module OctocatalogDiff
54
50
  urls.map { |url| parse_url(url) }
55
51
  elsif options.key?(:puppetdb_host)
56
52
  is_ssl = options.fetch(:puppetdb_ssl, true)
57
- default_port = is_ssl ? URI::HTTPS::DEFAULT_PORT : URI::HTTP::DEFAULT_PORT
53
+ default_port = is_ssl ? DEFAULT_HTTPS_PORT : DEFAULT_HTTP_PORT
58
54
  port = options.fetch(:puppetdb_port, default_port).to_i
59
55
  [{ ssl: is_ssl, host: options[:puppetdb_host], port: port }]
60
56
  elsif ENV['PUPPETDB_URL'] && !ENV['PUPPETDB_URL'].empty?
@@ -64,7 +60,7 @@ module OctocatalogDiff
64
60
  # This will get the env var and see if it equals 'true'; the result
65
61
  # of this == comparison is the true/false boolean we need.
66
62
  is_ssl = ENV.fetch('PUPPETDB_SSL', 'true') == 'true'
67
- default_port = is_ssl ? URI::HTTPS::DEFAULT_PORT : URI::HTTP::DEFAULT_PORT
63
+ default_port = is_ssl ? DEFAULT_HTTPS_PORT : DEFAULT_HTTP_PORT
68
64
  port = ENV.fetch('PUPPETDB_PORT', default_port).to_i
69
65
  [{ ssl: is_ssl, host: ENV['PUPPETDB_HOST'], port: port }]
70
66
  else
@@ -152,6 +148,10 @@ module OctocatalogDiff
152
148
  # @return [Hash] { ssl: true/false, host: <String>, port: <Integer> }
153
149
  def parse_url(url)
154
150
  uri = URI(url)
151
+ if URI.split(url)[3].nil?
152
+ uri.port = uri.scheme == 'https' ? DEFAULT_HTTPS_PORT : DEFAULT_HTTP_PORT
153
+ end
154
+
155
155
  raise ArgumentError, "URL #{url} has invalid scheme" unless uri.scheme =~ /^https?$/
156
156
  { ssl: uri.scheme == 'https', host: uri.host, port: uri.port }
157
157
  rescue URI::InvalidURIError => exc
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: octocatalog-diff
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub, Inc.
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-08-03 00:00:00.000000000 Z
12
+ date: 2017-10-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: diffy
@@ -67,6 +67,20 @@ dependencies:
67
67
  - - ">="
68
68
  - !ruby/object:Gem::Version
69
69
  version: 0.25.0b2
70
+ - !ruby/object:Gem::Dependency
71
+ name: bundler
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - '='
75
+ - !ruby/object:Gem::Version
76
+ version: 1.15.4
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - '='
82
+ - !ruby/object:Gem::Version
83
+ version: 1.15.4
70
84
  - !ruby/object:Gem::Dependency
71
85
  name: rspec
72
86
  requirement: !ruby/object:Gem::Requirement
@@ -171,14 +185,14 @@ dependencies:
171
185
  requirements:
172
186
  - - "~>"
173
187
  - !ruby/object:Gem::Version
174
- version: 4.10.0
188
+ version: 4.10.8
175
189
  type: :development
176
190
  prerelease: false
177
191
  version_requirements: !ruby/object:Gem::Requirement
178
192
  requirements:
179
193
  - - "~>"
180
194
  - !ruby/object:Gem::Version
181
- version: 4.10.0
195
+ version: 4.10.8
182
196
  - !ruby/object:Gem::Dependency
183
197
  name: puppetdb-terminus
184
198
  requirement: !ruby/object:Gem::Requirement