bolt 2.32.0 → 2.36.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of bolt might be problematic. Click here for more details.

Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/Puppetfile +6 -6
  3. data/bolt-modules/boltlib/lib/puppet/datatypes/applyresult.rb +1 -0
  4. data/bolt-modules/boltlib/lib/puppet/functions/catch_errors.rb +1 -3
  5. data/bolt-modules/boltlib/lib/puppet/functions/download_file.rb +17 -6
  6. data/bolt-modules/boltlib/lib/puppet/functions/facts.rb +6 -0
  7. data/bolt-modules/boltlib/lib/puppet/functions/parallelize.rb +56 -0
  8. data/bolt-modules/boltlib/lib/puppet/functions/puppetdb_query.rb +2 -2
  9. data/bolt-modules/boltlib/lib/puppet/functions/run_command.rb +24 -6
  10. data/bolt-modules/boltlib/lib/puppet/functions/run_script.rb +27 -8
  11. data/bolt-modules/boltlib/lib/puppet/functions/run_task.rb +21 -1
  12. data/bolt-modules/boltlib/lib/puppet/functions/run_task_with.rb +18 -1
  13. data/bolt-modules/boltlib/lib/puppet/functions/upload_file.rb +24 -6
  14. data/guides/logging.txt +18 -0
  15. data/lib/bolt/analytics.rb +27 -8
  16. data/lib/bolt/apply_result.rb +3 -3
  17. data/lib/bolt/bolt_option_parser.rb +43 -15
  18. data/lib/bolt/cli.rb +79 -227
  19. data/lib/bolt/config.rb +131 -52
  20. data/lib/bolt/config/options.rb +46 -8
  21. data/lib/bolt/config/transport/base.rb +10 -19
  22. data/lib/bolt/config/transport/local.rb +0 -7
  23. data/lib/bolt/config/transport/options.rb +1 -1
  24. data/lib/bolt/config/transport/ssh.rb +8 -14
  25. data/lib/bolt/config/validator.rb +231 -0
  26. data/lib/bolt/error.rb +37 -3
  27. data/lib/bolt/executor.rb +103 -17
  28. data/lib/bolt/inventory/group.rb +2 -1
  29. data/lib/bolt/module_installer.rb +2 -1
  30. data/lib/bolt/module_installer/specs/forge_spec.rb +5 -4
  31. data/lib/bolt/module_installer/specs/git_spec.rb +4 -3
  32. data/lib/bolt/outputter/human.rb +21 -9
  33. data/lib/bolt/outputter/rainbow.rb +1 -1
  34. data/lib/bolt/pal.rb +48 -30
  35. data/lib/bolt/pal/yaml_plan.rb +11 -2
  36. data/lib/bolt/pal/yaml_plan/evaluator.rb +23 -1
  37. data/lib/bolt/pal/yaml_plan/loader.rb +14 -9
  38. data/lib/bolt/plan_creator.rb +160 -0
  39. data/lib/bolt/plugin.rb +1 -8
  40. data/lib/bolt/project.rb +30 -36
  41. data/lib/bolt/project_manager.rb +199 -0
  42. data/lib/bolt/{project_migrator/config.rb → project_manager/config_migrator.rb} +43 -5
  43. data/lib/bolt/{project_migrator/inventory.rb → project_manager/inventory_migrator.rb} +5 -5
  44. data/lib/bolt/{project_migrator/base.rb → project_manager/migrator.rb} +2 -2
  45. data/lib/bolt/{project_migrator/modules.rb → project_manager/module_migrator.rb} +3 -3
  46. data/lib/bolt/puppetdb/client.rb +3 -2
  47. data/lib/bolt/puppetdb/config.rb +9 -8
  48. data/lib/bolt/result.rb +23 -11
  49. data/lib/bolt/shell/bash.rb +12 -7
  50. data/lib/bolt/shell/powershell.rb +12 -7
  51. data/lib/bolt/task/run.rb +1 -1
  52. data/lib/bolt/transport/base.rb +18 -18
  53. data/lib/bolt/transport/docker.rb +23 -6
  54. data/lib/bolt/transport/orch.rb +23 -19
  55. data/lib/bolt/transport/orch/connection.rb +10 -3
  56. data/lib/bolt/transport/remote.rb +3 -3
  57. data/lib/bolt/transport/simple.rb +6 -6
  58. data/lib/bolt/transport/ssh/exec_connection.rb +6 -2
  59. data/lib/bolt/util.rb +19 -7
  60. data/lib/bolt/version.rb +1 -1
  61. data/lib/bolt/yarn.rb +23 -0
  62. data/lib/bolt_server/base_config.rb +3 -1
  63. data/lib/bolt_server/config.rb +3 -1
  64. data/lib/bolt_server/file_cache.rb +2 -0
  65. data/lib/bolt_server/schemas/partials/task.json +2 -2
  66. data/lib/bolt_server/transport_app.rb +42 -11
  67. data/lib/bolt_spec/plans/action_stubs/command_stub.rb +1 -1
  68. data/lib/bolt_spec/plans/action_stubs/script_stub.rb +1 -1
  69. data/lib/bolt_spec/plans/mock_executor.rb +9 -6
  70. data/libexec/apply_catalog.rb +1 -1
  71. data/libexec/custom_facts.rb +1 -1
  72. data/libexec/query_resources.rb +1 -1
  73. metadata +12 -14
  74. data/lib/bolt/project_migrator.rb +0 -80
  75. data/modules/secure_env_vars/plans/init.pp +0 -20
