bolt 3.17.0 → 3.18.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 (101) hide show
  1. checksums.yaml +4 -4
  2. data/Puppetfile +6 -6
  3. data/bolt-modules/boltlib/lib/puppet/functions/run_script.rb +1 -4
  4. data/bolt-modules/boltlib/lib/puppet/functions/upload_file.rb +1 -4
  5. data/bolt-modules/file/lib/puppet/functions/file/exists.rb +1 -4
  6. data/bolt-modules/file/lib/puppet/functions/file/read.rb +1 -4
  7. data/bolt-modules/file/lib/puppet/functions/file/readable.rb +1 -4
  8. data/lib/bolt/analytics.rb +2 -2
  9. data/lib/bolt/application.rb +5 -12
  10. data/lib/bolt/applicator.rb +7 -6
  11. data/lib/bolt/apply_inventory.rb +3 -3
  12. data/lib/bolt/apply_result.rb +2 -2
  13. data/lib/bolt/catalog.rb +10 -11
  14. data/lib/bolt/cli.rb +18 -19
  15. data/lib/bolt/config/modulepath.rb +1 -1
  16. data/lib/bolt/config/options.rb +32 -13
  17. data/lib/bolt/config/transport/base.rb +4 -4
  18. data/lib/bolt/config/transport/docker.rb +2 -2
  19. data/lib/bolt/config/transport/local.rb +2 -2
  20. data/lib/bolt/config/transport/lxd.rb +2 -2
  21. data/lib/bolt/config/transport/orch.rb +2 -2
  22. data/lib/bolt/config/transport/podman.rb +2 -2
  23. data/lib/bolt/config/transport/remote.rb +2 -2
  24. data/lib/bolt/config/transport/ssh.rb +2 -2
  25. data/lib/bolt/config/transport/winrm.rb +2 -2
  26. data/lib/bolt/config.rb +5 -5
  27. data/lib/bolt/container_result.rb +2 -2
  28. data/lib/bolt/error.rb +1 -1
  29. data/lib/bolt/executor.rb +17 -14
  30. data/lib/bolt/fiber_executor.rb +2 -2
  31. data/lib/bolt/inventory/group.rb +4 -4
  32. data/lib/bolt/inventory/inventory.rb +2 -8
  33. data/lib/bolt/inventory/options.rb +1 -1
  34. data/lib/bolt/inventory/target.rb +1 -1
  35. data/lib/bolt/inventory.rb +8 -8
  36. data/lib/bolt/module_installer/installer.rb +2 -2
  37. data/lib/bolt/module_installer/puppetfile/forge_module.rb +1 -1
  38. data/lib/bolt/module_installer/puppetfile/git_module.rb +1 -1
  39. data/lib/bolt/module_installer/puppetfile/module.rb +1 -1
  40. data/lib/bolt/module_installer/puppetfile.rb +3 -3
  41. data/lib/bolt/module_installer/resolver.rb +3 -3
  42. data/lib/bolt/module_installer/specs/forge_spec.rb +1 -1
  43. data/lib/bolt/module_installer/specs/git_spec.rb +1 -1
  44. data/lib/bolt/module_installer/specs.rb +3 -3
  45. data/lib/bolt/module_installer.rb +6 -6
  46. data/lib/bolt/node/errors.rb +1 -1
  47. data/lib/bolt/node/output.rb +1 -1
  48. data/lib/bolt/outputter/human.rb +2 -2
  49. data/lib/bolt/outputter/logger.rb +1 -1
  50. data/lib/bolt/outputter/rainbow.rb +1 -1
  51. data/lib/bolt/outputter.rb +4 -4
  52. data/lib/bolt/pal/logging.rb +1 -1
  53. data/lib/bolt/pal/yaml_plan/evaluator.rb +1 -1
  54. data/lib/bolt/pal/yaml_plan/loader.rb +2 -2
  55. data/lib/bolt/pal/yaml_plan/step.rb +11 -11
  56. data/lib/bolt/pal/yaml_plan/transpiler.rb +3 -3
  57. data/lib/bolt/pal/yaml_plan.rb +2 -2
  58. data/lib/bolt/pal.rb +11 -11
  59. data/lib/bolt/plan_creator.rb +4 -4
  60. data/lib/bolt/plan_result.rb +2 -2
  61. data/lib/bolt/plugin/cache.rb +2 -2
  62. data/lib/bolt/plugin/module.rb +1 -1
  63. data/lib/bolt/plugin.rb +7 -7
  64. data/lib/bolt/project.rb +4 -4
  65. data/lib/bolt/project_manager/config_migrator.rb +1 -1
  66. data/lib/bolt/project_manager/inventory_migrator.rb +1 -1
  67. data/lib/bolt/project_manager/migrator.rb +1 -1
  68. data/lib/bolt/project_manager/module_migrator.rb +5 -5
  69. data/lib/bolt/project_manager.rb +23 -4
  70. data/lib/bolt/puppetdb/config.rb +1 -1
  71. data/lib/bolt/puppetdb.rb +3 -3
  72. data/lib/bolt/result.rb +1 -1
  73. data/lib/bolt/shell/bash.rb +12 -2
  74. data/lib/bolt/shell/powershell.rb +9 -2
  75. data/lib/bolt/shell.rb +2 -2
  76. data/lib/bolt/target.rb +2 -2
  77. data/lib/bolt/transport/base.rb +1 -1
  78. data/lib/bolt/transport/docker/connection.rb +1 -1
  79. data/lib/bolt/transport/docker.rb +2 -2
  80. data/lib/bolt/transport/local/connection.rb +2 -2
  81. data/lib/bolt/transport/local.rb +3 -3
  82. data/lib/bolt/transport/lxd/connection.rb +1 -1
  83. data/lib/bolt/transport/lxd.rb +4 -4
  84. data/lib/bolt/transport/orch.rb +2 -2
  85. data/lib/bolt/transport/podman/connection.rb +1 -1
  86. data/lib/bolt/transport/podman.rb +2 -2
  87. data/lib/bolt/transport/remote.rb +2 -2
  88. data/lib/bolt/transport/simple.rb +3 -3
  89. data/lib/bolt/transport/ssh/connection.rb +3 -3
  90. data/lib/bolt/transport/ssh.rb +5 -5
  91. data/lib/bolt/transport/winrm/connection.rb +2 -2
  92. data/lib/bolt/transport/winrm.rb +3 -3
  93. data/lib/bolt/util.rb +8 -31
  94. data/lib/bolt/validator.rb +1 -1
  95. data/lib/bolt/version.rb +1 -1
  96. data/lib/bolt.rb +1 -1
  97. data/lib/bolt_server/transport_app.rb +16 -2
  98. data/lib/bolt_spec/bolt_context.rb +6 -4
  99. data/lib/bolt_spec/plans/mock_executor.rb +3 -3
  100. data/libexec/bolt_catalog +1 -1
  101. metadata +4 -4
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/inventory/group'
4
- require 'bolt/inventory/target'
3
+ require_relative '../../bolt/inventory/group'
4
+ require_relative '../../bolt/inventory/target'
5
5
 
