Skip to content

Commit

Permalink
(puppetlabsGH-2304) Do not require service-url for pcp config
Browse files Browse the repository at this point in the history
Given we allow reading orchestrator.conf in the orchestrator-client library, only add a default port to the service-url if one is specified in the pcp config from bolt transport config.
  • Loading branch information
donoghuc committed Nov 12, 2020
1 parent 5d9a2e4 commit 5b9e8e2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
5 changes: 0 additions & 5 deletions lib/bolt/transport/orch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@
module Bolt
module Transport
class Orch < Base
CONF_FILE = if ENV['HOME'].nil?
'/etc/puppetlabs/client-tools/orchestrator.conf'
else
File.expand_path('~/.puppetlabs/client-tools/orchestrator.conf')
end
BOLT_COMMAND_TASK = Struct.new(:name).new('bolt_shim::command').freeze
BOLT_SCRIPT_TASK = Struct.new(:name).new('bolt_shim::script').freeze
BOLT_UPLOAD_TASK = Struct.new(:name).new('bolt_shim::upload').freeze
Expand Down
9 changes: 4 additions & 5 deletions lib/bolt/transport/orch/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,12 @@ def initialize(opts, plan_context, logger)
@key = self.class.get_key(opts)
client_opts = opts.slice('token-file', 'cacert', 'job-poll-interval', 'job-poll-timeout')

unless opts['service-url'] && !opts['service-url'].empty?
raise Bolt::ValidationError, "must specify a value for service-url when using the PCP transport"
if opts['service-url']
uri = Addressable::URI.parse(opts['service-url'])
uri&.port ||= 8143
client_opts['service-url'] = uri.to_s
end

uri = Addressable::URI.parse(opts['service-url'])
uri&.port ||= 8143
client_opts['service-url'] = uri.to_s
client_opts['User-Agent'] = "Bolt/#{VERSION}"

%w[token-file cacert].each do |f|
Expand Down

0 comments on commit 5b9e8e2

Please sign in to comment.