@@ -17,13 +17,20 @@ module Bolt
17
17
  end
18
18
 
19
19
  def initialize(opts, plan_context, logger)
20
+ require 'addressable/uri'
21
+
20
22
  @logger = logger
21
23
  @key = self.class.get_key(opts)
22
- client_keys = %w[service-url token-file cacert job-poll-interval job-poll-timeout]
23
- client_opts = client_keys.each_with_object({}) do |k, acc|
24
- acc[k] = opts[k] if opts.include?(k)
24
+ client_opts = opts.slice('token-file', 'cacert', 'job-poll-interval', 'job-poll-timeout')
25
+
26
+ if opts['service-url']
27
+ uri = Addressable::URI.parse(opts['service-url'])
28
+ uri&.port ||= 8143
29
+ client_opts['service-url'] = uri.to_s
25
30
  end
31
+
26
32
  client_opts['User-Agent'] = "Bolt/#{VERSION}"
33
+
27
34
  %w[token-file cacert].each do |f|
28
35
  client_opts[f] = File.expand_path(client_opts[f]) if client_opts[f]
29
36
  end
@@ -26,14 +26,14 @@ module Bolt
26
26
  end
27
27
 
28
28
  # Cannot batch because arugments differ
29
- def run_task(target, task, arguments, options = {})
29
+ def run_task(target, task, arguments, options = {}, position = [])
30
30
  proxy_target = get_proxy(target)
31
31
  transport = @executor.transport(proxy_target.transport)
32
- arguments = arguments.merge('_target' => target.to_h.reject { |_, v| v.nil? })
32
+ arguments = arguments.merge('_target' => target.to_h.compact)
33
33
 
34
34
  remote_task = task.remote_instance
35
35
 
36
- result = transport.run_task(proxy_target, remote_task, arguments, options)
36
+ result = transport.run_task(proxy_target, remote_task, arguments, options, position)
37
37
  Bolt::Result.new(target, value: result.value, action: 'task', object: task.name)
38
38
  end
39
39
  end
@@ -20,9 +20,9 @@ module Bolt
20
20
  false
21
21
  end
22
22
 
23
- def run_command(target, command, options = {})
23
+ def run_command(target, command, options = {}, position = [])
24
24
  with_connection(target) do |conn|
25
- conn.shell.run_command(command, options)
25
+ conn.shell.run_command(command, options, position)
26
26
  end
27
27
  end
28
28
 
@@ -38,15 +38,15 @@ module Bolt
38
38
  end
39
39
  end
40
40
 
41
- def run_script(target, script, arguments, options = {})
41
+ def run_script(target, script, arguments, options = {}, position = [])
42
42
  with_connection(target) do |conn|
43
- conn.shell.run_script(script, arguments, options)
43
+ conn.shell.run_script(script, arguments, options, position)
44
44
  end
45
45
  end
46
46
 
47
- def run_task(target, task, arguments, options = {})
47
+ def run_task(target, task, arguments, options = {}, position = [])
48
48
  with_connection(target) do |conn|
49
- conn.shell.run_task(task, arguments, options)
49
+ conn.shell.run_task(task, arguments, options, position)
50
50
  end
51
51
  end
52
52
  end
@@ -12,8 +12,12 @@ module Bolt
12
12
  raise Bolt::ValidationError, "Target #{target.safe_name} does not have a host" unless target.host