6
6
  module Bolt
7
7
  class Inventory
@@ -75,12 +75,6 @@ module Bolt
75
75
  end
76
76
  end
77
77
 
78
- # Validates the inventory.
79
- #
80
- def validate
81
- groups.validate
82
- end
83
-
84
78
  def group_names_for(target_name)
85
79
  group_data_for(target_name).fetch('groups', [])
86
80
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/config/options'
3
+ require_relative '../../bolt/config/options'
4
4
 
5
5
  module Bolt
6
6
  class Inventory
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/resource_instance'
3
+ require_relative '../../bolt/resource_instance'
4
4
 
5
5
  module Bolt
6
6
  class Inventory
@@ -1,14 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'set'
4
- require 'bolt/config'
5
- require 'bolt/inventory/group'
6
- require 'bolt/inventory/inventory'
7
- require 'bolt/inventory/options'
8
- require 'bolt/target'
9
- require 'bolt/util'
10
- require 'bolt/plugin'
11
- require 'bolt/validator'
4
+ require_relative '../bolt/config'
5
+ require_relative 'inventory/group'
6
+ require_relative 'inventory/inventory'
7
+ require_relative 'inventory/options'
8
+ require_relative '../bolt/target'
9
+ require_relative '../bolt/util'
10
+ require_relative '../bolt/plugin'
11
+ require_relative '../bolt/validator'
12
12
  require 'yaml'
