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 +4 -4
- data/bolt-modules/ctrl/lib/puppet/functions/ctrl/do_until.rb +17 -0
- data/bolt-modules/ctrl/lib/puppet/functions/ctrl/sleep.rb +17 -0
- data/bolt-modules/file/lib/puppet/functions/file/read.rb +26 -0
- data/bolt-modules/file/lib/puppet/functions/file/write.rb +19 -0
- data/bolt-modules/system/lib/puppet/functions/system/env.rb +16 -0
- data/lib/bolt/version.rb +1 -1
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65bfdfb39627ab98263d43ab9fd6389eaeca02f809091a85d169da3e56b7cdf4
|
4
|
+
data.tar.gz: 2184a841229576fe544824d8bf1bd687e1c319411651f29beffab00a5bd0e971
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/bolt/version.rb
CHANGED
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.
|
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-
|
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
|