13
13
 
14
14
  @target = target
15
- ssh_config = Net::SSH::Config.for(target.host)
16
- @user = @target.user || ssh_config[:user] || Etc.getlogin
15
+ begin
16
+ ssh_config = Net::SSH::Config.for(target.host)
17
+ @user = @target.user || ssh_config[:user] || Etc.getlogin
18
+ rescue StandardError
19
+ @user = @target.user || Etc.getlogin
20
+ end
17
21
  @logger = Bolt::Logger.logger(self)
18
22
  end
19
23
 
@@ -29,19 +29,26 @@ module Bolt
29
29
  path = File.expand_path(path)
30
30
  content = File.open(path, "r:UTF-8") { |f| YAML.safe_load(f.read) } || {}
31
31
  unless content.is_a?(Hash)
32
- msg = "Invalid content for #{file_name} file: #{path} should be a Hash or empty, not #{content.class}"
33
- raise Bolt::FileError.new(msg, path)
32
+ raise Bolt::FileError.new(
33
+ "Invalid content for #{file_name} file at #{path}\nContent should be a Hash or empty, "\
34
+ "not #{content.class}",
35
+ path
36
+ )
34
37
  end
35
38
  logger.trace("Loaded #{file_name} from #{path}")
36
39
  content
37
40
  rescue Errno::ENOENT
38
- raise Bolt::FileError.new("Could not read #{file_name} file: #{path}", path)
41
+ raise Bolt::FileError.new("Could not read #{file_name} file at #{path}", path)
42
+ rescue Psych::SyntaxError => e
43
+ raise Bolt::FileError.new("Could not parse #{file_name} file at #{path}, line #{e.line}, "\
44
+ "column #{e.column}\n#{e.problem}",
45
+ path)
39
46
  rescue Psych::Exception => e
40
- raise Bolt::FileError.new("Could not parse #{file_name} file: #{path}\n"\
41
- "Error at line #{e.line} column #{e.column}", path)
47
+ raise Bolt::FileError.new("Could not parse #{file_name} file at #{path}\n#{e.message}",
48
+ path)
42
49
  rescue IOError, SystemCallError => e
43
- raise Bolt::FileError.new("Could not read #{file_name} file: #{path}\n"\
44
- "error: #{e}", path)
50
+ raise Bolt::FileError.new("Could not read #{file_name} file at #{path}\n#{e.message}",
51
+ path)
45
52
  end
46
53
 
47
54
  def read_optional_yaml_hash(path, file_name)
@@ -273,6 +280,11 @@ module Bolt
273
280
  !!File::ALT_SEPARATOR
274
281
  end
275
282
 
283
+ # Returns true if running in PowerShell.
284
+ def powershell?
285
+ !!ENV['PSModulePath']
286
+ end
287
+
276
288
  # Accept hash and return hash with top level keys of type "String" converted to symbols.
277
289
  def symbolize_top_level_keys(hsh)
278
290
  hsh.each_with_object({}) { |(k, v), h| k.is_a?(String) ? h[k.to_sym] = v : h[k] = v }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bolt
4
- VERSION = '2.32.0'
4
+ VERSION = '2.36.0'
5
5
  end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'fiber'
4
+
5
+ module Bolt
6
+ class Yarn
7
+ attr_reader :fiber, :value, :index
8
+
9
+ def initialize(fiber, index)
10
+ @fiber = fiber
11
+ @index = index
12
+ @value = nil
13
+ end
14
+
15
+ def alive?
16
+ fiber.alive?
17
+ end
18
+
19
+ def resume
20
+ @value = fiber.resume
21
+ end
22
+ end
23
+ end
@@ -7,7 +7,9 @@ module BoltServer
7
7
  class BaseConfig
8
8
  def config_keys
9
9
  %w[host port ssl-cert ssl-key ssl-ca-cert
10
- ssl-cipher-suites loglevel logfile allowlist projects-dir]
10
+ ssl-cipher-suites loglevel logfile allowlist
11
+ projects-dir environments-codedir
12
+ environmentpath basemodulepath]
11
13
  end
12
14
 
13
15
  def env_keys
@@ -7,7 +7,9 @@ require 'bolt/error'
7
7
  module BoltServer
8
8
  class Config < BoltServer::BaseConfig
9
9
  def config_keys
10
- super + %w[concurrency cache-dir file-server-conn-timeout file-server-uri projects-dir]
10
+ super + %w[concurrency cache-dir file-server-conn-timeout
11
+ file-server-uri projects-dir environments-codedir
12
+ environmentpath basemodulepath]
11
13
  end
