puppet 6.23.0 → 6.24.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puppet might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +5 -5
- data/Gemfile.lock +8 -8
- data/README.md +4 -4
- data/ext/project_data.yaml +1 -0
- data/lib/puppet.rb +3 -3
- data/lib/puppet/application/filebucket.rb +1 -0
- data/lib/puppet/application/resource.rb +15 -2
- data/lib/puppet/application/ssl.rb +1 -0
- data/lib/puppet/environments.rb +10 -0
- data/lib/puppet/face/help/action.erb +1 -0
- data/lib/puppet/face/help/face.erb +1 -0
- data/lib/puppet/face/node/clean.rb +11 -0
- data/lib/puppet/file_system/file_impl.rb +1 -1
- data/lib/puppet/file_system/windows.rb +2 -2
- data/lib/puppet/forge.rb +3 -3
- data/lib/puppet/functions/empty.rb +8 -0
- data/lib/puppet/functions/strftime.rb +1 -0
- data/lib/puppet/functions/unwrap.rb +17 -2
- data/lib/puppet/indirector/resource/ral.rb +6 -1
- data/lib/puppet/interface/documentation.rb +1 -0
- data/lib/puppet/module_tool/applications/installer.rb +4 -0
- data/lib/puppet/module_tool/errors/shared.rb +17 -0
- data/lib/puppet/pops/types/type_mismatch_describer.rb +1 -1
- data/lib/puppet/provider/exec/posix.rb +16 -4
- data/lib/puppet/provider/package/pip.rb +15 -3
- data/lib/puppet/provider/parsedfile.rb +3 -0
- data/lib/puppet/settings.rb +30 -7
- data/lib/puppet/type/exec.rb +16 -3
- data/lib/puppet/type/file/mode.rb +6 -0
- data/lib/puppet/type/tidy.rb +1 -1
- data/lib/puppet/util/symbolic_file_mode.rb +29 -17
- data/lib/puppet/util/windows/sid.rb +3 -1
- data/lib/puppet/version.rb +1 -1
- data/locales/puppet.pot +154 -134
- data/man/man5/puppet.conf.5 +2 -2
- data/man/man8/puppet-agent.8 +1 -1
- data/man/man8/puppet-apply.8 +1 -1
- data/man/man8/puppet-catalog.8 +9 -9
- data/man/man8/puppet-config.8 +1 -1
- data/man/man8/puppet-describe.8 +1 -1
- data/man/man8/puppet-device.8 +1 -1
- data/man/man8/puppet-doc.8 +1 -1
- data/man/man8/puppet-epp.8 +1 -1
- data/man/man8/puppet-facts.8 +8 -8
- data/man/man8/puppet-filebucket.8 +1 -1
- data/man/man8/puppet-generate.8 +1 -1
- data/man/man8/puppet-help.8 +1 -1
- data/man/man8/puppet-key.8 +7 -7
- data/man/man8/puppet-lookup.8 +1 -1
- data/man/man8/puppet-man.8 +1 -1
- data/man/man8/puppet-module.8 +1 -1
- data/man/man8/puppet-node.8 +5 -5
- data/man/man8/puppet-parser.8 +1 -1
- data/man/man8/puppet-plugin.8 +1 -1
- data/man/man8/puppet-report.8 +5 -5
- data/man/man8/puppet-resource.8 +1 -1
- data/man/man8/puppet-script.8 +1 -1
- data/man/man8/puppet-ssl.8 +1 -1
- data/man/man8/puppet-status.8 +4 -4
- data/man/man8/puppet.8 +2 -2
- data/spec/fixtures/ssl/127.0.0.1-key.pem +106 -106
- data/spec/fixtures/ssl/127.0.0.1.pem +48 -48
- data/spec/fixtures/ssl/bad-basic-constraints.pem +54 -54
- data/spec/fixtures/ssl/bad-int-basic-constraints.pem +51 -51
- data/spec/fixtures/ssl/ca.pem +52 -52
- data/spec/fixtures/ssl/crl.pem +25 -25
- data/spec/fixtures/ssl/ec-key.pem +11 -11
- data/spec/fixtures/ssl/ec.pem +32 -32
- data/spec/fixtures/ssl/encrypted-ec-key.pem +12 -12
- data/spec/fixtures/ssl/encrypted-key.pem +107 -107
- data/spec/fixtures/ssl/intermediate-agent-crl.pem +25 -25
- data/spec/fixtures/ssl/intermediate-agent.pem +54 -54
- data/spec/fixtures/ssl/intermediate-crl.pem +28 -28
- data/spec/fixtures/ssl/intermediate.pem +51 -51
- data/spec/fixtures/ssl/oid-key.pem +117 -0
- data/spec/fixtures/ssl/oid.pem +69 -0
- data/spec/fixtures/ssl/pluto-key.pem +106 -106
- data/spec/fixtures/ssl/pluto.pem +50 -50
- data/spec/fixtures/ssl/request-key.pem +106 -106
- data/spec/fixtures/ssl/request.pem +45 -45
- data/spec/fixtures/ssl/revoked-key.pem +106 -106
- data/spec/fixtures/ssl/revoked.pem +49 -49
- data/spec/fixtures/ssl/signed-key.pem +106 -106
- data/spec/fixtures/ssl/signed.pem +47 -47
- data/spec/fixtures/ssl/tampered-cert.pem +49 -49
- data/spec/fixtures/ssl/tampered-csr.pem +45 -45
- data/spec/fixtures/ssl/trusted_oid_mapping.yaml +5 -0
- data/spec/fixtures/ssl/unknown-127.0.0.1-key.pem +106 -106
- data/spec/fixtures/ssl/unknown-127.0.0.1.pem +48 -48
- data/spec/fixtures/ssl/unknown-ca-key.pem +106 -106
- data/spec/fixtures/ssl/unknown-ca.pem +52 -52
- data/spec/integration/application/filebucket_spec.rb +11 -0
- data/spec/integration/application/module_spec.rb +21 -0
- data/spec/integration/application/resource_spec.rb +35 -1
- data/spec/integration/application/ssl_spec.rb +20 -0
- data/spec/integration/environments/settings_interpolation_spec.rb +0 -4
- data/spec/integration/indirector/facts/facter_spec.rb +90 -36
- data/spec/integration/type/exec_spec.rb +70 -45
- data/spec/lib/puppet/test_ca.rb +5 -0
- data/spec/lib/puppet_spec/settings.rb +1 -0
- data/spec/unit/environments_spec.rb +35 -0
- data/spec/unit/file_system_spec.rb +6 -0
- data/spec/unit/functions/assert_type_spec.rb +1 -1
- data/spec/unit/functions/empty_spec.rb +10 -0
- data/spec/unit/functions/unwrap_spec.rb +8 -0
- data/spec/unit/functions4_spec.rb +2 -2
- data/spec/unit/indirector/resource/ral_spec.rb +40 -75
- data/spec/unit/module_tool/applications/installer_spec.rb +12 -0
- data/spec/unit/parser/templatewrapper_spec.rb +12 -2
- data/spec/unit/provider/package/pip_spec.rb +37 -0
- data/spec/unit/provider/parsedfile_spec.rb +10 -0
- data/spec/unit/settings_spec.rb +97 -56
- data/spec/unit/type/exec_spec.rb +76 -29
- data/spec/unit/type/file/source_spec.rb +4 -4
- data/spec/unit/type/tidy_spec.rb +7 -0
- data/spec/unit/util/windows/sid_spec.rb +39 -4
- data/tasks/generate_cert_fixtures.rake +10 -1
- metadata +12 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dd246439ddc29ee0e3d48b487d716b83b48b9d74c6cf88edc81162e4a1f5dd23
|
4
|
+
data.tar.gz: 0304f3352c3055c66435683eab198ed0459176976af2ef842afb63576aab2b3c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 391f42a56716900820e90bb6a226af055d5ab6df2237d0071c0ffe6455baea8c0547d1233f0f6e1533091ecd3f840df026e9008c3faa3785908618fb78c5f5a3
|
7
|
+
data.tar.gz: b9abd58eeeb3d5833fb427b824f77c6dba829db996f2d56dd15e40c9e46b13934a5e955abc54229d0032a45c8d1e56ea0898b8707b9f08d2d1c87647671c25ad
|
data/CONTRIBUTING.md
CHANGED
@@ -38,12 +38,12 @@ the [puppet-dev mailing list](https://groups.google.com/forum/#!forum/puppet-dev
|
|
38
38
|
## Making Changes
|
39
39
|
|
40
40
|
* Create a topic branch from where you want to base your work.
|
41
|
-
* This is usually the
|
41
|
+
* This is usually the main branch.
|
42
42
|
* Only target release branches if you are certain your fix must be on that
|
43
43
|
branch.
|
44
|
-
* To quickly create a topic branch based on
|
45
|
-
fix/
|
46
|
-
`
|
44
|
+
* To quickly create a topic branch based on main, run `git checkout -b
|
45
|
+
fix/main/my_contribution main`. Please avoid working directly on the
|
46
|
+
`main` branch.
|
47
47
|
* Make commits of logical and atomic units.
|
48
48
|
* Check for unnecessary whitespace with `git diff --check` before committing.
|
49
49
|
* Make sure your commit messages are in the proper format. If the commit
|
@@ -65,7 +65,7 @@ the [puppet-dev mailing list](https://groups.google.com/forum/#!forum/puppet-dev
|
|
65
65
|
why this is a problem, and how the patch fixes the problem when applied.
|
66
66
|
```
|
67
67
|
* Make sure you have added the necessary tests for your changes.
|
68
|
-
* For details on how to run tests, please see [the quickstart guide](https://github.com/puppetlabs/puppet/blob/
|
68
|
+
* For details on how to run tests, please see [the quickstart guide](https://github.com/puppetlabs/puppet/blob/main/docs/quickstart.md)
|
69
69
|
|
70
70
|
## Writing Translatable Code
|
71
71
|
|
data/Gemfile.lock
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
GIT
|
2
2
|
remote: git://github.com/puppetlabs/packaging
|
3
|
-
revision:
|
3
|
+
revision: 4d6d51947f44bfa2fc282658836c15f69672e757
|
4
4
|
branch: 1.0.x
|
5
5
|
specs:
|
6
|
-
packaging (0.99.
|
6
|
+
packaging (0.99.78.4.g4d6d519)
|
7
7
|
artifactory (~> 2)
|
8
8
|
csv (= 3.1.5)
|
9
9
|
rake (>= 12.3)
|
@@ -12,7 +12,7 @@ GIT
|
|
12
12
|
PATH
|
13
13
|
remote: .
|
14
14
|
specs:
|
15
|
-
puppet (6.
|
15
|
+
puppet (6.24.0)
|
16
16
|
CFPropertyList (~> 2.2)
|
17
17
|
concurrent-ruby (~> 1.0)
|
18
18
|
deep_merge (~> 1.0)
|
@@ -28,7 +28,7 @@ GEM
|
|
28
28
|
remote: https://artifactory.delivery.puppetlabs.net/artifactory/api/gems/rubygems/
|
29
29
|
specs:
|
30
30
|
CFPropertyList (2.3.6)
|
31
|
-
addressable (2.
|
31
|
+
addressable (2.8.0)
|
32
32
|
public_suffix (>= 2.0.2, < 5.0)
|
33
33
|
artifactory (2.8.2)
|
34
34
|
ast (2.4.2)
|
@@ -40,11 +40,11 @@ GEM
|
|
40
40
|
deep_merge (1.2.1)
|
41
41
|
diff-lcs (1.4.4)
|
42
42
|
docopt (0.6.1)
|
43
|
-
facter (4.2.
|
43
|
+
facter (4.2.2)
|
44
44
|
hocon (~> 1.3)
|
45
45
|
thor (>= 1.0.1, < 2.0)
|
46
46
|
fast_gettext (1.1.2)
|
47
|
-
ffi (1.15.
|
47
|
+
ffi (1.15.3)
|
48
48
|
gettext (3.2.9)
|
49
49
|
locale (>= 2.0.5)
|
50
50
|
text (>= 1.3.0)
|
@@ -81,14 +81,14 @@ GEM
|
|
81
81
|
public_suffix (4.0.6)
|
82
82
|
puppet-resource_api (1.8.14)
|
83
83
|
hocon (>= 1.0)
|
84
|
-
puppetserver-ca (1.
|
84
|
+
puppetserver-ca (1.10.0)
|
85
85
|
facter (>= 2.0.1, < 5)
|
86
86
|
racc (1.4.9)
|
87
87
|
rainbow (2.2.2)
|
88
88
|
rake
|
89
89
|
rake (12.3.3)
|
90
90
|
rdiscount (2.2.0.2)
|
91
|
-
rdoc (6.3.
|
91
|
+
rdoc (6.3.2)
|
92
92
|
release-metrics (1.1.0)
|
93
93
|
csv
|
94
94
|
docopt
|
data/README.md
CHANGED
@@ -33,16 +33,16 @@ see the [Quick Start to Developing on Puppet](docs/quickstart.md) guide.
|
|
33
33
|
|
34
34
|
We'd love to get contributions from you! For a quick guide to getting your
|
35
35
|
system setup for developing, take a look at our [Quickstart
|
36
|
-
Guide](https://github.com/puppetlabs/puppet/blob/
|
37
|
-
[Contribution Documents](https://github.com/puppetlabs/puppet/blob/
|
36
|
+
Guide](https://github.com/puppetlabs/puppet/blob/main/docs/quickstart.md). Once you are up and running, take a look at the
|
37
|
+
[Contribution Documents](https://github.com/puppetlabs/puppet/blob/main/CONTRIBUTING.md) to see how to get your changes merged
|
38
38
|
in.
|
39
39
|
|
40
40
|
For more complete docs on developing with Puppet, take a look at the
|
41
|
-
rest of the [developer documents](https://github.com/puppetlabs/puppet/blob/
|
41
|
+
rest of the [developer documents](https://github.com/puppetlabs/puppet/blob/main/docs/index.md).
|
42
42
|
|
43
43
|
## Licensing
|
44
44
|
|
45
|
-
See [LICENSE](https://github.com/puppetlabs/puppet/blob/
|
45
|
+
See [LICENSE](https://github.com/puppetlabs/puppet/blob/main/LICENSE) file. Puppet is licensed by Puppet, Inc. under the Apache license. Puppet, Inc. can be contacted at: info@puppet.com
|
46
46
|
|
47
47
|
## Support
|
48
48
|
|
data/ext/project_data.yaml
CHANGED
@@ -13,6 +13,7 @@ gem_files: '[A-Z]* install.rb bin lib conf man examples ext tasks spec locales'
|
|
13
13
|
gem_test_files: 'spec/**/*'
|
14
14
|
gem_executables: 'puppet'
|
15
15
|
gem_default_executables: 'puppet'
|
16
|
+
gem_license: 'Apache-2.0'
|
16
17
|
gem_forge_project: 'puppet'
|
17
18
|
gem_required_ruby_version: '>= 2.3.0'
|
18
19
|
gem_required_rubygems_version: '> 1.3.1'
|
data/lib/puppet.rb
CHANGED
@@ -205,9 +205,9 @@ module Puppet
|
|
205
205
|
|
206
206
|
Facter.add(:agent_specified_environment) do
|
207
207
|
setcode do
|
208
|
-
|
209
|
-
Puppet
|
210
|
-
|
208
|
+
Puppet.settings.set_by_cli(:environment) ||
|
209
|
+
Puppet.settings.set_in_section(:environment, :agent) ||
|
210
|
+
Puppet.settings.set_in_section(:environment, :main)
|
211
211
|
end
|
212
212
|
end
|
213
213
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'puppet/application'
|
2
2
|
|
3
3
|
class Puppet::Application::Resource < Puppet::Application
|
4
|
+
environment_mode :not_required
|
4
5
|
|
5
6
|
attr_accessor :host, :extra_params
|
6
7
|
|
@@ -14,8 +15,9 @@ class Puppet::Application::Resource < Puppet::Application
|
|
14
15
|
option("--to_yaml","-y")
|
15
16
|
|
16
17
|
option("--types", "-t") do |arg|
|
18
|
+
env = Puppet.lookup(:environments).get(Puppet[:environment]) || create_default_environment
|
17
19
|
types = []
|
18
|
-
Puppet::Type.loadall
|
20
|
+
Puppet::Type.typeloader.loadall(env)
|
19
21
|
Puppet::Type.eachtype do |t|
|
20
22
|
next if t.name == :component
|
21
23
|
types << t.name.to_s
|
@@ -134,7 +136,9 @@ Copyright (c) 2011 Puppet Inc., LLC Licensed under the Apache 2.0 License
|
|
134
136
|
end
|
135
137
|
|
136
138
|
def main
|
137
|
-
|
139
|
+
# If the specified environment does not exist locally, fall back to the default (production) environment
|
140
|
+
env = Puppet.lookup(:environments).get(Puppet[:environment]) || create_default_environment
|
141
|
+
|
138
142
|
Puppet.override(:current_environment => env, :loaders => Puppet::Pops::Loaders.new(env)) do
|
139
143
|
type, name, params = parse_args(command_line.args)
|
140
144
|
|
@@ -209,6 +213,15 @@ Copyright (c) 2011 Puppet Inc., LLC Licensed under the Apache 2.0 License
|
|
209
213
|
[type, name, params]
|
210
214
|
end
|
211
215
|
|
216
|
+
def create_default_environment
|
217
|
+
Puppet.debug("Specified environment '#{Puppet[:environment]}' does not exist on the filesystem, defaulting to 'production'")
|
218
|
+
Puppet[:environment] = :production
|
219
|
+
basemodulepath = Puppet::Node::Environment.split_path(Puppet[:basemodulepath])
|
220
|
+
modulepath = Puppet[:modulepath]
|
221
|
+
modulepath = (modulepath.nil? || modulepath.empty?) ? basemodulepath : Puppet::Node::Environment.split_path(modulepath)
|
222
|
+
Puppet::Node::Environment.create(Puppet[:environment], modulepath, Puppet::Node::Environment::NO_MANIFEST)
|
223
|
+
end
|
224
|
+
|
212
225
|
def find_or_save_resources(type, name, params)
|
213
226
|
key = local_key(type, name)
|
214
227
|
|
data/lib/puppet/environments.rb
CHANGED
@@ -356,6 +356,16 @@ module Puppet::Environments
|
|
356
356
|
# Evict all that have expired, in the same way as `get`
|
357
357
|
clear_all_expired
|
358
358
|
|
359
|
+
# Evict all that was removed from diks
|
360
|
+
cached_envs = @cache.keys.map!(&:to_sym)
|
361
|
+
loader_envs = @loader.list.map!(&:name)
|
362
|
+
removed_envs = cached_envs - loader_envs
|
363
|
+
|
364
|
+
removed_envs.each do |env_name|
|
365
|
+
Puppet.debug { "Environment no longer exists '#{env_name}'"}
|
366
|
+
clear(env_name)
|
367
|
+
end
|
368
|
+
|
359
369
|
@loader.list.map do |env|
|
360
370
|
name = env.name
|
361
371
|
old_entry = @cache[name]
|
@@ -54,6 +54,7 @@ undocumented option
|
|
54
54
|
end
|
55
55
|
unless action.options.empty?
|
56
56
|
action.options.sort.each do |name|
|
57
|
+
next if name == :extra
|
57
58
|
option = action.get_option name -%>
|
58
59
|
<%= " " + option.optparse.join(" | ")[0,(optionroom - 1)].ljust(optionroom) + ' - ' -%>
|
59
60
|
<% if !(option.summary) -%>
|
@@ -49,6 +49,7 @@ undocumented option
|
|
49
49
|
end
|
50
50
|
unless face.options.empty?
|
51
51
|
face.options.sort.each do |name|
|
52
|
+
next if name == :extra
|
52
53
|
option = face.get_option name -%>
|
53
54
|
<%= " " + option.optparse.join(" | ")[0,(optionroom - 1)].ljust(optionroom) + ' - ' -%>
|
54
55
|
<% if !(option.summary) -%>
|
@@ -47,6 +47,17 @@ Puppet::Face.define(:node, '0.0.1') do
|
|
47
47
|
end
|
48
48
|
|
49
49
|
class LoggerIO
|
50
|
+
def debug(message)
|
51
|
+
Puppet.debug(message)
|
52
|
+
end
|
53
|
+
|
54
|
+
# Notice: For Puppet 6.x, the function below does not matter as it
|
55
|
+
# does not have any functionality. But we decided to keep it here
|
56
|
+
# for the ease of merge up to 7.x and having the same code base.
|
57
|
+
def warn(message)
|
58
|
+
Puppet.warning(message) unless message =~ /cadir is currently configured to be inside/
|
59
|
+
end
|
60
|
+
|
50
61
|
def err(message)
|
51
62
|
Puppet.err(message) unless message =~ /^\s*Error:\s*/
|
52
63
|
end
|
@@ -109,8 +109,8 @@ class Puppet::FileSystem::Windows < Puppet::FileSystem::Posix
|
|
109
109
|
end
|
110
110
|
|
111
111
|
def read_preserve_line_endings(path)
|
112
|
-
contents = path.read( :mode => 'rb', :encoding =>
|
113
|
-
contents = path.read( :mode => 'rb', :encoding => Encoding::default_external) unless contents.valid_encoding?
|
112
|
+
contents = path.read( :mode => 'rb', :encoding => 'bom|utf-8')
|
113
|
+
contents = path.read( :mode => 'rb', :encoding => "bom|#{Encoding::default_external.name}") unless contents.valid_encoding?
|
114
114
|
contents = path.read unless contents.valid_encoding?
|
115
115
|
|
116
116
|
contents
|
data/lib/puppet/forge.rb
CHANGED
@@ -70,7 +70,7 @@ class Puppet::Forge < SemanticPuppet::Dependency::Source
|
|
70
70
|
uri = decode_uri(result['pagination']['next'])
|
71
71
|
matches.concat result['results']
|
72
72
|
else
|
73
|
-
raise ResponseError.new(:uri =>
|
73
|
+
raise ResponseError.new(:uri => response.url, :response => response)
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
@@ -105,7 +105,7 @@ class Puppet::Forge < SemanticPuppet::Dependency::Source
|
|
105
105
|
if response.code == 200
|
106
106
|
response = Puppet::Util::Json.load(response.body)
|
107
107
|
else
|
108
|
-
raise ResponseError.new(:uri =>
|
108
|
+
raise ResponseError.new(:uri => response.url, :response => response)
|
109
109
|
end
|
110
110
|
|
111
111
|
releases.concat(process(response['results']))
|
@@ -208,7 +208,7 @@ class Puppet::Forge < SemanticPuppet::Dependency::Source
|
|
208
208
|
response = @source.make_http_request(uri, destination)
|
209
209
|
destination.flush and destination.close
|
210
210
|
unless response.code == 200
|
211
|
-
raise Puppet::Forge::Errors::ResponseError.new(:uri =>
|
211
|
+
raise Puppet::Forge::Errors::ResponseError.new(:uri => response.url, :response => response)
|
212
212
|
end
|
213
213
|
end
|
214
214
|
|
@@ -26,6 +26,10 @@ Puppet::Functions.create_function(:empty) do
|
|
26
26
|
param 'Collection', :coll
|
27
27
|
end
|
28
28
|
|
29
|
+
dispatch :sensitive_string_empty do
|
30
|
+
param 'Sensitive[String]', :str
|
31
|
+
end
|
32
|
+
|
29
33
|
dispatch :string_empty do
|
30
34
|
param 'String', :str
|
31
35
|
end
|
@@ -46,6 +50,10 @@ Puppet::Functions.create_function(:empty) do
|
|
46
50
|
coll.empty?
|
47
51
|
end
|
48
52
|
|
53
|
+
def sensitive_string_empty(str)
|
54
|
+
str.unwrap.empty?
|
55
|
+
end
|
56
|
+
|
49
57
|
def string_empty(str)
|
50
58
|
str.empty?
|
51
59
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# Unwraps a Sensitive value and returns the wrapped object.
|
2
|
+
# Returns the Value itself, if it is not Sensitive.
|
2
3
|
#
|
3
4
|
# @example Usage of unwrap
|
4
5
|
#
|
@@ -28,12 +29,17 @@
|
|
28
29
|
# @since 4.0.0
|
29
30
|
#
|
30
31
|
Puppet::Functions.create_function(:unwrap) do
|
31
|
-
dispatch :
|
32
|
+
dispatch :from_sensitive do
|
32
33
|
param 'Sensitive', :arg
|
33
34
|
optional_block_param
|
34
35
|
end
|
35
36
|
|
36
|
-
|
37
|
+
dispatch :from_any do
|
38
|
+
param 'Any', :arg
|
39
|
+
optional_block_param
|
40
|
+
end
|
41
|
+
|
42
|
+
def from_sensitive(arg)
|
37
43
|
unwrapped = arg.unwrap
|
38
44
|
if block_given?
|
39
45
|
yield(unwrapped)
|
@@ -41,4 +47,13 @@ Puppet::Functions.create_function(:unwrap) do
|
|
41
47
|
unwrapped
|
42
48
|
end
|
43
49
|
end
|
50
|
+
|
51
|
+
def from_any(arg)
|
52
|
+
unwrapped = arg
|
53
|
+
if block_given?
|
54
|
+
yield(unwrapped)
|
55
|
+
else
|
56
|
+
unwrapped
|
57
|
+
end
|
58
|
+
end
|
44
59
|
end
|
@@ -24,7 +24,12 @@ class Puppet::Resource::Ral < Puppet::Indirector::Code
|
|
24
24
|
type(request).instances.map do |res|
|
25
25
|
res.to_resource
|
26
26
|
end.find_all do |res|
|
27
|
-
conditions.all?
|
27
|
+
conditions.all? do |property, value|
|
28
|
+
# even though `res` is an instance of Puppet::Resource, calling
|
29
|
+
# `res[:name]` on it returns nil, and for some reason it is necessary
|
30
|
+
# to invoke the Puppet::Resource#copy_as_resource copy constructor...
|
31
|
+
res.copy_as_resource[property].to_s == value.to_s
|
32
|
+
end
|
28
33
|
end.sort_by(&:title)
|
29
34
|
end
|
30
35
|
|
@@ -59,6 +59,10 @@ module Puppet::ModuleTool
|
|
59
59
|
results = { :action => :install, :module_name => name, :module_version => version }
|
60
60
|
|
61
61
|
begin
|
62
|
+
if !@local_tarball && name !~ /-/
|
63
|
+
raise InvalidModuleNameError.new(module_name: @name, suggestion: "puppetlabs-#{@name}", action: :install)
|
64
|
+
end
|
65
|
+
|
62
66
|
installed_module = installed_modules[name]
|
63
67
|
if installed_module
|
64
68
|
unless forced?
|
@@ -127,6 +127,23 @@ module Puppet::ModuleTool::Errors
|
|
127
127
|
end
|
128
128
|
end
|
129
129
|
|
130
|
+
class InvalidModuleNameError < ModuleToolError
|
131
|
+
def initialize(options)
|
132
|
+
@module_name = options[:module_name]
|
133
|
+
@suggestion = options[:suggestion]
|
134
|
+
@action = options[:action]
|
135
|
+
super _("Could not %{action} '%{module_name}', did you mean '%{suggestion}'?") % { action: @action, module_name: @module_name, suggestion: @suggestion }
|
136
|
+
end
|
137
|
+
|
138
|
+
def multiline
|
139
|
+
message = []
|
140
|
+
message << _("Could not %{action} module '%{module_name}'") % { action: @action, module_name: @module_name }
|
141
|
+
message << _(" The name '%{module_name}' is invalid") % { module_name: @module_name }
|
142
|
+
message << _(" Did you mean `puppet module %{action} %{suggestion}`?") % { action: @action, suggestion: @suggestion }
|
143
|
+
message.join("\n")
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
130
147
|
class NotInstalledError < ModuleToolError
|
131
148
|
def initialize(options)
|
132
149
|
@module_name = options[:module_name]
|