Skip to content

Commit

Permalink
(maint) Pin concurrent-ruby, puppet 6.14 compat, bump rake
Browse files Browse the repository at this point in the history
This commit addresses some bit rot that has happened in ace.

1. The concurrent-ruby 1.1.6 release triggers a seg fault in MRI ruby 2.5. There is a PR to concurrent ruby ruby-concurrency/concurrent-ruby#856 which I have verified fixes the seg fault but has not been merged/released. For now I pinned to 1.1.5 which does not have the issue.

2. The puppet 6.14.0 release included some changes that were incompatable with ace. First is the code loading for subclassing `Puppet::Configurer`. This was addressed in `ace` by simply loading all of puppet before `puppet/configurer`. The second issue is that previously puppet's logic for figuring out which server to connect to (based on SRV settings, server_list or Puppet[:ca_server] vs Puppet[:server} was spread out all over the place. Puppet switched to using a new http client in 6.14.0 So the logic for resolving which host to connect to is based on a set of resolvers.
The change in behavior is that previous ace was pushing `:server` onto the context and puppet would sometimes look that value up when making a connection: https://github.com/puppetlabs/puppet/blob/master/lib/puppet/util/connection.rb#L31

3. Rake was bumped due to some CVE that did not really affect our project.
  • Loading branch information
donoghuc committed Mar 25, 2020
1 parent 2f579a8 commit 508ad1f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Expand Up @@ -12,7 +12,7 @@ group :tests do
end

group :development do
gem 'bolt', git: 'https://github.com/puppetlabs/bolt', branch: 'master'
# gem 'bolt', git: 'https://github.com/puppetlabs/bolt', branch: 'master'
gem 'github_changelog_generator', '~> 1.14'
gem 'pry-byebug'
gem 'rubocop-rspec'
Expand Down
7 changes: 5 additions & 2 deletions agentless-catalog-executor.gemspec
Expand Up @@ -20,7 +20,10 @@ Gem::Specification.new do |spec|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]

spec.add_dependency "bolt", "~> 1.31"
# Pin concurrent-ruby to 1.1.5 until https://github.com/ruby-concurrency/concurrent-ruby/pull/856 is released
spec.add_dependency "concurrent-ruby", "1.1.5"
# TODO: migrate to bolt 2.x
spec.add_dependency "bolt", "~> 1.31"

# server-side dependencies cargo culted from https://github.com/puppetlabs/bolt/blob/4418da408643aa7eb5ed64f4c9704b941ea878dc/Gemfile#L10-L16
spec.add_dependency "hocon", ">= 1.2.5"
Expand All @@ -33,7 +36,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency "bundler", ">= 1.16", "< 3.0.0"
spec.add_development_dependency "faraday"
spec.add_development_dependency "rack-test", "~> 1.0"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency "rake", "~> 13.0"
spec.add_development_dependency "rspec", "~> 3.0"
spec.add_development_dependency "rubocop", "~> 0.50"
end
7 changes: 7 additions & 0 deletions lib/ace/configurer.rb
@@ -1,5 +1,12 @@
# frozen_string_literal: true

require 'puppet'
# NOTE: Changes in puppet code loading results in simply requiring `puppet/configurer` no longer
# possible. The following requires can make ruby load, however selectively loading code from puppet
# will likely lead to issues in the future. Instead, just load puppet here.
# require 'puppet/util/autoload'
# require 'puppet/parser/compiler'
# require 'puppet/parser'
require 'puppet/configurer'

module ACE
Expand Down
3 changes: 3 additions & 0 deletions lib/ace/puppet_util.rb
Expand Up @@ -66,6 +66,9 @@ def self.isolated_puppet_settings(certname, environment, enforce_environment, en
Puppet.settings[:logdir] = File.join(environment_dir, 'log')
Puppet.settings[:codedir] = File.join(environment_dir, 'code')
Puppet.settings[:plugindest] = File.join(environment_dir, 'plugins')
# With puppet 6.14.0 resolvers no longer set :server for pluginfact download, explicitly set them here
Puppet.settings[:server] = @ssl_settings[:server]
Puppet.settings[:masterport] = @ssl_settings[:serverport]

# establish a base_context. This needs to be the first context on the stack, but must not be created
# before all settings have been set. For example, this will create a Puppet::Environments::Directories
Expand Down

0 comments on commit 508ad1f

Please sign in to comment.