bolt 3.28.0 → 3.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3486ecf4bb0040b777bc1a583502a8acc274d9372f2d0d0ca2d30dd79e2a4cf2
4
- data.tar.gz: cba32d061afa5a5131ba6fb258ad6e99d1374d5f9ffa5c5bd440e6bdb927a01d
3
+ metadata.gz: 6b5a8936e9789e8d1a722b5cc76cedf594a8f09709352b95ed6e423f0d7ddc6e
4
+ data.tar.gz: ef052d1f831ba328d6949a1f33ec617f933f2f28e862d23264ed1dfd9b43b0a6
5
5
  SHA512:
6
- metadata.gz: 5d6c00d0f3f0d2eef45f0773241f899d733e5c7aab7cefa49f697f8840045487cc25fc0ea327b879a4dfae740cc1dafa94e161e50333703145ef9539dd944e0f
7
- data.tar.gz: a18624b8307013c01e11d3601e5d26e894245ff844f359d799021774c8fa30341bebefe291207922971c4559580ad576d342c56b8f2d3a1516a3b6fb6ccf85e5
6
+ metadata.gz: f1eeec5f42a0f82a751d5eaa834a42e66d26080a0250e680d4c6328e7fb3a2048f13093d65dc6a7d55220963d8178cbaee7744643f17dd82af44d92b3187c3a6
7
+ data.tar.gz: 6cd501114d6efc60a26df945e528b03a610018c287a9e03b722f15da5a37680655df1dc953702922e0c306376adcb9e536b30f6aedb1b24a4efe9e97fc3da504
data/Puppetfile CHANGED
@@ -5,27 +5,27 @@ forge 'https://forge.puppetlabs.com'
5
5
  moduledir File.join(File.dirname(__FILE__), 'modules')
6
6
 
7
7
  # Core modules used by 'apply'
8
- mod 'puppetlabs-service', '2.2.0'
9
- mod 'puppetlabs-puppet_agent', '4.12.1'
8
+ mod 'puppetlabs-service', '3.0.0'
9
+ mod 'puppetlabs-puppet_agent', '4.19.0'
10
10
  mod 'puppetlabs-facts', '1.4.0'
11
11
 
12
12
  # Core types and providers for Puppet 6
13
- mod 'puppetlabs-augeas_core', '1.2.0'
14
- mod 'puppetlabs-host_core', '1.1.0'
15
- mod 'puppetlabs-scheduled_task', '3.1.0'
16
- mod 'puppetlabs-sshkeys_core', '2.3.0'
17
- mod 'puppetlabs-zfs_core', '1.3.0'
18
- mod 'puppetlabs-cron_core', '1.1.0'
19
- mod 'puppetlabs-mount_core', '1.1.0'
20
- mod 'puppetlabs-selinux_core', '1.2.0'
21
- mod 'puppetlabs-yumrepo_core', '1.1.0'
22
- mod 'puppetlabs-zone_core', '1.0.3'
13
+ mod 'puppetlabs-augeas_core', '1.5.0'
14
+ mod 'puppetlabs-host_core', '1.3.0'
15
+ mod 'puppetlabs-scheduled_task', '4.0.0'
16
+ mod 'puppetlabs-sshkeys_core', '2.5.0'
17
+ mod 'puppetlabs-zfs_core', '1.5.0'
18
+ mod 'puppetlabs-cron_core', '1.3.0'
19
+ mod 'puppetlabs-mount_core', '1.3.0'
20
+ mod 'puppetlabs-selinux_core', '1.4.0'
21
+ mod 'puppetlabs-yumrepo_core', '2.1.0'
22
+ mod 'puppetlabs-zone_core', '1.2.0'
23
23
 
24
24
  # Useful additional modules
25
- mod 'puppetlabs-package', '2.2.0'
26
- mod 'puppetlabs-puppet_conf', '1.3.0'
27
- mod 'puppetlabs-reboot', '4.2.0'
28
- mod 'puppetlabs-stdlib', '8.4.0'
25
+ mod 'puppetlabs-package', '3.0.1'
26
+ mod 'puppetlabs-puppet_conf', '2.0.0'
27
+ mod 'puppetlabs-reboot', '5.0.0'
28
+ mod 'puppetlabs-stdlib', '9.6.0'
29
29
 
30
30
  # Task helpers
31
31
  mod 'puppetlabs-powershell_task_helper', '0.1.0'
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Delete a file on localhost using ruby's `File.delete`. This will only delete
4
+ # files on the machine you run Bolt on.
5
+ Puppet::Functions.create_function(:'file::delete') do
6
+ # @param filename Absolute path.
7
+ # @example Delete a file from disk
8
+ # file::delete('C:/Users/me/report')
9
+ dispatch :delete do
10
+ required_param 'String[1]', :filename
11
+ return_type 'Undef'
12
+ end
13
+
14
+ def delete(filename)
15
+ # Send Analytics Report
16
+ Puppet.lookup(:bolt_executor) {}&.report_function_call(self.class.name)
17
+
18
+ File.delete(filename)
19
+ nil
20
+ end
21
+ end
data/lib/bolt/config.rb CHANGED
@@ -169,7 +169,7 @@ module Bolt
169
169
  @config_files = []