13
13
 
14
14
  module Bolt
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/r10k_log_proxy'
4
- require 'bolt/error'
3
+ require_relative '../../bolt/r10k_log_proxy'
4
+ require_relative '../../bolt/error'
5
5
 
6
6
  # This class is used to install modules from a Puppetfile to a module directory.
7
7
  #
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'semantic_puppet'
4
- require 'bolt/module_installer/puppetfile/module'
4
+ require_relative '../../../bolt/module_installer/puppetfile/module'
5
5
 
6
6
  # This class represents a resolved Forge module.
7
7
  #
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/module_installer/puppetfile/module'
3
+ require_relative '../../../bolt/module_installer/puppetfile/module'
4
4
 
5
5
  # This class represents a resolved Git module.
6
6
  #
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/error'
3
+ require_relative '../../../bolt/error'
4
4
 
5
5
  module Bolt
6
6
  class ModuleInstaller
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/error'
4
- require 'bolt/module_installer/puppetfile/forge_module'
5
- require 'bolt/module_installer/puppetfile/git_module'
3
+ require_relative '../../bolt/error'
4
+ require_relative 'puppetfile/forge_module'
5
+ require_relative 'puppetfile/git_module'
6
6
 
7
7
  # This class manages the logical contents of a Puppetfile. It includes methods
8
8
  # for parsing and generating a Puppetfile.
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/error'
4
- require 'bolt/module_installer/puppetfile'
5
- require 'bolt/module_installer/specs'
3
+ require_relative '../../bolt/error'
4
+ require_relative '../../bolt/module_installer/puppetfile'
5
+ require_relative '../../bolt/module_installer/specs'
6
6
 
7
7
  module Bolt
8
8
  class ModuleInstaller
@@ -3,7 +3,7 @@
3
3
  require 'semantic_puppet'
4
4
  require 'set'
5
5
 
6
- require 'bolt/error'
6
+ require_relative '../../../bolt/error'
7
7
 
8
8
  # This class represents a Forge module specification.
9
9
  #
@@ -3,7 +3,7 @@
3
3
  require 'json'
4
4
  require 'set'
5
5
 
6
- require 'bolt/error'
6
+ require_relative '../../../bolt/error'
7
7
 
8
8
  # This class represents a Git module specification.
9
9
  #
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/error'
4
- require 'bolt/module_installer/specs/forge_spec'
5
- require 'bolt/module_installer/specs/git_spec'
3
+ require_relative '../../bolt/error'
4
+ require_relative 'specs/forge_spec'
5
+ require_relative 'specs/git_spec'
6
6
 
7
7
  module Bolt
8
8
  class ModuleInstaller
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/error'
4
- require 'bolt/logger'
5
- require 'bolt/module_installer/installer'
6
- require 'bolt/module_installer/puppetfile'
7
- require 'bolt/module_installer/resolver'
8
- require 'bolt/module_installer/specs'
3
+ require_relative '../bolt/error'
4
+ require_relative '../bolt/logger'
5
+ require_relative 'module_installer/installer'
6
+ require_relative 'module_installer/puppetfile'
7
+ require_relative 'module_installer/resolver'
8
+ require_relative 'module_installer/specs'
9
9
 
10
10
  module Bolt
11
11
  class ModuleInstaller
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/error'
3
+ require_relative '../../bolt/error'
4
4
 
5
5
  module Bolt
6
6
  class Node
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'json'
4
- require 'bolt/result'
4
+ require_relative '../../bolt/result'
5
5
 
6
6
  module Bolt
7
7
  class Node
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/container_result'
4
- require 'bolt/pal'
3
+ require_relative '../../bolt/container_result'
4
+ require_relative '../../bolt/pal'
5
5
 
6
6
  module Bolt
7
7
  class Outputter
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/pal'
3
+ require_relative '../../bolt/pal'
4
4
 
5
5
  module Bolt
6
6
  class Outputter
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/pal'
3
+ require_relative '../../bolt/pal'
4
4
 
5
5
  module Bolt
6
6
  class Outputter
@@ -51,7 +51,7 @@ module Bolt
51
51
  end
52
52
  end
53
53
 
