bolt 0.20.3 → 0.20.5
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/boltlib/lib/puppet/functions/run_task.rb +3 -3
- data/bolt-modules/boltlib/lib/puppet/functions/set_feature.rb +33 -0
- data/lib/bolt/inventory.rb +19 -1
- data/lib/bolt/target.rb +15 -0
- data/lib/bolt/transport/local.rb +6 -1
- data/lib/bolt/transport/orch.rb +2 -0
- data/lib/bolt/transport/ssh.rb +7 -2
- data/lib/bolt/transport/winrm.rb +6 -1
- data/lib/bolt/version.rb +1 -1
- data/modules/facts/plans/retrieve.pp +2 -26
- data/modules/facts/tasks/init.json +9 -0
- data/vendored/puppet/lib/hiera/puppet_function.rb +1 -1
- data/vendored/puppet/lib/hiera/scope.rb +24 -2
- data/vendored/puppet/lib/puppet.rb +4 -13
- data/vendored/puppet/lib/puppet/application.rb +2 -2
- data/vendored/puppet/lib/puppet/application/agent.rb +1 -1
- data/vendored/puppet/lib/puppet/application/apply.rb +1 -1
- data/vendored/puppet/lib/puppet/application/cert.rb +1 -1
- data/vendored/puppet/lib/puppet/application/device.rb +8 -8
- data/vendored/puppet/lib/puppet/application/face_base.rb +1 -1
- data/vendored/puppet/lib/puppet/application/lookup.rb +2 -2
- data/vendored/puppet/lib/puppet/application/resource.rb +2 -2
- data/vendored/puppet/lib/puppet/application/script.rb +1 -1
- data/vendored/puppet/lib/puppet/configurer.rb +47 -24
- data/vendored/puppet/lib/puppet/confine.rb +4 -1
- data/vendored/puppet/lib/puppet/context.rb +1 -1
- data/vendored/puppet/lib/puppet/defaults.rb +32 -44
- data/vendored/puppet/lib/puppet/error.rb +14 -7
- data/vendored/puppet/lib/puppet/external/dot.rb +23 -17
- data/vendored/puppet/lib/puppet/face/config.rb +58 -3
- data/vendored/puppet/lib/puppet/face/epp.rb +1 -1
- data/vendored/puppet/lib/puppet/face/module/build.rb +3 -3
- data/vendored/puppet/lib/puppet/face/module/install.rb +0 -4
- data/vendored/puppet/lib/puppet/face/module/list.rb +0 -5
- data/vendored/puppet/lib/puppet/face/module/search.rb +1 -1
- data/vendored/puppet/lib/puppet/face/module/uninstall.rb +0 -4
- data/vendored/puppet/lib/puppet/face/module/upgrade.rb +0 -4
- data/vendored/puppet/lib/puppet/face/status.rb +2 -2
- data/vendored/puppet/lib/puppet/file_serving/base.rb +5 -5
- data/vendored/puppet/lib/puppet/file_serving/metadata.rb +2 -1
- data/vendored/puppet/lib/puppet/forge.rb +7 -8
- data/vendored/puppet/lib/puppet/forge/errors.rb +3 -3
- data/vendored/puppet/lib/puppet/functions/abs.rb +61 -0
- data/vendored/puppet/lib/puppet/functions/all.rb +2 -2
- data/vendored/puppet/lib/puppet/functions/any.rb +2 -2
- data/vendored/puppet/lib/puppet/functions/assert_type.rb +3 -3
- data/vendored/puppet/lib/puppet/functions/break.rb +3 -7
- data/vendored/puppet/lib/puppet/functions/camelcase.rb +62 -0
- data/vendored/puppet/lib/puppet/functions/capitalize.rb +61 -0
- data/vendored/puppet/lib/puppet/functions/ceiling.rb +37 -0
- data/vendored/puppet/lib/puppet/functions/chomp.rb +57 -0
- data/vendored/puppet/lib/puppet/functions/chop.rb +67 -0
- data/vendored/puppet/lib/puppet/functions/compare.rb +125 -0
- data/vendored/puppet/lib/puppet/functions/convert_to.rb +3 -2
- data/vendored/puppet/lib/puppet/functions/dig.rb +21 -1
- data/vendored/puppet/lib/puppet/functions/downcase.rb +89 -0
- data/vendored/puppet/lib/puppet/functions/each.rb +2 -2
- data/vendored/puppet/lib/puppet/functions/empty.rb +1 -3
- data/vendored/puppet/lib/puppet/functions/eyaml_lookup_key.rb +4 -2
- data/vendored/puppet/lib/puppet/functions/filter.rb +2 -2
- data/vendored/puppet/lib/puppet/functions/floor.rb +37 -0
- data/vendored/puppet/lib/puppet/functions/get.rb +150 -0
- data/vendored/puppet/lib/puppet/functions/getvar.rb +87 -0
- data/vendored/puppet/lib/puppet/functions/hiera.rb +5 -5
- data/vendored/puppet/lib/puppet/functions/hiera_array.rb +5 -5
- data/vendored/puppet/lib/puppet/functions/hiera_hash.rb +6 -6
- data/vendored/puppet/lib/puppet/functions/hiera_include.rb +7 -7
- data/vendored/puppet/lib/puppet/functions/hocon_data.rb +1 -1
- data/vendored/puppet/lib/puppet/functions/json_data.rb +3 -3
- data/vendored/puppet/lib/puppet/functions/lest.rb +1 -1
- data/vendored/puppet/lib/puppet/functions/lookup.rb +3 -2
- data/vendored/puppet/lib/puppet/functions/lstrip.rb +58 -0
- data/vendored/puppet/lib/puppet/functions/map.rb +1 -1
- data/vendored/puppet/lib/puppet/functions/match.rb +11 -0
- data/vendored/puppet/lib/puppet/functions/max.rb +183 -0
- data/vendored/puppet/lib/puppet/functions/min.rb +182 -0
- data/vendored/puppet/lib/puppet/functions/next.rb +1 -8
- data/vendored/puppet/lib/puppet/functions/reduce.rb +1 -1
- data/vendored/puppet/lib/puppet/functions/return.rb +1 -8
- data/vendored/puppet/lib/puppet/functions/reverse_each.rb +1 -1
- data/vendored/puppet/lib/puppet/functions/round.rb +24 -0
- data/vendored/puppet/lib/puppet/functions/rstrip.rb +58 -0
- data/vendored/puppet/lib/puppet/functions/size.rb +15 -0
- data/vendored/puppet/lib/puppet/functions/sort.rb +74 -0
- data/vendored/puppet/lib/puppet/functions/step.rb +1 -1
- data/vendored/puppet/lib/puppet/functions/strftime.rb +1 -7
- data/vendored/puppet/lib/puppet/functions/strip.rb +58 -0
- data/vendored/puppet/lib/puppet/functions/then.rb +1 -1
- data/vendored/puppet/lib/puppet/functions/tree_each.rb +7 -7
- data/vendored/puppet/lib/puppet/functions/upcase.rb +89 -0
- data/vendored/puppet/lib/puppet/functions/with.rb +4 -4
- data/vendored/puppet/lib/puppet/functions/yaml_data.rb +4 -2
- data/vendored/puppet/lib/puppet/graph/simple_graph.rb +9 -5
- data/vendored/puppet/lib/puppet/indirector/certificate_revocation_list/rest.rb +0 -11
- data/vendored/puppet/lib/puppet/indirector/indirection.rb +8 -12
- data/vendored/puppet/lib/puppet/indirector/node/exec.rb +1 -1
- data/vendored/puppet/lib/puppet/indirector/node/ldap.rb +1 -1
- data/vendored/puppet/lib/puppet/indirector/request.rb +11 -11
- data/vendored/puppet/lib/puppet/indirector/rest.rb +11 -11
- data/vendored/puppet/lib/puppet/interface/action.rb +2 -5
- data/vendored/puppet/lib/puppet/metatype/manager.rb +0 -2
- data/vendored/puppet/lib/puppet/module.rb +7 -33
- data/vendored/puppet/lib/puppet/module/task.rb +0 -1
- data/vendored/puppet/lib/puppet/module_tool.rb +2 -5
- data/vendored/puppet/lib/puppet/module_tool/applications/application.rb +5 -5
- data/vendored/puppet/lib/puppet/module_tool/applications/builder.rb +2 -2
- data/vendored/puppet/lib/puppet/module_tool/applications/checksummer.rb +3 -3
- data/vendored/puppet/lib/puppet/module_tool/applications/installer.rb +6 -7
- data/vendored/puppet/lib/puppet/module_tool/applications/uninstaller.rb +1 -2
- data/vendored/puppet/lib/puppet/module_tool/applications/unpacker.rb +2 -2
- data/vendored/puppet/lib/puppet/module_tool/applications/upgrader.rb +5 -6
- data/vendored/puppet/lib/puppet/module_tool/dependency.rb +1 -1
- data/vendored/puppet/lib/puppet/module_tool/installed_modules.rb +2 -2
- data/vendored/puppet/lib/puppet/module_tool/local_tarball.rb +3 -3
- data/vendored/puppet/lib/puppet/module_tool/metadata.rb +3 -4
- data/vendored/puppet/lib/puppet/module_tool/shared_behaviors.rb +2 -2
- data/vendored/puppet/lib/puppet/network/authconfig.rb +0 -13
- data/vendored/puppet/lib/puppet/network/format_support.rb +1 -1
- data/vendored/puppet/lib/puppet/network/formats.rb +5 -7
- data/vendored/puppet/lib/puppet/network/http.rb +0 -2
- data/vendored/puppet/lib/puppet/network/http/api.rb +1 -10
- data/vendored/puppet/lib/puppet/network/http/api/master/v3/environment.rb +2 -2
- data/vendored/puppet/lib/puppet/network/http/api/master/v3/environments.rb +2 -2
- data/vendored/puppet/lib/puppet/network/http/compression.rb +1 -1
- data/vendored/puppet/lib/puppet/network/http/connection.rb +11 -3
- data/vendored/puppet/lib/puppet/network/http/error.rb +3 -3
- data/vendored/puppet/lib/puppet/network/http/factory.rb +3 -0
- data/vendored/puppet/lib/puppet/network/http/handler.rb +59 -27
- data/vendored/puppet/lib/puppet/network/resolver.rb +140 -67
- data/vendored/puppet/lib/puppet/node/environment.rb +2 -19
- data/vendored/puppet/lib/puppet/parameter.rb +12 -7
- data/vendored/puppet/lib/puppet/parser/ast.rb +4 -8
- data/vendored/puppet/lib/puppet/parser/ast/branch.rb +3 -3
- data/vendored/puppet/lib/puppet/parser/ast/leaf.rb +5 -0
- data/vendored/puppet/lib/puppet/parser/ast/pops_bridge.rb +18 -0
- data/vendored/puppet/lib/puppet/parser/compiler.rb +3 -4
- data/vendored/puppet/lib/puppet/parser/compiler/catalog_validator/relationship_validator.rb +9 -2
- data/vendored/puppet/lib/puppet/parser/functions.rb +1 -1
- data/vendored/puppet/lib/puppet/parser/functions/assert_type.rb +3 -3
- data/vendored/puppet/lib/puppet/parser/functions/create_resources.rb +1 -7
- data/vendored/puppet/lib/puppet/parser/functions/each.rb +2 -2
- data/vendored/puppet/lib/puppet/parser/functions/filter.rb +1 -1
- data/vendored/puppet/lib/puppet/parser/functions/hiera.rb +4 -4
- data/vendored/puppet/lib/puppet/parser/functions/hiera_array.rb +5 -5
- data/vendored/puppet/lib/puppet/parser/functions/hiera_hash.rb +6 -6
- data/vendored/puppet/lib/puppet/parser/functions/hiera_include.rb +10 -11
- data/vendored/puppet/lib/puppet/parser/functions/inline_template.rb +1 -1
- data/vendored/puppet/lib/puppet/parser/functions/lest.rb +1 -1
- data/vendored/puppet/lib/puppet/parser/functions/lookup.rb +1 -1
- data/vendored/puppet/lib/puppet/parser/functions/map.rb +1 -1
- data/vendored/puppet/lib/puppet/parser/functions/reduce.rb +1 -1
- data/vendored/puppet/lib/puppet/parser/functions/return.rb +22 -1
- data/vendored/puppet/lib/puppet/parser/functions/reverse_each.rb +1 -1
- data/vendored/puppet/lib/puppet/parser/functions/step.rb +1 -1
- data/vendored/puppet/lib/puppet/parser/functions/then.rb +1 -1
- data/vendored/puppet/lib/puppet/parser/functions/with.rb +4 -4
- data/vendored/puppet/lib/puppet/parser/resource.rb +0 -1
- data/vendored/puppet/lib/puppet/parser/resource/param.rb +12 -5
- data/vendored/puppet/lib/puppet/parser/scope.rb +5 -7
- data/vendored/puppet/lib/puppet/pops/evaluator/compare_operator.rb +3 -1
- data/vendored/puppet/lib/puppet/pops/evaluator/runtime3_support.rb +2 -7
- data/vendored/puppet/lib/puppet/pops/issues.rb +4 -0
- data/vendored/puppet/lib/puppet/pops/loader/loader_paths.rb +2 -2
- data/vendored/puppet/lib/puppet/pops/loader/module_loaders.rb +17 -12
- data/vendored/puppet/lib/puppet/pops/loader/task_instantiator.rb +73 -45
- data/vendored/puppet/lib/puppet/pops/lookup/lookup_adapter.rb +55 -6
- data/vendored/puppet/lib/puppet/pops/model/model_label_provider.rb +2 -0
- data/vendored/puppet/lib/puppet/pops/parser/epp_parser.rb +1 -1
- data/vendored/puppet/lib/puppet/pops/parser/epp_support.rb +6 -2
- data/vendored/puppet/lib/puppet/pops/parser/lexer2.rb +1 -1
- data/vendored/puppet/lib/puppet/pops/pcore.rb +7 -7
- data/vendored/puppet/lib/puppet/pops/puppet_stack.rb +15 -1
- data/vendored/puppet/lib/puppet/pops/serialization.rb +2 -2
- data/vendored/puppet/lib/puppet/pops/serialization/from_data_converter.rb +2 -2
- data/vendored/puppet/lib/puppet/pops/serialization/json.rb +7 -7
- data/vendored/puppet/lib/puppet/pops/serialization/to_data_converter.rb +5 -5
- data/vendored/puppet/lib/puppet/pops/types/types.rb +8 -4
- data/vendored/puppet/lib/puppet/pops/validation/checker4_0.rb +73 -0
- data/vendored/puppet/lib/puppet/pops/validation/validator_factory_4_0.rb +4 -3
- data/vendored/puppet/lib/puppet/provider/augeas/augeas.rb +7 -0
- data/vendored/puppet/lib/puppet/provider/service/systemd.rb +1 -1
- data/vendored/puppet/lib/puppet/provider/user/aix.rb +2 -2
- data/vendored/puppet/lib/puppet/provider/yumrepo/inifile.rb +21 -9
- data/vendored/puppet/lib/puppet/reference/providers.rb +1 -1
- data/vendored/puppet/lib/puppet/reference/report.rb +1 -1
- data/vendored/puppet/lib/puppet/resource.rb +1 -1
- data/vendored/puppet/lib/puppet/resource/capability_finder.rb +4 -4
- data/vendored/puppet/lib/puppet/resource/catalog.rb +6 -3
- data/vendored/puppet/lib/puppet/resource/type.rb +6 -2
- data/vendored/puppet/lib/puppet/rest/client.rb +79 -0
- data/vendored/puppet/lib/puppet/rest/errors.rb +14 -0
- data/vendored/puppet/lib/puppet/rest/response.rb +29 -0
- data/vendored/puppet/lib/puppet/rest/route.rb +102 -0
- data/vendored/puppet/lib/puppet/rest/routes.rb +31 -0
- data/vendored/puppet/lib/puppet/settings.rb +9 -5
- data/vendored/puppet/lib/puppet/settings/config_file.rb +1 -1
- data/vendored/puppet/lib/puppet/settings/environment_conf.rb +10 -1
- data/vendored/puppet/lib/puppet/ssl.rb +0 -1
- data/vendored/puppet/lib/puppet/ssl/certificate.rb +6 -2
- data/vendored/puppet/lib/puppet/ssl/certificate_authority.rb +3 -3
- data/vendored/puppet/lib/puppet/ssl/host.rb +258 -19
- data/vendored/puppet/lib/puppet/ssl/validator/default_validator.rb +33 -19
- data/vendored/puppet/lib/puppet/syntax_checkers/json.rb +1 -1
- data/vendored/puppet/lib/puppet/transaction/event.rb +34 -7
- data/vendored/puppet/lib/puppet/transaction/report.rb +17 -14
- data/vendored/puppet/lib/puppet/type.rb +20 -12
- data/vendored/puppet/lib/puppet/type/file.rb +1 -1
- data/vendored/puppet/lib/puppet/type/file/content.rb +15 -2
- data/vendored/puppet/lib/puppet/type/file/ensure.rb +1 -1
- data/vendored/puppet/lib/puppet/type/schedule.rb +1 -1
- data/vendored/puppet/lib/puppet/type/stage.rb +1 -1
- data/vendored/puppet/lib/puppet/type/tidy.rb +5 -1
- data/vendored/puppet/lib/puppet/type/user.rb +35 -18
- data/vendored/puppet/lib/puppet/type/yumrepo.rb +8 -17
- data/vendored/puppet/lib/puppet/util.rb +0 -1
- data/vendored/puppet/lib/puppet/util/autoload.rb +1 -6
- data/vendored/puppet/lib/puppet/util/checksums.rb +0 -2
- data/vendored/puppet/lib/puppet/util/classgen.rb +0 -6
- data/vendored/puppet/lib/puppet/util/fileparsing.rb +27 -5
- data/vendored/puppet/lib/puppet/util/instance_loader.rb +3 -3
- data/vendored/puppet/lib/puppet/util/json.rb +77 -0
- data/vendored/puppet/lib/puppet/util/json_lockfile.rb +3 -3
- data/vendored/puppet/lib/puppet/util/ldap/connection.rb +7 -7
- data/vendored/puppet/lib/puppet/util/log/destinations.rb +2 -2
- data/vendored/puppet/lib/puppet/util/logging.rb +1 -1
- data/vendored/puppet/lib/puppet/util/plist.rb +1 -1
- data/vendored/puppet/lib/puppet/util/provider_features.rb +2 -5
- data/vendored/puppet/lib/puppet/util/reference.rb +5 -4
- data/vendored/puppet/lib/puppet/util/tagging.rb +16 -3
- data/vendored/puppet/lib/puppet/version.rb +1 -1
- metadata +44 -26
- data/vendored/puppet/lib/puppet/application/master.rb +0 -317
- data/vendored/puppet/lib/puppet/feature/rack.rb +0 -19
- data/vendored/puppet/lib/puppet/network/http/api/ca.rb +0 -2
- data/vendored/puppet/lib/puppet/network/http/api/ca/v1.rb +0 -11
- data/vendored/puppet/lib/puppet/network/http/rack.rb +0 -33
- data/vendored/puppet/lib/puppet/network/http/rack/rest.rb +0 -162
- data/vendored/puppet/lib/puppet/network/http/webrick.rb +0 -124
- data/vendored/puppet/lib/puppet/network/http/webrick/rest.rb +0 -114
- data/vendored/puppet/lib/puppet/network/server.rb +0 -39
- data/vendored/puppet/lib/puppet/ssl/configuration.rb +0 -61
- data/vendored/puppet/lib/puppet/util/methodhelper.rb +0 -32
- data/vendored/puppet/lib/puppet/vendor/load_semantic.rb +0 -1
- data/vendored/puppet/lib/puppet/vendor/load_semantic_puppet.rb +0 -1
- data/vendored/puppet/lib/puppet/vendor/semantic/lib/semantic.rb +0 -5
- data/vendored/puppet/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet.rb +0 -11
- data/vendored/puppet/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/dependency.rb +0 -181
- data/vendored/puppet/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/dependency/graph.rb +0 -60
- data/vendored/puppet/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/dependency/graph_node.rb +0 -117
- data/vendored/puppet/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/dependency/module_release.rb +0 -58
- data/vendored/puppet/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/dependency/source.rb +0 -25
- data/vendored/puppet/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/dependency/unsatisfiable_graph.rb +0 -31
- data/vendored/puppet/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/gem_version.rb +0 -3
- data/vendored/puppet/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/version.rb +0 -203
- data/vendored/puppet/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/version_range.rb +0 -758
@@ -39,7 +39,7 @@ Puppet::Type.newtype(:yumrepo) do
|
|
39
39
|
end
|
40
40
|
|
41
41
|
newparam(:target) do
|
42
|
-
desc "The
|
42
|
+
desc "The target parameter will be enabled in a future release and should not be used."
|
43
43
|
|
44
44
|
defaultto :absent
|
45
45
|
end
|
@@ -261,17 +261,12 @@ Puppet::Type.newtype(:yumrepo) do
|
|
261
261
|
end
|
262
262
|
|
263
263
|
newproperty(:priority) do
|
264
|
-
desc "Priority of this repository
|
265
|
-
the `priorities` plugin
|
264
|
+
desc "Priority of this repository. Can be any integer value
|
265
|
+
(including negative). Requires that the `priorities` plugin
|
266
|
+
is installed and enabled.
|
266
267
|
#{ABSENT_DOC}"
|
267
268
|
|
268
|
-
newvalues(
|
269
|
-
validate do |value|
|
270
|
-
next if value.to_s == 'absent'
|
271
|
-
unless (1..99).include?(value.to_i)
|
272
|
-
fail(_("Must be within range 1-99"))
|
273
|
-
end
|
274
|
-
end
|
269
|
+
newvalues(/^-?\d+$/, :absent)
|
275
270
|
end
|
276
271
|
|
277
272
|
newproperty(:throttle) do
|
@@ -326,6 +321,8 @@ Puppet::Type.newtype(:yumrepo) do
|
|
326
321
|
desc "Password for this proxy. #{ABSENT_DOC}"
|
327
322
|
|
328
323
|
newvalues(/.*/, :absent)
|
324
|
+
|
325
|
+
sensitive true
|
329
326
|
end
|
330
327
|
|
331
328
|
newproperty(:s3_enabled) do
|
@@ -428,12 +425,6 @@ Puppet::Type.newtype(:yumrepo) do
|
|
428
425
|
desc "Password to use with the username for basic authentication.
|
429
426
|
#{ABSENT_DOC}"
|
430
427
|
newvalues(/.*/, :absent)
|
431
|
-
|
432
|
-
|
433
|
-
private
|
434
|
-
|
435
|
-
def set_sensitive_parameters(sensitive_parameters)
|
436
|
-
parameter(:password).sensitive = true if parameter(:password)
|
437
|
-
super(sensitive_parameters)
|
428
|
+
sensitive true
|
438
429
|
end
|
439
430
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'pathname'
|
2
2
|
require 'puppet/util/rubygems'
|
3
3
|
require 'puppet/util/warnings'
|
4
|
-
require 'puppet/util/methodhelper'
|
5
4
|
require 'puppet/pops/adaptable'
|
6
5
|
|
7
6
|
# An adapter that ties the module_directories cache to the environment where the modules are parsed. This
|
@@ -14,8 +13,6 @@ end
|
|
14
13
|
|
15
14
|
# Autoload paths, either based on names or all at once.
|
16
15
|
class Puppet::Util::Autoload
|
17
|
-
include Puppet::Util::MethodHelper
|
18
|
-
|
19
16
|
@loaded = {}
|
20
17
|
|
21
18
|
class << self
|
@@ -182,12 +179,10 @@ class Puppet::Util::Autoload
|
|
182
179
|
|
183
180
|
attr_accessor :object, :path
|
184
181
|
|
185
|
-
def initialize(obj, path
|
182
|
+
def initialize(obj, path)
|
186
183
|
@path = path.to_s
|
187
184
|
raise ArgumentError, _("Autoload paths cannot be fully qualified") if Puppet::Util.absolute_path?(@path)
|
188
185
|
@object = obj
|
189
|
-
|
190
|
-
set_options(options)
|
191
186
|
end
|
192
187
|
|
193
188
|
def load(name, env = nil)
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'puppet/util/methodhelper'
|
2
|
-
|
3
1
|
module Puppet
|
4
2
|
class ConstantAlreadyDefined < Error; end
|
5
3
|
class SubclassAlreadyDefined < Error; end
|
@@ -9,7 +7,6 @@ end
|
|
9
7
|
# @api public
|
10
8
|
#
|
11
9
|
module Puppet::Util::ClassGen
|
12
|
-
include Puppet::Util::MethodHelper
|
13
10
|
include Puppet::Util
|
14
11
|
|
15
12
|
# Create a new class.
|
@@ -66,7 +63,6 @@ module Puppet::Util::ClassGen
|
|
66
63
|
# @return [Boolean] whether the class was removed or not
|
67
64
|
#
|
68
65
|
def rmclass(name, options)
|
69
|
-
options = symbolize_options(options)
|
70
66
|
const = genconst_string(name, options)
|
71
67
|
retval = false
|
72
68
|
if is_constant_defined?(const)
|
@@ -100,8 +96,6 @@ module Puppet::Util::ClassGen
|
|
100
96
|
# slightly abstract version of genclass.
|
101
97
|
# @api private
|
102
98
|
def genthing(name, type, options, block)
|
103
|
-
options = symbolize_options(options)
|
104
|
-
|
105
99
|
name = name.to_s.downcase.intern
|
106
100
|
|
107
101
|
if type == Module
|
@@ -24,15 +24,12 @@
|
|
24
24
|
# You could then call 'parser.to_line(hash)' on any of those hashes to generate
|
25
25
|
# the text line again.
|
26
26
|
|
27
|
-
require 'puppet/util/methodhelper'
|
28
|
-
|
29
27
|
module Puppet::Util::FileParsing
|
30
28
|
include Puppet::Util
|
31
29
|
attr_writer :line_separator, :trailing_separator
|
32
30
|
|
33
31
|
class FileRecord
|
34
32
|
include Puppet::Util
|
35
|
-
include Puppet::Util::MethodHelper
|
36
33
|
attr_accessor :absent, :joiner, :rts, :separator, :rollup, :name, :match, :block_eval
|
37
34
|
|
38
35
|
attr_reader :fields, :optional, :type
|
@@ -48,11 +45,36 @@ module Puppet::Util::FileParsing
|
|
48
45
|
end
|
49
46
|
end
|
50
47
|
|
51
|
-
def initialize(type,
|
48
|
+
def initialize(type,
|
49
|
+
absent: nil,
|
50
|
+
block_eval: nil,
|
51
|
+
fields: nil,
|
52
|
+
joiner: nil,
|
53
|
+
match: nil,
|
54
|
+
optional: nil,
|
55
|
+
post_parse: nil,
|
56
|
+
pre_gen: nil,
|
57
|
+
rollup: nil,
|
58
|
+
rts: nil,
|
59
|
+
separator: nil,
|
60
|
+
to_line: nil,
|
61
|
+
&block)
|
52
62
|
@type = type.intern
|
53
63
|
raise ArgumentError, _("Invalid record type %{record_type}") % { record_type: @type } unless [:record, :text].include?(@type)
|
54
64
|
|
55
|
-
|
65
|
+
@absent = absent
|
66
|
+
@block_eval = block_eval
|
67
|
+
@joiner = joiner
|
68
|
+
@match = match
|
69
|
+
@rollup = rollup if rollup
|
70
|
+
@rts = rts
|
71
|
+
@separator = separator
|
72
|
+
|
73
|
+
self.fields = fields if fields
|
74
|
+
self.optional = optional if optional
|
75
|
+
self.post_parse = post_parse if post_parse
|
76
|
+
self.pre_gen = pre_gen if pre_gen
|
77
|
+
self.to_line = to_line if to_line
|
56
78
|
|
57
79
|
if self.type == :record
|
58
80
|
# Now set defaults.
|
@@ -12,12 +12,12 @@ module Puppet::Util::InstanceLoader
|
|
12
12
|
end
|
13
13
|
|
14
14
|
# Define a new type of autoloading.
|
15
|
-
def instance_load(type, path
|
15
|
+
def instance_load(type, path)
|
16
16
|
@autoloaders ||= {}
|
17
17
|
@instances ||= {}
|
18
18
|
type = type.intern
|
19
19
|
@instances[type] = {}
|
20
|
-
@autoloaders[type] = Puppet::Util::Autoload.new(self, path
|
20
|
+
@autoloaders[type] = Puppet::Util::Autoload.new(self, path)
|
21
21
|
|
22
22
|
# Now define our new simple methods
|
23
23
|
unless respond_to?(type)
|
@@ -41,7 +41,7 @@ module Puppet::Util::InstanceLoader
|
|
41
41
|
|
42
42
|
# Use this method so they all get loaded
|
43
43
|
loaded_instances(type).sort { |a,b| a.to_s <=> b.to_s }.each do |name|
|
44
|
-
mod = self.loaded_instance(name)
|
44
|
+
mod = self.loaded_instance(type, name)
|
45
45
|
docs << "#{name}\n#{"-" * name.to_s.length}\n"
|
46
46
|
|
47
47
|
docs << Puppet::Util::Docs.scrub(mod.doc) << "\n\n"
|
@@ -0,0 +1,77 @@
|
|
1
|
+
module Puppet::Util
|
2
|
+
module Json
|
3
|
+
class ParseError < StandardError
|
4
|
+
attr_reader :cause, :data
|
5
|
+
|
6
|
+
def self.build(original_exception, data)
|
7
|
+
new(original_exception.message).tap do |exception|
|
8
|
+
exception.instance_eval do
|
9
|
+
@cause = original_exception
|
10
|
+
set_backtrace original_exception.backtrace
|
11
|
+
@data = data
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
begin
|
18
|
+
require 'multi_json'
|
19
|
+
# Force backend detection before attempting to use the library
|
20
|
+
# or load any other JSON libraries
|
21
|
+
MultiJson.default_adapter
|
22
|
+
|
23
|
+
# Preserve core type monkey-patching done by the built-in JSON gem
|
24
|
+
require 'json'
|
25
|
+
rescue LoadError
|
26
|
+
require 'json'
|
27
|
+
end
|
28
|
+
|
29
|
+
# These methods do similar processing to the fallback implemented by MultiJson
|
30
|
+
# when using the built-in JSON backend, to ensure consistent behavior
|
31
|
+
# whether or not MultiJson can be loaded.
|
32
|
+
def self.load(string, options = {})
|
33
|
+
if defined? MultiJson
|
34
|
+
begin
|
35
|
+
# This ensures that JrJackson will parse very large or very small
|
36
|
+
# numbers as floats rather than BigDecimals, which are serialized as
|
37
|
+
# strings by the built-in JSON gem and therefore can cause schema errors,
|
38
|
+
# for example, when we are rendering reports to JSON using `to_pson` in
|
39
|
+
# PuppetDB.
|
40
|
+
if MultiJson.adapter.name == "MultiJson::Adapters::JrJackson"
|
41
|
+
options[:use_bigdecimal] = false
|
42
|
+
end
|
43
|
+
|
44
|
+
MultiJson.load(string, options)
|
45
|
+
rescue MultiJson::ParseError => e
|
46
|
+
raise Puppet::Util::Json::ParseError.build(e, string)
|
47
|
+
end
|
48
|
+
else
|
49
|
+
begin
|
50
|
+
string = string.read if string.respond_to?(:read)
|
51
|
+
|
52
|
+
options[:symbolize_names] = true if options.delete(:symbolize_keys)
|
53
|
+
::JSON.parse(string, options)
|
54
|
+
rescue JSON::ParserError => e
|
55
|
+
raise Puppet::Util::Json::ParseError.build(e, string)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def self.dump(object, options = {})
|
61
|
+
if defined? MultiJson
|
62
|
+
# MultiJson calls `merge` on the options it is passed, which relies
|
63
|
+
# on the options' defining a `to_hash` method. In Ruby 1.9.3,
|
64
|
+
# JSON::Ext::Generator::State only defines `to_h`, not `to_hash`, so we
|
65
|
+
# need to convert it first, similar to what is done in the `else` block
|
66
|
+
# below. Later versions of the JSON gem alias `to_h` to `to_hash`, so this
|
67
|
+
# can be removed once we drop Ruby 1.9.3 support.
|
68
|
+
options = options.to_h if options.class.name == "JSON::Ext::Generator::State"
|
69
|
+
|
70
|
+
MultiJson.dump(object, options)
|
71
|
+
else
|
72
|
+
options.merge!(::JSON::PRETTY_STATE_PROTOTYPE.to_h) if options.delete(:pretty)
|
73
|
+
object.to_json(options)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -23,7 +23,7 @@ class Puppet::Util::JsonLockfile < Puppet::Util::Lockfile
|
|
23
23
|
def lock(lock_data = nil)
|
24
24
|
return false if locked?
|
25
25
|
|
26
|
-
super(lock_data
|
26
|
+
super(Puppet::Util::Json.dump(lock_data))
|
27
27
|
end
|
28
28
|
|
29
29
|
# Retrieve the (optional) lock data that was specified at the time the file
|
@@ -35,8 +35,8 @@ class Puppet::Util::JsonLockfile < Puppet::Util::Lockfile
|
|
35
35
|
return nil unless file_locked?
|
36
36
|
file_contents = super
|
37
37
|
return nil if file_contents.nil? or file_contents.empty?
|
38
|
-
|
39
|
-
rescue
|
38
|
+
Puppet::Util::Json.load(file_contents)
|
39
|
+
rescue Puppet::Util::Json::ParseError
|
40
40
|
Puppet.warning _("Unable to read lockfile data from %{path}: not in JSON") % { path: @file_path }
|
41
41
|
nil
|
42
42
|
end
|
@@ -1,9 +1,6 @@
|
|
1
1
|
require 'puppet/util/ldap'
|
2
|
-
require 'puppet/util/methodhelper'
|
3
2
|
|
4
3
|
class Puppet::Util::Ldap::Connection
|
5
|
-
include Puppet::Util::MethodHelper
|
6
|
-
|
7
4
|
attr_accessor :host, :port, :user, :password, :reset, :ssl
|
8
5
|
|
9
6
|
attr_reader :connection
|
@@ -34,12 +31,15 @@ class Puppet::Util::Ldap::Connection
|
|
34
31
|
connection.unbind if connection.bound?
|
35
32
|
end
|
36
33
|
|
37
|
-
def initialize(host, port,
|
34
|
+
def initialize(host, port, user: nil, password: nil, reset: nil, ssl: nil)
|
38
35
|
raise Puppet::Error, _("Could not set up LDAP Connection: Missing ruby/ldap libraries") unless Puppet.features.ldap?
|
39
36
|
|
40
|
-
@host
|
41
|
-
|
42
|
-
|
37
|
+
@host = host
|
38
|
+
@port = port
|
39
|
+
@user = user
|
40
|
+
@password = password
|
41
|
+
@reset = reset
|
42
|
+
@ssl = ssl
|
43
43
|
end
|
44
44
|
|
45
45
|
# Create a per-connection unique name.
|
@@ -109,7 +109,7 @@ Puppet::Util::Log.newdesttype :file do
|
|
109
109
|
def handle(msg)
|
110
110
|
if @json > 0
|
111
111
|
@json > 1 ? @file.puts(',') : @json = 2
|
112
|
-
|
112
|
+
Puppet::Util::Json.dump(msg.to_structured_hash, @file)
|
113
113
|
else
|
114
114
|
@file.puts("#{msg.time} #{msg.source} (#{msg.level}): #{msg}")
|
115
115
|
end
|
@@ -135,7 +135,7 @@ Puppet::Util::Log.newdesttype :logstash_event do
|
|
135
135
|
|
136
136
|
def handle(msg)
|
137
137
|
message = format(msg)
|
138
|
-
$stdout.puts message
|
138
|
+
$stdout.puts Puppet::Util::Json.dump(message)
|
139
139
|
end
|
140
140
|
end
|
141
141
|
|
@@ -176,7 +176,7 @@ module Logging
|
|
176
176
|
else
|
177
177
|
error_location_str = Puppet::Util::Errors.error_location(file, line)
|
178
178
|
if error_location_str.empty?
|
179
|
-
|
179
|
+
"\n " + _('(file & line not available)')
|
180
180
|
else
|
181
181
|
"\n %{error_location}" % { error_location: error_location_str }
|
182
182
|
end
|
@@ -41,7 +41,7 @@ module Puppet::Util::Plist
|
|
41
41
|
|
42
42
|
Puppet.debug "Plist #{file_path} ill-formatted, converting with plutil"
|
43
43
|
begin
|
44
|
-
plist = Puppet::Util::Execution.execute(['/usr/bin/plutil', '-convert', 'xml1', '-o', '
|
44
|
+
plist = Puppet::Util::Execution.execute(['/usr/bin/plutil', '-convert', 'xml1', '-o', '-', file_path],
|
45
45
|
{:failonfail => true, :combine => true})
|
46
46
|
return parse_plist(plist)
|
47
47
|
rescue Puppet::ExecutionFailure => detail
|
@@ -1,5 +1,4 @@
|
|
1
1
|
# Provides feature definitions.
|
2
|
-
require 'puppet/util/methodhelper'
|
3
2
|
require 'puppet/util/docs'
|
4
3
|
require 'puppet/util'
|
5
4
|
# This module models provider features and handles checking whether the features
|
@@ -13,7 +12,6 @@ module Puppet::Util::ProviderFeatures
|
|
13
12
|
# @todo Unclear what is api and what is private in this class
|
14
13
|
class ProviderFeature
|
15
14
|
include Puppet::Util
|
16
|
-
include Puppet::Util::MethodHelper
|
17
15
|
include Puppet::Util::Docs
|
18
16
|
attr_accessor :name, :docs, :methods
|
19
17
|
|
@@ -32,11 +30,10 @@ module Puppet::Util::ProviderFeatures
|
|
32
30
|
end
|
33
31
|
end
|
34
32
|
|
35
|
-
def initialize(name, docs,
|
33
|
+
def initialize(name, docs, methods: nil)
|
36
34
|
self.name = name.intern
|
37
35
|
self.docs = docs
|
38
|
-
|
39
|
-
set_options(hash)
|
36
|
+
@methods = methods
|
40
37
|
end
|
41
38
|
|
42
39
|
private
|
@@ -1,11 +1,9 @@
|
|
1
1
|
require 'puppet/util/instance_loader'
|
2
|
-
require 'puppet/util/methodhelper'
|
3
2
|
require 'fileutils'
|
4
3
|
|
5
4
|
# Manage Reference Documentation.
|
6
5
|
class Puppet::Util::Reference
|
7
6
|
include Puppet::Util
|
8
|
-
include Puppet::Util::MethodHelper
|
9
7
|
include Puppet::Util::Docs
|
10
8
|
|
11
9
|
extend Puppet::Util::InstanceLoader
|
@@ -78,9 +76,12 @@ class Puppet::Util::Reference
|
|
78
76
|
self.dynamic
|
79
77
|
end
|
80
78
|
|
81
|
-
def initialize(name,
|
79
|
+
def initialize(name, title: nil, depth: nil, dynamic: nil, doc: nil, &block)
|
82
80
|
@name = name
|
83
|
-
|
81
|
+
@title = title
|
82
|
+
@depth = depth
|
83
|
+
@dynamic = dynamic
|
84
|
+
@doc = doc
|
84
85
|
|
85
86
|
meta_def(:generate, &block)
|
86
87
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'puppet/util/tag_set'
|
2
2
|
|
3
3
|
module Puppet::Util::Tagging
|
4
|
-
ValidTagRegex = /\A[[:alnum:]_][[:alnum:]_:.-]*\Z/
|
4
|
+
ValidTagRegex = /\A[[:alnum:]_][[:alnum:]_:.-]*\Z/u
|
5
5
|
|
6
6
|
# Add a tag to the current tag set.
|
7
7
|
# When a tag set is used for a scope, these tags will be added to all of
|
@@ -17,7 +17,7 @@ module Puppet::Util::Tagging
|
|
17
17
|
# up since we get a lot of duplicates and rarely fail on bad tags
|
18
18
|
if @tags.add?(name)
|
19
19
|
# not seen before, so now we test if it is valid
|
20
|
-
if name
|
20
|
+
if valid_tag?(name)
|
21
21
|
if split_qualified_tags?
|
22
22
|
# avoid adding twice by first testing if the string contains '::'
|
23
23
|
@tags.merge(name.split('::')) if name.include?('::')
|
@@ -40,7 +40,7 @@ module Puppet::Util::Tagging
|
|
40
40
|
# since that results in testing the same string twice
|
41
41
|
#
|
42
42
|
def tag_if_valid(name)
|
43
|
-
if name.is_a?(String) && name
|
43
|
+
if name.is_a?(String) && valid_tag?(name)
|
44
44
|
name = name.downcase
|
45
45
|
@tags ||= new_tags
|
46
46
|
if @tags.add?(name) && name.include?('::')
|
@@ -106,6 +106,19 @@ module Puppet::Util::Tagging
|
|
106
106
|
tag(*tags)
|
107
107
|
end
|
108
108
|
|
109
|
+
def valid_tag?(maybe_tag)
|
110
|
+
begin
|
111
|
+
tag_enc = maybe_tag.encoding
|
112
|
+
if tag_enc == Encoding::UTF_8 || tag_enc == Encoding::ASCII
|
113
|
+
maybe_tag =~ ValidTagRegex
|
114
|
+
else
|
115
|
+
maybe_tag.encode(Encoding::UTF_8) =~ ValidTagRegex
|
116
|
+
end
|
117
|
+
rescue Encoding::UndefinedConversionError, Encoding::InvalidByteSequenceError
|
118
|
+
false
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
109
122
|
private
|
110
123
|
|
111
124
|
def split_qualified_tags?
|