bolt 1.8.0 → 1.8.1

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.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5e9fd995a1caaab8cc183d8e20404f29ac10509586099832df91ddb45829aed5
4
- data.tar.gz: d45036383b14dbc2df9cedccf2bc9a669febab613161e37ef680228dd42fd50e
3
+ metadata.gz: 65bfdfb39627ab98263d43ab9fd6389eaeca02f809091a85d169da3e56b7cdf4
4
+ data.tar.gz: 2184a841229576fe544824d8bf1bd687e1c319411651f29beffab00a5bd0e971
5
5
  SHA512:
6
- metadata.gz: 83bedc800fcfb5f1449ed873a189dc32845efa1311670332bcc8ab746ac83c3c5453c8bf1a6e6640a5abaa403bebbdce5d6ff1c26dce3ab28b2a13e49dd2081c
7
- data.tar.gz: d7ec493dcc3289ae3fa24b6edf3a663677044929fec82e5d7f7498ab0540c3fb475aa83aa17492afe4a1d544291ec357f4132b79bfe5e10a1d783696c057f0d3
6
+ metadata.gz: af1ccedbc0ba492c0b3acc69f0b250c0dc48e32ee63f8ce6e9bfa8ef259e4dd2bdbe659a0d0e3a3f80ea4a731c394cc7c7582833a93ad7f0af07e05e0d1a0535
7
+ data.tar.gz: 65c4688066c5f2af97e22941820cb5c3cc7805a40f103a36d97c43c833f101f93957d3576aa1126046c64be67d06ebf4e2b59f7960f9678ce47985e6c00693dc
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Repeat the block until it returns a truthy value. Returns the value.
4
+ Puppet::Functions.create_function(:'ctrl::do_until') do
5
+ # @example Run a task until it succeeds
6
+ # ctrl::do_until || {
7
+ # run_task('test', $target, _catch_errors => true).ok?
8
+ # }
9
+ dispatch :do_until do
10
+ block_param
11
+ end
12
+
13
+ def do_until
14
+ until (x = yield); end
15
+ x
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Sleeps for specified number of seconds.
4
+ Puppet::Functions.create_function(:'ctrl::sleep') do
5
+ # @param period Time to sleep (in seconds)
6
+ # @example Sleep for 5 seconds
7
+ # ctrl::sleep(5)
8
+ dispatch :sleeper do
9
+ required_param 'Numeric', :period
10
+ return_type 'Undef'
11
+ end
12
+
13
+ def sleeper(period)
14
+ sleep(period)
15
+ nil
16
+ end
17
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Read a file and return its contents.
4
+ Puppet::Functions.create_function(:'file::read', Puppet::Functions::InternalFunction) do
5
+ # @param filename Absolute path or Puppet file path.
6
+ # @example Read a file from disk
7
+ # file::read('/tmp/i_dumped_this_here')
8
+ # @example Read a file from the modulepath
9
+ # file::read('example/files/VERSION')
10
+ dispatch :read do
11
+ scope_param
12
+ required_param 'String', :filename
13
+ return_type 'String'
14
+ end
15
+
16
+ def read(scope, filename)
17
+ found = Puppet::Parser::Files.find_file(filename, scope.compiler.environment)
18
+ unless found && Puppet::FileSystem.exist?(found)
19
+ raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
20
+ Puppet::Pops::Issues::NO_SUCH_FILE_OR_DIRECTORY, file: filename
21
+ )
22
+ end
23
+
24
+ File.read(found)
25
+ end
26
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Write a string to a file.
4
+ Puppet::Functions.create_function(:'file::write') do
5
+ # @param filename Absolute path.
6
+ # @param content File content to write.
7
+ # @example Write a file to disk
8
+ # file::write('C:/Users/me/report', $apply_result.first.report)
9
+ dispatch :write do
10
+ required_param 'String', :filename
11
+ required_param 'String', :content
12
+ return_type 'Undef'
13
+ end
14
+
15
+ def write(filename, content)
16
+ File.write(filename, content)
17
+ nil
18
+ end
19
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Get an environment variable.
4
+ Puppet::Functions.create_function(:'system::env') do
5
+ # @param name Environment variable name.
6
+ # @example Get the USER environment variable
7
+ # system::env('USER')
8
+ dispatch :env do
9
+ required_param 'String', :name
10
+ return_type 'String'
11
+ end
12
+
13
+ def env(name)
14
+ ENV[name].freeze
15
+ end
16
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bolt
4
- VERSION = '1.8.0'
4
+ VERSION = '1.8.1'
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: 1.8.0
4
+ version: 1.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-01-03 00:00:00.000000000 Z
11
+ date: 2019-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -316,6 +316,11 @@ files:
316
316
  - bolt-modules/boltlib/lib/puppet/functions/without_default_logging.rb
317
317
  - bolt-modules/boltlib/types/planresult.pp
318
318
  - bolt-modules/boltlib/types/targetspec.pp
319
+ - bolt-modules/ctrl/lib/puppet/functions/ctrl/do_until.rb
320
+ - bolt-modules/ctrl/lib/puppet/functions/ctrl/sleep.rb
321
+ - bolt-modules/file/lib/puppet/functions/file/read.rb
322
+ - bolt-modules/file/lib/puppet/functions/file/write.rb
323
+ - bolt-modules/system/lib/puppet/functions/system/env.rb
319
324
  - exe/bolt
320
325
  - exe/bolt-inventory-pdb
321
326
  - lib/bolt.rb