54
- require 'bolt/outputter/human'
55
- require 'bolt/outputter/json'
56
- require 'bolt/outputter/logger'
57
- require 'bolt/outputter/rainbow'
54
+ require_relative 'outputter/human'
55
+ require_relative 'outputter/json'
56
+ require_relative 'outputter/logger'
57
+ require_relative 'outputter/rainbow'
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/util/puppet_log_level'
3
+ require_relative '../../bolt/util/puppet_log_level'
4
4
 
5
5
  Puppet::Util::Log.newdesttype :logging do
6
6
  match "Logging::Logger"
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/pal/yaml_plan'
3
+ require_relative '../../../bolt/pal/yaml_plan'
4
4
 
5
5
  module Bolt
6
6
  class PAL
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/pal/yaml_plan'
4
- require 'bolt/pal/yaml_plan/evaluator'
3
+ require_relative '../../../bolt/pal/yaml_plan'
4
+ require_relative '../../../bolt/pal/yaml_plan/evaluator'
5
5
  require 'psych'
6
6
 
7
7
  module Bolt
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/util'
3
+ require_relative '../../../bolt/util'
4
4
 
5
5
  module Bolt
6
6
  class PAL
@@ -211,13 +211,13 @@ module Bolt
211
211
  end
212
212
  end
213
213
 
214
- require 'bolt/pal/yaml_plan/step/command'
215
- require 'bolt/pal/yaml_plan/step/eval'
216
- require 'bolt/pal/yaml_plan/step/plan'
217
- require 'bolt/pal/yaml_plan/step/resources'
218
- require 'bolt/pal/yaml_plan/step/script'
219
- require 'bolt/pal/yaml_plan/step/task'
220
- require 'bolt/pal/yaml_plan/step/upload'
221
- require 'bolt/pal/yaml_plan/step/download'
222
- require 'bolt/pal/yaml_plan/step/message'
223
- require 'bolt/pal/yaml_plan/step/verbose'
214
+ require_relative 'step/command'
215
+ require_relative 'step/eval'
216
+ require_relative 'step/plan'
217
+ require_relative 'step/resources'
218
+ require_relative 'step/script'
219
+ require_relative 'step/task'
220
+ require_relative 'step/upload'
221
+ require_relative 'step/download'
222
+ require_relative 'step/message'
223
+ require_relative 'step/verbose'
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/error'
4
- require 'bolt/pal/yaml_plan/loader'
5
- require 'bolt/util'
3
+ require_relative '../../../bolt/error'
4
+ require_relative '../../../bolt/pal/yaml_plan/loader'
5
+ require_relative '../../../bolt/util'
6
6
 
7
7
  module Bolt
8
8
  class PAL
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/pal/yaml_plan/parameter'
4
- require 'bolt/pal/yaml_plan/step'
3
+ require_relative 'yaml_plan/parameter'
4
+ require_relative 'yaml_plan/step'
5
5
 
6
6
  module Bolt
7
7
  class PAL
data/lib/bolt/pal.rb CHANGED
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/applicator'
4
- require 'bolt/executor'
5
- require 'bolt/error'
6
- require 'bolt/plan_result'
7
- require 'bolt/util'
8
- require 'bolt/config/modulepath'
3
+ require_relative '../bolt/applicator'
4
+ require_relative '../bolt/executor'
5
+ require_relative '../bolt/error'
6
+ require_relative '../bolt/plan_result'
7
+ require_relative '../bolt/util'
8
+ require_relative '../bolt/config/modulepath'
9
9
  require 'etc'
10
10
 
11
11
  module Bolt
@@ -101,10 +101,10 @@ module Bolt
101
101
  raise Bolt::Error.new("Puppet must be installed to execute tasks", "bolt/puppet-missing")
102
102
  end
103
103
 
104
- require 'bolt/pal/logging'
105
- require 'bolt/pal/issues'
106
- require 'bolt/pal/yaml_plan/loader'
107
- require 'bolt/pal/yaml_plan/transpiler'
104
+ require_relative 'pal/logging'
105
+ require_relative 'pal/issues'
106
+ require_relative 'pal/yaml_plan/loader'
107
+ require_relative 'pal/yaml_plan/transpiler'
108
108
 
109
109
  # Now that puppet is loaded we can include puppet mixins in data types