12
14
 
13
15
  def env_keys
@@ -63,6 +63,7 @@ module BoltServer
63
63
  end
64
64
 
65
65
  def client
66
+ # rubocop:disable Naming/VariableNumber
66
67
  @client ||= begin
67
68
  uri = URI(@config['file-server-uri'])
68
69
  https = Net::HTTP.new(uri.host, uri.port)
@@ -75,6 +76,7 @@ module BoltServer
75
76
  https.open_timeout = @config['file-server-conn-timeout']
76
77
  https
77
78
  end
79
+ # rubocop:enable Naming/VariableNumber
78
80
  end
79
81
 
80
82
  def request_file(path, params, file)
@@ -64,7 +64,7 @@
64
64
  "description": "Environment the task is in",
65
65
  "type": "string"
66
66
  },
67
- "project": {
67
+ "versioned_project": {
68
68
  "description": "Project the task is in",
69
69
  "type": "string"
70
70
  }
@@ -77,7 +77,7 @@
77
77
  },
78
78
  {
79
79
  "required": [
80
- "project"
80
+ "versioned_project"
81
81
  ]
82
82
  }
83
83
  ],
@@ -48,6 +48,10 @@ module BoltServer
48
48
  # See the `orchestrator.bolt.codedir` tk config setting.
49
49
  DEFAULT_BOLT_CODEDIR = '/opt/puppetlabs/server/data/orchestration-services/code'
50
50
 
51
+ MISSING_PROJECT_REF_RESPONSE = [
52
+ 400, Bolt::ValidationError.new('`project_ref` is a required argument').to_json
53
+ ].freeze
54
+
51
55
  def initialize(config)
52
56
  @config = config