170
170
 
171
171
  default_data = {
172
- 'analytics' => true,
172
+ 'analytics' => false,
173
173
  'apply-settings' => {},
174
174
  'color' => true,
175
175
  'compile-concurrency' => Etc.nprocessors,
@@ -98,7 +98,7 @@ module Bolt
98
98
 
99
99
  def add_facts(new_facts = {})
100
100
  validate_fact_names(new_facts)
101
- @facts = Bolt::Util.deep_merge(@facts, new_facts)
101
+ Bolt::Util.deep_merge!(@facts, new_facts)
102
102
  end
103
103
 
104
104
  def features
@@ -60,7 +60,7 @@ module Bolt
60
60
  end
61
61
 
62
62
  def token
63
- return @token if @token
63
+ return @token if @token_computed
64
64
  # Allow nil in config to skip loading a token
65
65
  if @settings.include?('token')
66
66
  if @settings['token']
@@ -69,6 +69,12 @@ module Bolt
69
69
  elsif File.exist?(DEFAULT_TOKEN)
70
70
  @token = File.read(DEFAULT_TOKEN)
71
71
  end
72
+ # Only use cert based auth in the case token and cert are both configured
73
+ if @token && cert
74
+ Bolt::Logger.logger(self).debug("Both cert and token based auth configured, using cert only")
75
+ @token = nil
76
+ end
77
+ @token_computed = true
72
78
  @token = @token.strip if @token
73
79
  end
74
80
 
@@ -55,21 +55,25 @@ module Bolt
55
55
  }
56
56
  #{build_arg_list}
57
57
 
58
- switch -regex ( Get-ExecutionPolicy )
58
+ try
59
59
  {
60
- '^AllSigned'
60
+ switch -regex ( Get-ExecutionPolicy )
61
61
  {
62
- if ((Get-AuthenticodeSignature -File "#{script_path}").Status -ne 'Valid') {
63
- $Host.UI.WriteErrorLine("Error: Target host Powershell ExecutionPolicy is set to ${_} and script '#{script_path}' does not contain a valid signature.")
62
+ '^AllSigned'
63
+ {
64
+ if ((Get-AuthenticodeSignature -File "#{script_path}").Status -ne 'Valid') {
65
+ $Host.UI.WriteErrorLine("Error: Target host Powershell ExecutionPolicy is set to ${_} and script '#{script_path}' does not contain a valid signature.")
66
+ exit 1;
67
+ }
68
+ }
69
+ '^Restricted'
70
+ {
71
+ $Host.UI.WriteErrorLine("Error: Target host Powershell ExecutionPolicy is set to ${_} which denies running any scripts on the target.")
64
72
  exit 1;
65
73
  }
66
74
  }
67
- '^Restricted'
68
- {
69
- $Host.UI.WriteErrorLine("Error: Target host Powershell ExecutionPolicy is set to ${_} which denies running any scripts on the target.")
70
- exit 1;
71
- }
72
75
  }
76
+ catch {}
73
77
 
74
78
  if([string]::IsNullOrEmpty($invokeArgs.ScriptBlock)){
75
79
  $Host.UI.WriteErrorLine("Error: Failed to obtain scriptblock from '#{script_path}'. Running scripts might be disabled on this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170");
data/lib/bolt/util.rb CHANGED
@@ -212,6 +212,17 @@ module Bolt
212
212
  hash1.merge(hash2, &recursive_merge)
213
213
  end
214
214
 
215
+ def deep_merge!(hash1, hash2)
216
+ recursive_merge = proc do |_key, h1, h2|
217
+ if h1.is_a?(Hash) && h2.is_a?(Hash)
218
+ h1.merge!(h2, &recursive_merge)
219
+ else
220
+ h2
221
+ end
222
+ end
223
+ hash1.merge!(hash2, &recursive_merge)
224
+ end
225
+
215
226
  # Accepts a Data object and returns a copy with all hash keys
216
227
  # modified by block. use &:to_s to stringify keys or &:to_sym to symbolize them
217
228
  def walk_keys(data, &block)
data/lib/bolt/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bolt
4
- VERSION = '3.28.0'
4
+ VERSION = '3.29.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bolt
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.28.0
4
+ version: 3.29.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-02-12 00:00:00.000000000 Z
11
+ date: 2024-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -473,6 +473,7 @@ files:
473
473
  - bolt-modules/ctrl/lib/puppet/functions/ctrl/do_until.rb
474
474
  - bolt-modules/ctrl/lib/puppet/functions/ctrl/sleep.rb
475
475
  - bolt-modules/dir/lib/puppet/functions/dir/children.rb
476
+ - bolt-modules/file/lib/puppet/functions/file/delete.rb
476
477
  - bolt-modules/file/lib/puppet/functions/file/exists.rb
477
478
  - bolt-modules/file/lib/puppet/functions/file/join.rb
478
479
  - bolt-modules/file/lib/puppet/functions/file/read.rb