110
110
  Bolt::ResultSet.include_iterable
@@ -736,7 +736,7 @@ module Bolt
736
736
  #
737
737
  # Every future except for the main plan needs to have a plan id in
738
738
  # order to be tracked for the `wait()` function with no arguments.
739
- future = executor.create_future(name: plan_name, plan_id: 1) do |_scope|
739
+ future = executor.create_future(name: plan_name, plan_id: 0) do |_scope|
740
740
  r = compiler.call_function('run_plan', plan_name, params.merge('_bolt_api_call' => true))
741
741
  Bolt::PlanResult.from_pcore(r, 'success')
742
742
  rescue Bolt::Error => e
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/error'
4
- require 'bolt/logger'
5
- require 'bolt/module'
6
- require 'bolt/util'
3
+ require_relative '../bolt/error'
4
+ require_relative '../bolt/logger'
5
+ require_relative '../bolt/module'
6
+ require_relative '../bolt/util'
7
7
 
8
8
  module Bolt
9
9
  module PlanCreator
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'json'
4
- require 'bolt/error'
5
- require 'bolt/util'
4
+ require_relative '../bolt/error'
5
+ require_relative '../bolt/util'
6
6
 
7
7
  module Bolt
8
8
  class PlanResult
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'fileutils'
4
- require 'bolt/error'
5
- require 'bolt/util'
4
+ require_relative '../../bolt/error'
5
+ require_relative '../../bolt/util'
6
6
 
7
7
  module Bolt
8
8
  class Plugin
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/task/run'
3
+ require_relative '../../bolt/task/run'
4
4
 
5
5
  module Bolt
6
6
  class Plugin
data/lib/bolt/plugin.rb CHANGED
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/inventory'
4
- require 'bolt/executor'
5
- require 'bolt/module'
6
- require 'bolt/pal'
7
- require 'bolt/plugin/cache'
8
- require 'bolt/plugin/puppetdb'
3
+ require_relative '../bolt/inventory'
4
+ require_relative '../bolt/executor'
5
+ require_relative '../bolt/module'
6
+ require_relative '../bolt/pal'
7
+ require_relative 'plugin/cache'
8
+ require_relative 'plugin/puppetdb'
9
9
 
10
10
  module Bolt
11
11
  class Plugin
@@ -376,4 +376,4 @@ module Bolt
376
376
  end
377
377
 
378
378
  # references PluginError
379
- require 'bolt/plugin/module'
379
+ require_relative 'plugin/module'
data/lib/bolt/project.rb CHANGED
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'pathname'
4
- require 'bolt/config'
5
- require 'bolt/validator'
6
- require 'bolt/pal'
7
- require 'bolt/module'
4
+ require_relative '../bolt/config'
5
+ require_relative '../bolt/validator'
6
+ require_relative '../bolt/pal'
7
+ require_relative '../bolt/module'
8
8
 
9
9
  module Bolt
10
10
  class Project
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/project_manager/migrator'
3
+ require_relative '../../bolt/project_manager/migrator'
4
4
 
5
5
  module Bolt
6
6
  class ProjectManager
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/project_manager/migrator'
3
+ require_relative '../../bolt/project_manager/migrator'
4
4
 
5
5
  module Bolt
6
6
  class ProjectManager
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'fileutils'
4
- require 'bolt/error'
4
+ require_relative '../../bolt/error'
5
5
 
6
6
  module Bolt
7
7
  class ProjectManager
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/project_manager/migrator'
3
+ require_relative '../../bolt/project_manager/migrator'
4
4
 
5
5
  module Bolt
6
6
  class ProjectManager
@@ -43,10 +43,10 @@ module Bolt
43
43
  # to the new moduledir.
44
44
  #
45
45
  private def migrate_modules_from_puppetfile(config, puppetfile_path, managed_moduledir, modulepath)
46
- require 'bolt/module_installer/installer'
47
- require 'bolt/module_installer/puppetfile'
48
- require 'bolt/module_installer/resolver'
49
- require 'bolt/module_installer/specs'
46
+ require_relative '../../bolt/module_installer/installer'
47
+ require_relative '../../bolt/module_installer/puppetfile'
48
+ require_relative '../../bolt/module_installer/resolver'
49
+ require_relative '../../bolt/module_installer/specs'
50
50
 