53
57
  @schemas = Hash[REQUEST_SCHEMAS.map do |basename|
@@ -231,9 +235,9 @@ module BoltServer
231
235
  #
232
236
  # WARNING: THIS FUNCTION SHOULD ONLY BE CALLED INSIDE A SYNCHRONIZED PAL MUTEX
233
237
  def modulepath_from_environment(environment_name)
234
- codedir = DEFAULT_BOLT_CODEDIR
235
- environmentpath = "#{codedir}/environments"
236
- basemodulepath = "#{codedir}/modules:/opt/puppetlabs/puppet/modules"
238
+ codedir = @config['environments-codedir'] || DEFAULT_BOLT_CODEDIR
239
+ environmentpath = @config['environmentpath'] || "#{codedir}/environments"
240
+ basemodulepath = @config['basemodulepath'] || "#{codedir}/modules:/opt/puppetlabs/puppet/modules"
237
241
  modulepath_dirs = nil
238
242
  with_pe_pal_init_settings(codedir, environmentpath, basemodulepath) do
239
243
  environment = Puppet.lookup(:environments).get!(environment_name)
@@ -261,13 +265,16 @@ module BoltServer
261
265
  end
262
266
  end
263
267
 
264
- def in_bolt_project(bolt_project)
265
- return [400, '`project_ref` is a required argument'] if bolt_project.nil?
266
- project_dir = File.join(@config['projects-dir'], bolt_project)
267
- return [400, "`project_ref`: #{project_dir} does not exist"] unless Dir.exist?(project_dir)
268
+ def config_from_project(project_ref)
269
+ project_dir = File.join(@config['projects-dir'], project_ref)
270
+ raise Bolt::ValidationError, "`project_ref`: #{project_dir} does not exist" unless Dir.exist?(project_dir)
271
+ project = Bolt::Project.create_project(project_dir)
272
+ Bolt::Config.from_project(project, { log: { 'bolt-debug.log' => 'disable' } })
273
+ end
274
+
275
+ def in_bolt_project(project_ref)
268
276
  @pal_mutex.synchronize do
269
- project = Bolt::Project.create_project(project_dir)
270
- bolt_config = Bolt::Config.from_project(project, { log: { 'bolt-debug.log' => 'disable' } })
277
+ bolt_config = config_from_project(project_ref)
271
278
  modulepath_object = Bolt::Config::Modulepath.new(
272
279
  bolt_config.modulepath,
273
280
  boltlib_path: [PE_BOLTLIB_PATH, Bolt::Config::Modulepath::BOLTLIB_PATH]
@@ -508,6 +515,7 @@ module BoltServer
508
515
  #
509
516
  # @param project_ref [String] the project to fetch the plan from
510
517
  get '/project_plans/:module_name/:plan_name' do
518
+ return MISSING_PROJECT_REF_RESPONSE if params['project_ref'].nil?
511
519
  in_bolt_project(params['project_ref']) do |context|
512
520
  plan_info = pe_plan_info(context[:pal], params[:module_name], params[:plan_name])
513
521
  plan_info = allowed_helper(plan_info, context[:config].project.plans)
@@ -532,9 +540,10 @@ module BoltServer
532
540
  #
533
541
  # @param bolt_project_ref [String] the reference to the bolt-project directory to load task metadata from
534
542
  get '/project_tasks/:module_name/:task_name' do
543
+ return MISSING_PROJECT_REF_RESPONSE if params['project_ref'].nil?
535
544
  in_bolt_project(params['project_ref']) do |context|
536
545
  ps_parameters = {
537
- 'project' => params['project_ref']
546
+ 'versioned_project' => params['project_ref']
538
547
  }
539
548
  task_info = pe_task_info(context[:pal], params[:module_name], params[:task_name], ps_parameters)
540
549
  task_info = allowed_helper(task_info, context[:config].project.tasks)
@@ -570,6 +579,7 @@ module BoltServer
570
579
  #
571
580
  # @param project_ref [String] the project to fetch the list of plans from
572
581
  get '/project_plans' do
582
+ return MISSING_PROJECT_REF_RESPONSE if params['project_ref'].nil?
573
583
  in_bolt_project(params['project_ref']) do |context|
574
584
  plans_response = plan_list(context[:pal])
575
585
 
@@ -603,6 +613,7 @@ module BoltServer
603
613
  #
604
614
  # @param project_ref [String] the project to fetch the list of tasks from
605
615
  get '/project_tasks' do
616
+ return MISSING_PROJECT_REF_RESPONSE if params['project_ref'].nil?
606
617
  in_bolt_project(params['project_ref']) do |context|
607
618
  tasks_response = task_list(context[:pal])
608
619
 
@@ -621,6 +632,7 @@ module BoltServer
621
632
  #
622
633
  # @param project_ref [String] the project_ref to fetch the file metadatas from
623
634
  get '/project_file_metadatas/:module_name/*' do
635
+ return MISSING_PROJECT_REF_RESPONSE if params['project_ref'].nil?
624
636
  in_bolt_project(params['project_ref']) do |context|
625
637
  file = params[:splat].first
626
638
  metadatas = file_metadatas(context[:pal], params[:module_name], file)
@@ -630,13 +642,32 @@ module BoltServer
630
642
  [400, e.message]
631
643
  end
632
644
 
645
+ # Returns a list of targets parsed from a Project inventory
646
+ #
647
+ # @param project_ref [String] the project_ref to compute the inventory from
648
+ post '/project_inventory_targets' do
649
+ return MISSING_PROJECT_REF_RESPONSE if params['project_ref'].nil?
650
+ bolt_config = config_from_project(params['project_ref'])
651
+ if bolt_config.inventoryfile && bolt_config.project.inventory_file.to_s != bolt_config.inventoryfile
652
+ raise Bolt::ValidationError, "Project inventory must be defined in the " \
653
+ "inventory.yaml file at the root of the project directory"
654
+ end
655
+ plugins = Bolt::Plugin.setup(bolt_config, nil)
656
+ inventory = Bolt::Inventory.from_config(bolt_config, plugins)
657
+ target_list = inventory.get_targets('all').map { |targ| targ.to_h.merge({ 'transport' => targ.transport }) }
658
+
659
+ [200, target_list.to_json]
660
+ rescue Bolt::Error => e
661
+ [500, e.to_json]
662
+ end
663
+
633
664
  error 404 do
634
665
  err = Bolt::Error.new("Could not find route #{request.path}",
635
666
  'boltserver/not-found')
636
667
  [404, err.to_json]
637
668
  end
638
669
 
639
- error 500 do
670
+ error StandardError do
640
671
  e = env['sinatra.error']
641
672
  err = Bolt::Error.new("500: Unknown error: #{e.message}",
642
673
  'boltserver/server-error')
@@ -29,7 +29,7 @@ module BoltSpec
29
29
  end
30
30
 
31
31
  def result_for(target, stdout: '', stderr: '')
32
- Bolt::Result.for_command(target, stdout, stderr, 0, 'command', '')
32
+ Bolt::Result.for_command(target, stdout, stderr, 0, 'command', '', [])
33
33
  end
34
34
 
35
35
  # Public methods
@@ -35,7 +35,7 @@ module BoltSpec
35
35
  end
36
36
 
37
37
  def result_for(target, stdout: '', stderr: '')
38
- Bolt::Result.for_command(target, stdout, stderr, 0, 'script', '')
38
+ Bolt::Result.for_command(target, stdout, stderr, 0, 'script', '', [])
39
39
  end
40
40
 
41
41
  # Public methods
@@ -17,12 +17,13 @@ module BoltSpec
17
17
 
18
18
  # Nothing on the executor is 'public'
19
19
  class MockExecutor
20
- attr_reader :noop, :error_message
20
+ attr_reader :noop, :error_message, :in_parallel
21
21
  attr_accessor :run_as, :transport_features, :execute_any_plan
22
22
 
23
23
  def initialize(modulepath)
24
24
  @noop = false
25
25
  @run_as = nil
26
+ @in_parallel = false
26
27
  @error_message = nil
27
28
  @allow_apply = false
28
29
  @modulepath = [modulepath].flatten.map { |path| File.absolute_path(path) }
@@ -48,7 +49,7 @@ module BoltSpec
48
49
  ([segments[0]] + segments[2..-1]).join('/')
49
50
  end
50
51
 
51
- def run_command(targets, command, options = {})
52
+ def run_command(targets, command, options = {}, _position = [])
52
53
  result = nil
53
54
  if (doub = @command_doubles[command] || @command_doubles[:default])
54
55
  result = doub.process(targets, command, options)
@@ -61,7 +62,7 @@ module BoltSpec
61
62
  result
62
63
  end
63
64
 
64
- def run_script(targets, script_path, arguments, options = {})
65
+ def run_script(targets, script_path, arguments, options = {}, _position = [])
65
66
  script = module_file_id(script_path)
66
67
  result = nil
67
68
  if (doub = @script_doubles[script] || @script_doubles[:default])
@@ -76,7 +77,7 @@ module BoltSpec
76
77
  result
77
78
  end
78
79
 
79
- def run_task(targets, task, arguments, options = {})
80
+ def run_task(targets, task, arguments, options = {}, _position = [])
80
81
  result = nil
81
82
  if (doub = @task_doubles[task.name] || @task_doubles[:default])
82
83
  result = doub.process(targets, task.name, arguments, options)
@@ -90,7 +91,7 @@ module BoltSpec
90
91
  result
91
92
  end
92
93
 
93
- def download_file(targets, source, destination, options = {})
94
+ def download_file(targets, source, destination, options = {}, _position = [])
94
95
  result = nil
95
96
  if (doub = @download_doubles[source] || @download_doubles[:default])
96
97
  result = doub.process(targets, source, destination, options)
@@ -103,7 +104,7 @@ module BoltSpec
103
104
  result
104
105
  end
105
106
 
106
- def upload_file(targets, source_path, destination, options = {})
107
+ def upload_file(targets, source_path, destination, options = {}, _position = [])
107
108
  source = module_file_id(source_path)
108
109
  result = nil
109
110
  if (doub = @upload_doubles[source] || @upload_doubles[:default])
@@ -133,6 +134,7 @@ module BoltSpec
133
134
  # through to another conditional statement
134
135
  doub = @plan_doubles[plan_name] || @plan_doubles[:default]
135
136
 
137
+ # rubocop:disable Lint/DuplicateBranch
136
138
  # High level:
137
139
  # - If we've explicitly allowed execution of the plan (normally the main plan
138
140
  # passed into BoltSpec::Plan::run_plan()), then execute it
@@ -165,6 +167,7 @@ module BoltSpec
165
167
  @error_message = "Unexpected call to 'run_plan(#{plan_name}, #{params_str})'"
166
168
  raise UnexpectedInvocation, @error_message
167
169
  end
170
+ # rubocop:enable Lint/DuplicateBranch
168
171
  result
169
172
  end
170
173
 
@@ -74,7 +74,7 @@ begin
74
74
  Puppet::ResourceApi::Transport.inject_device(type, transport)
75
75
 
76
76
  Puppet[:facts_terminus] = :network_device
77
- Puppet[:certname] = conn_info['uri']
77
+ Puppet[:certname] = conn_info['name']
78
78
  end
79
79
 
80
80
  # Ensure custom facts are available for provider suitability tests