1.4.0 |
2017-08-03 |
diff --git a/lib/octocatalog-diff/puppetdb.rb b/lib/octocatalog-diff/puppetdb.rb
index 39bfb56c..fb93d9d4 100644
--- a/lib/octocatalog-diff/puppetdb.rb
+++ b/lib/octocatalog-diff/puppetdb.rb
@@ -5,16 +5,12 @@
require 'uri'
-# Redefine constants to match PuppetDB defaults.
-# This code avoids warnings about redefining constants.
-URI::HTTP.send(:remove_const, :DEFAULT_PORT) if URI::HTTP.const_defined?(:DEFAULT_PORT)
-URI::HTTP.const_set(:DEFAULT_PORT, 8080)
-URI::HTTPS.send(:remove_const, :DEFAULT_PORT) if URI::HTTPS.const_defined?(:DEFAULT_PORT)
-URI::HTTPS.const_set(:DEFAULT_PORT, 8081)
-
module OctocatalogDiff
# A standard way to connect to PuppetDB from the various scripts in this repository.
class PuppetDB
+ DEFAULT_HTTPS_PORT = 8081
+ DEFAULT_HTTP_PORT = 8080
+
# Allow connections to be read (used in tests for now)
attr_reader :connections
@@ -54,7 +50,7 @@ def initialize(options = {})
urls.map { |url| parse_url(url) }
elsif options.key?(:puppetdb_host)
is_ssl = options.fetch(:puppetdb_ssl, true)
- default_port = is_ssl ? URI::HTTPS::DEFAULT_PORT : URI::HTTP::DEFAULT_PORT
+ default_port = is_ssl ? DEFAULT_HTTPS_PORT : DEFAULT_HTTP_PORT
port = options.fetch(:puppetdb_port, default_port).to_i
[{ ssl: is_ssl, host: options[:puppetdb_host], port: port }]
elsif ENV['PUPPETDB_URL'] && !ENV['PUPPETDB_URL'].empty?
@@ -64,7 +60,7 @@ def initialize(options = {})
# This will get the env var and see if it equals 'true'; the result
# of this == comparison is the true/false boolean we need.
is_ssl = ENV.fetch('PUPPETDB_SSL', 'true') == 'true'
- default_port = is_ssl ? URI::HTTPS::DEFAULT_PORT : URI::HTTP::DEFAULT_PORT
+ default_port = is_ssl ? DEFAULT_HTTPS_PORT : DEFAULT_HTTP_PORT
port = ENV.fetch('PUPPETDB_PORT', default_port).to_i
[{ ssl: is_ssl, host: ENV['PUPPETDB_HOST'], port: port }]
else
@@ -152,6 +148,10 @@ def _get(path)
# @return [Hash] { ssl: true/false, host: , port: }
def parse_url(url)
uri = URI(url)
+ if URI.split(url)[3].nil?
+ uri.port = uri.scheme == 'https' ? DEFAULT_HTTPS_PORT : DEFAULT_HTTP_PORT
+ end
+
raise ArgumentError, "URL #{url} has invalid scheme" unless uri.scheme =~ /^https?$/
{ ssl: uri.scheme == 'https', host: uri.host, port: uri.port }
rescue URI::InvalidURIError => exc
diff --git a/octocatalog-diff.gemspec b/octocatalog-diff.gemspec
index c939344a..7d753908 100644
--- a/octocatalog-diff.gemspec
+++ b/octocatalog-diff.gemspec
@@ -1,7 +1,7 @@
require_relative 'lib/octocatalog-diff/version'
require 'json'
-DEFAULT_PUPPET_VERSION = '4.10.0'.freeze
+DEFAULT_PUPPET_VERSION = '4.10.8'.freeze
Gem::Specification.new do |s|
s.required_ruby_version = '>= 2.0.0'
@@ -30,6 +30,7 @@ EOF
s.add_runtime_dependency 'hashdiff', '>= 0.3.0'
s.add_runtime_dependency 'rugged', '>= 0.25.0b2'
+ s.add_development_dependency 'bundler', '1.15.4'
s.add_development_dependency 'rspec', '~> 3.4.0'
s.add_development_dependency 'rake', '11.2.2'
s.add_development_dependency 'parallel_tests', '2.7.1'
diff --git a/script/bootstrap b/script/bootstrap
index 5664e543..e9689e78 100755
--- a/script/bootstrap
+++ b/script/bootstrap
@@ -4,12 +4,6 @@ echo 'Starting script/bootstrap'
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )"
-# FIXME: Remove when CI is switched to Travis
-if env | grep ^JANKY_ >/dev/null 2>&1 ; then
- export PATH=/usr/share/rbenv/shims:$PATH
- export RBENV_VERSION=2.1.2-github
-fi
-
rm -rf "${DIR}/.bundle"
rm -f "${DIR}/.puppet_version"
set -e
diff --git a/script/cibuild b/script/cibuild
index eb141036..c96c80c9 100755
--- a/script/cibuild
+++ b/script/cibuild
@@ -6,21 +6,27 @@
# with one or more Puppet versions, with PUPPET_VERSIONS set to a space-separated list
# of versions to test.
-[ -z "$PUPPET_VERSIONS" ] && export PUPPET_VERSIONS='3.8.7 4.10.0 5.0.0'
+[ -z "$PUPPET_VERSIONS" ] && export PUPPET_VERSIONS='3.8.7 4.10.8 5.0.0'
[ -z "$RUBOCOP_TEST" ] && export RUBOCOP_TEST='true'
[ -z "$RSPEC_TEST" ] && export RSPEC_TEST='true'
echo 'Starting script/cibuild'
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )"
+env
# Create a temporary file to capture output of various steps.
export OUTPUT_FILE="$(mktemp)"
function cleanup() {
rm -rf "$OUTPUT_FILE"
+ rm -f "${DIR}/.ruby-version"
}
trap cleanup EXIT
+# Create "$DIR/.ruby-version" from the current ruby version, so it propagates through
+# to the clean environment under which Puppet runs.
+ruby -e "print RUBY_VERSION" > "${DIR}/.ruby-version"
+
# Bootstrapping
function bootstrap() {
echo "Bootstrapping..."
diff --git a/vendor/cache/bundler-1.15.4.gem b/vendor/cache/bundler-1.15.4.gem
new file mode 100644
index 00000000..395f127e
Binary files /dev/null and b/vendor/cache/bundler-1.15.4.gem differ
diff --git a/vendor/cache/facter-2.4.6-universal-darwin.gem b/vendor/cache/facter-2.4.6-universal-darwin.gem
deleted file mode 100644
index e729b084..00000000
Binary files a/vendor/cache/facter-2.4.6-universal-darwin.gem and /dev/null differ
diff --git a/vendor/cache/facter-2.4.6.gem b/vendor/cache/facter-2.4.6.gem
deleted file mode 100644
index 40f1bed8..00000000
Binary files a/vendor/cache/facter-2.4.6.gem and /dev/null differ
diff --git a/vendor/cache/facter-2.5.1-universal-darwin.gem b/vendor/cache/facter-2.5.1-universal-darwin.gem
new file mode 100644
index 00000000..022db51e
Binary files /dev/null and b/vendor/cache/facter-2.5.1-universal-darwin.gem differ
diff --git a/vendor/cache/facter-2.5.1.gem b/vendor/cache/facter-2.5.1.gem
new file mode 100644
index 00000000..d1db3efd
Binary files /dev/null and b/vendor/cache/facter-2.5.1.gem differ
diff --git a/vendor/cache/gettext-setup-0.25.gem b/vendor/cache/gettext-setup-0.25.gem
deleted file mode 100644
index f4f9471e..00000000
Binary files a/vendor/cache/gettext-setup-0.25.gem and /dev/null differ
diff --git a/vendor/cache/gettext-setup-0.26.gem b/vendor/cache/gettext-setup-0.26.gem
new file mode 100644
index 00000000..059ed3b9
Binary files /dev/null and b/vendor/cache/gettext-setup-0.26.gem differ
diff --git a/vendor/cache/httparty-0.15.5.gem b/vendor/cache/httparty-0.15.5.gem
deleted file mode 100644
index 9e647651..00000000
Binary files a/vendor/cache/httparty-0.15.5.gem and /dev/null differ
diff --git a/vendor/cache/httparty-0.15.6.gem b/vendor/cache/httparty-0.15.6.gem
new file mode 100644
index 00000000..0de1ccf6
Binary files /dev/null and b/vendor/cache/httparty-0.15.6.gem differ
diff --git a/vendor/cache/parallel-1.11.2.gem b/vendor/cache/parallel-1.11.2.gem
deleted file mode 100644
index 845bfcc6..00000000
Binary files a/vendor/cache/parallel-1.11.2.gem and /dev/null differ
diff --git a/vendor/cache/parallel-1.12.0.gem b/vendor/cache/parallel-1.12.0.gem
new file mode 100644
index 00000000..85f67001
Binary files /dev/null and b/vendor/cache/parallel-1.12.0.gem differ
diff --git a/vendor/cache/puppet-4.10.0-universal-darwin.gem b/vendor/cache/puppet-4.10.0-universal-darwin.gem
deleted file mode 100644
index 93280080..00000000
Binary files a/vendor/cache/puppet-4.10.0-universal-darwin.gem and /dev/null differ
diff --git a/vendor/cache/puppet-4.10.0.gem b/vendor/cache/puppet-4.10.0.gem
deleted file mode 100644
index d457cee0..00000000
Binary files a/vendor/cache/puppet-4.10.0.gem and /dev/null differ
diff --git a/vendor/cache/puppet-4.10.8-universal-darwin.gem b/vendor/cache/puppet-4.10.8-universal-darwin.gem
new file mode 100644
index 00000000..9d6a6413
Binary files /dev/null and b/vendor/cache/puppet-4.10.8-universal-darwin.gem differ
diff --git a/vendor/cache/puppet-4.10.8.gem b/vendor/cache/puppet-4.10.8.gem
new file mode 100644
index 00000000..cea3c20a
Binary files /dev/null and b/vendor/cache/puppet-4.10.8.gem differ
diff --git a/vendor/cache/rugged-0.26.0.gem b/vendor/cache/rugged-0.26.0.gem
new file mode 100644
index 00000000..57ee1ffb
Binary files /dev/null and b/vendor/cache/rugged-0.26.0.gem differ
diff --git a/vendor/cache/rugged-0.26.0b5.gem b/vendor/cache/rugged-0.26.0b5.gem
deleted file mode 100644
index b3988d58..00000000
Binary files a/vendor/cache/rugged-0.26.0b5.gem and /dev/null differ
|