51
51
  begin
52
52
  @outputter.print_action_step("Parsing Puppetfile at #{puppetfile_path}")
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/project_manager/config_migrator'
4
- require 'bolt/project_manager/inventory_migrator'
5
- require 'bolt/project_manager/module_migrator'
3
+ require_relative 'project_manager/config_migrator'
4
+ require_relative 'project_manager/inventory_migrator'
5
+ require_relative 'project_manager/module_migrator'
6
6
 
7
7
  module Bolt
8
8
  class ProjectManager
@@ -36,6 +36,16 @@ module Bolt
36
36
  # ssl: false
37
37
  INVENTORY
38
38
 
39
+ GITIGNORE_CONTENT = <<~GITIGNORE
40
+ .modules/
41
+ .resource_types/
42
+ bolt-debug.log
43
+ .plan_cache.json
44
+ .plugin_cache.json
45
+ .task_cache.json
46
+ .rerun.json
47
+ GITIGNORE
48
+
39
49
  def initialize(config, outputter, pal)
40
50
  @config = config
41
51
  @outputter = outputter
@@ -45,7 +55,7 @@ module Bolt
45
55
  # Creates a new project at the specified directory.
46
56
  #
47
57
  def create(path, name, modules)
48
- require 'bolt/module_installer'
58
+ require_relative '../bolt/module_installer'
49
59
 
50
60
  project = Pathname.new(File.expand_path(path))
51
61
  old_config = project + 'bolt.yaml'
@@ -53,6 +63,7 @@ module Bolt
53
63
  puppetfile = project + 'Puppetfile'
54
64
  moduledir = project + '.modules'
55
65
  inventoryfile = project + 'inventory.yaml'
66
+ gitignore = project + '.gitignore'
56
67
  project_name = name || File.basename(project)
57
68
 
58
69
  if config.exist?
@@ -125,6 +136,14 @@ module Bolt
125
136
  end
126
137
  end
127
138
 
139
+ unless gitignore.exist?
140
+ begin
141
+ File.write(gitignore.to_path, GITIGNORE_CONTENT)
142
+ rescue StandardError => e
143
+ raise Bolt::FileError.new("Could not create .gitignore at #{project}: #{e.message}", nil)
144
+ end
145
+ end
146
+
128
147
  @outputter.print_message("Successfully created Bolt project at #{project}")
129
148
 
130
149
  0
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'json'
4
- require 'bolt/util'
4
+ require_relative '../../bolt/util'
5
5
 
6
6
  module Bolt
7
7
  module PuppetDB
data/lib/bolt/puppetdb.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/error'
4
- require 'bolt/puppetdb/client'
5
- require 'bolt/puppetdb/config'
3
+ require_relative '../bolt/error'
4
+ require_relative 'puppetdb/client'
5
+ require_relative 'puppetdb/config'
6
6
 
7
7
  module Bolt
8
8
  class PuppetDBError < Bolt::Error
data/lib/bolt/result.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'json'
4
- require 'bolt/error'
4
+ require_relative '../bolt/error'
5
5
 
6
6
  module Bolt
7
7
  class Result
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bolt/shell/bash/tmpdir'
3
+ require_relative 'bash/tmpdir'
4
4
  require 'shellwords'
5
5
 
6
6
  module Bolt
@@ -94,7 +94,17 @@ module Bolt
94
94
  with_tmpdir do |dir|
95
95
  path = write_executable(dir.to_s, script)
96
96
  dir.chown(run_as)
97
- output = execute([path, *arguments], environment: options[:env_vars], sudoable: true)
97
+
98
+ exec_args = [path, *arguments]
99
+ interpreter = select_interpreter(script, target.options['interpreters'])
100
+
101
+ # Only use interpreter if script_interpreter config is enabled
102
+ if options[:script_interpreter] && interpreter
103
+ exec_args.unshift(interpreter)
104
+ logger.trace("Running '#{script}' using '#{interpreter}' interpreter")
105
+ end
106
+
107
+ output = execute(exec_args, environment: options[:env_vars], sudoable: true)
98
108
  Bolt::Result.for_command(target,
99
109
  output.to_h,
100
110
  'script',