puppet 6.6.0-x64-mingw32 → 6.7.0-x64-mingw32
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/Gemfile.lock +8 -8
- data/ext/solaris/smf/puppet.xml +2 -0
- data/ext/yaml_nodes.rb +7 -7
- data/lib/hiera_puppet.rb +2 -1
- data/lib/puppet/application/apply.rb +2 -3
- data/lib/puppet/application/doc.rb +2 -1
- data/lib/puppet/application/face_base.rb +22 -15
- data/lib/puppet/application/script.rb +4 -6
- data/lib/puppet/configurer.rb +10 -5
- data/lib/puppet/confine_collection.rb +2 -1
- data/lib/puppet/daemon.rb +3 -2
- data/lib/puppet/defaults.rb +8 -0
- data/lib/puppet/environments.rb +9 -7
- data/lib/puppet/etc.rb +1 -1
- data/lib/puppet/external/pson/pure/parser.rb +2 -1
- data/lib/puppet/face/epp.rb +4 -2
- data/lib/puppet/face/help.rb +3 -2
- data/lib/puppet/face/module/changes.rb +2 -1
- data/lib/puppet/file_bucket/dipper.rb +2 -1
- data/lib/puppet/file_serving/configuration.rb +2 -1
- data/lib/puppet/file_serving/fileset.rb +1 -1
- data/lib/puppet/file_serving/http_metadata.rb +4 -2
- data/lib/puppet/file_serving/metadata.rb +2 -1
- data/lib/puppet/file_serving/mount/file.rb +2 -1
- data/lib/puppet/file_serving/mount/locales.rb +2 -1
- data/lib/puppet/file_serving/mount/modules.rb +4 -2
- data/lib/puppet/file_serving/mount/pluginfacts.rb +2 -1
- data/lib/puppet/file_serving/mount/plugins.rb +2 -1
- data/lib/puppet/file_serving/mount/tasks.rb +4 -2
- data/lib/puppet/file_system/uniquefile.rb +4 -2
- data/lib/puppet/functions/match.rb +2 -3
- data/lib/puppet/generate/type.rb +2 -1
- data/lib/puppet/graph/relationship_graph.rb +2 -1
- data/lib/puppet/graph/simple_graph.rb +3 -2
- data/lib/puppet/indirector/catalog/compiler.rb +16 -8
- data/lib/puppet/indirector/certificate/rest.rb +2 -1
- data/lib/puppet/indirector/face.rb +2 -2
- data/lib/puppet/indirector/file_server.rb +4 -2
- data/lib/puppet/indirector/indirection.rb +12 -6
- data/lib/puppet/indirector/node/exec.rb +2 -1
- data/lib/puppet/indirector/report/processor.rb +2 -1
- data/lib/puppet/indirector/request.rb +9 -5
- data/lib/puppet/indirector/ssl_file.rb +10 -8
- data/lib/puppet/indirector/terminus.rb +6 -3
- data/lib/puppet/info_service.rb +9 -0
- data/lib/puppet/info_service/plan_information_service.rb +36 -0
- data/lib/puppet/interface.rb +2 -1
- data/lib/puppet/interface/action.rb +10 -5
- data/lib/puppet/interface/action_manager.rb +2 -1
- data/lib/puppet/interface/documentation.rb +10 -7
- data/lib/puppet/interface/face_collection.rb +6 -3
- data/lib/puppet/interface/option.rb +4 -2
- data/lib/puppet/interface/option_manager.rb +4 -2
- data/lib/puppet/module.rb +35 -1
- data/lib/puppet/module/plan.rb +160 -0
- data/lib/puppet/module_tool.rb +2 -1
- data/lib/puppet/module_tool/applications/application.rb +2 -1
- data/lib/puppet/module_tool/applications/installer.rb +4 -2
- data/lib/puppet/module_tool/applications/upgrader.rb +4 -2
- data/lib/puppet/module_tool/contents_description.rb +2 -1
- data/lib/puppet/module_tool/metadata.rb +2 -3
- data/lib/puppet/module_tool/shared_behaviors.rb +2 -1
- data/lib/puppet/network/authconfig.rb +4 -2
- data/lib/puppet/network/authstore.rb +2 -1
- data/lib/puppet/network/formats.rb +2 -1
- data/lib/puppet/network/http/api/indirected_routes.rb +6 -4
- data/lib/puppet/network/http/handler.rb +2 -1
- data/lib/puppet/network/http/request.rb +2 -1
- data/lib/puppet/network/http/route.rb +2 -1
- data/lib/puppet/network/resolver.rb +3 -2
- data/lib/puppet/network/rights.rb +2 -1
- data/lib/puppet/node.rb +8 -4
- data/lib/puppet/pal/catalog_compiler.rb +8 -1
- data/lib/puppet/pal/compiler.rb +2 -1
- data/lib/puppet/pal/pal_impl.rb +8 -0
- data/lib/puppet/pal/script_compiler.rb +4 -2
- data/lib/puppet/parameter.rb +4 -2
- data/lib/puppet/parameter/value_collection.rb +8 -8
- data/lib/puppet/parser/ast/pops_bridge.rb +2 -1
- data/lib/puppet/parser/compiler.rb +10 -5
- data/lib/puppet/parser/files.rb +2 -1
- data/lib/puppet/parser/functions.rb +2 -1
- data/lib/puppet/parser/relationship.rb +2 -1
- data/lib/puppet/parser/resource.rb +6 -3
- data/lib/puppet/parser/scope.rb +6 -4
- data/lib/puppet/parser/templatewrapper.rb +2 -1
- data/lib/puppet/parser/type_loader.rb +2 -1
- data/lib/puppet/pops/adaptable.rb +2 -5
- data/lib/puppet/pops/evaluator/collectors/exported_collector.rb +2 -1
- data/lib/puppet/pops/evaluator/collectors/fixed_set_collector.rb +2 -1
- data/lib/puppet/pops/evaluator/runtime3_resource_support.rb +2 -1
- data/lib/puppet/pops/evaluator/runtime3_support.rb +8 -4
- data/lib/puppet/pops/loader/base_loader.rb +4 -2
- data/lib/puppet/pops/loader/dependency_loader.rb +4 -2
- data/lib/puppet/pops/loader/gem_support.rb +4 -2
- data/lib/puppet/pops/loader/loader.rb +4 -2
- data/lib/puppet/pops/loader/loader_paths.rb +2 -1
- data/lib/puppet/pops/loader/static_loader.rb +1 -1
- data/lib/puppet/pops/lookup/interpolation.rb +2 -1
- data/lib/puppet/pops/model/factory.rb +4 -2
- data/lib/puppet/pops/parser/epp_support.rb +2 -1
- data/lib/puppet/pops/parser/heredoc_support.rb +2 -1
- data/lib/puppet/pops/parser/interpolation_support.rb +10 -5
- data/lib/puppet/pops/parser/lexer2.rb +6 -3
- data/lib/puppet/pops/parser/locator.rb +2 -1
- data/lib/puppet/pops/types/type_calculator.rb +1 -1
- data/lib/puppet/pops/types/type_parser.rb +4 -2
- data/lib/puppet/pops/validation.rb +2 -1
- data/lib/puppet/pops/validation/checker4_0.rb +6 -3
- data/lib/puppet/pops/visitor.rb +12 -6
- data/lib/puppet/property.rb +19 -16
- data/lib/puppet/property/ensure.rb +2 -1
- data/lib/puppet/property/keyvalue.rb +2 -1
- data/lib/puppet/property/list.rb +2 -1
- data/lib/puppet/provider.rb +10 -8
- data/lib/puppet/provider/exec.rb +7 -4
- data/lib/puppet/provider/file/posix.rb +6 -3
- data/lib/puppet/provider/group/groupadd.rb +2 -1
- data/lib/puppet/provider/group/ldap.rb +7 -4
- data/lib/puppet/provider/group/pw.rb +4 -2
- data/lib/puppet/provider/ldap.rb +8 -4
- data/lib/puppet/provider/nameservice.rb +8 -5
- data/lib/puppet/provider/nameservice/directoryservice.rb +8 -4
- data/lib/puppet/provider/network_device.rb +4 -2
- data/lib/puppet/provider/package.rb +2 -1
- data/lib/puppet/provider/package/aix.rb +4 -2
- data/lib/puppet/provider/package/appdmg.rb +4 -2
- data/lib/puppet/provider/package/apple.rb +2 -1
- data/lib/puppet/provider/package/apt.rb +4 -2
- data/lib/puppet/provider/package/blastwave.rb +2 -1
- data/lib/puppet/provider/package/dpkg.rb +6 -3
- data/lib/puppet/provider/package/fink.rb +2 -1
- data/lib/puppet/provider/package/gem.rb +4 -2
- data/lib/puppet/provider/package/macports.rb +6 -3
- data/lib/puppet/provider/package/nim.rb +8 -4
- data/lib/puppet/provider/package/openbsd.rb +14 -8
- data/lib/puppet/provider/package/opkg.rb +2 -1
- data/lib/puppet/provider/package/pacman.rb +2 -1
- data/lib/puppet/provider/package/pip.rb +2 -1
- data/lib/puppet/provider/package/pkgdmg.rb +4 -2
- data/lib/puppet/provider/package/pkgng.rb +4 -2
- data/lib/puppet/provider/package/pkgutil.rb +2 -1
- data/lib/puppet/provider/package/portupgrade.rb +2 -1
- data/lib/puppet/provider/package/rpm.rb +8 -4
- data/lib/puppet/provider/package/windows/package.rb +2 -1
- data/lib/puppet/provider/parsedfile.rb +14 -7
- data/lib/puppet/provider/service/base.rb +7 -4
- data/lib/puppet/provider/service/launchd.rb +4 -2
- data/lib/puppet/provider/service/service.rb +2 -1
- data/lib/puppet/provider/service/upstart.rb +11 -8
- data/lib/puppet/provider/user/directoryservice.rb +2 -1
- data/lib/puppet/provider/user/hpux.rb +1 -1
- data/lib/puppet/provider/user/ldap.rb +8 -4
- data/lib/puppet/provider/user/openbsd.rb +2 -1
- data/lib/puppet/provider/user/pw.rb +2 -1
- data/lib/puppet/provider/user/user_role_add.rb +4 -2
- data/lib/puppet/provider/user/useradd.rb +7 -4
- data/lib/puppet/reference/providers.rb +2 -3
- data/lib/puppet/reference/type.rb +4 -2
- data/lib/puppet/relationship.rb +4 -9
- data/lib/puppet/resource.rb +16 -9
- data/lib/puppet/resource/capability_finder.rb +12 -8
- data/lib/puppet/resource/catalog.rb +36 -40
- data/lib/puppet/resource/type.rb +7 -3
- data/lib/puppet/resource/type_collection.rb +4 -2
- data/lib/puppet/settings.rb +36 -19
- data/lib/puppet/settings/base_setting.rb +2 -1
- data/lib/puppet/settings/config_file.rb +2 -1
- data/lib/puppet/settings/file_setting.rb +2 -1
- data/lib/puppet/settings/ini_file.rb +2 -1
- data/lib/puppet/ssl/base.rb +2 -1
- data/lib/puppet/ssl/host.rb +16 -8
- data/lib/puppet/ssl/key.rb +2 -2
- data/lib/puppet/ssl/state_machine.rb +22 -3
- data/lib/puppet/transaction/event.rb +2 -1
- data/lib/puppet/transaction/event_manager.rb +4 -2
- data/lib/puppet/transaction/report.rb +10 -10
- data/lib/puppet/transaction/resource_harness.rb +4 -2
- data/lib/puppet/type.rb +84 -48
- data/lib/puppet/type/component.rb +2 -1
- data/lib/puppet/type/exec.rb +11 -7
- data/lib/puppet/type/file.rb +15 -9
- data/lib/puppet/type/file/content.rb +7 -3
- data/lib/puppet/type/file/ctime.rb +2 -1
- data/lib/puppet/type/file/data_sync.rb +2 -1
- data/lib/puppet/type/file/ensure.rb +10 -7
- data/lib/puppet/type/file/mode.rb +2 -1
- data/lib/puppet/type/file/mtime.rb +2 -1
- data/lib/puppet/type/file/selcontext.rb +2 -1
- data/lib/puppet/type/file/source.rb +6 -7
- data/lib/puppet/type/file/target.rb +2 -1
- data/lib/puppet/type/file/type.rb +2 -1
- data/lib/puppet/type/package.rb +6 -3
- data/lib/puppet/type/resources.rb +2 -1
- data/lib/puppet/type/service.rb +2 -1
- data/lib/puppet/type/tidy.rb +14 -7
- data/lib/puppet/type/user.rb +19 -7
- data/lib/puppet/util.rb +6 -3
- data/lib/puppet/util/checksums.rb +1 -1
- data/lib/puppet/util/classgen.rb +12 -6
- data/lib/puppet/util/command_line.rb +8 -4
- data/lib/puppet/util/connection.rb +4 -2
- data/lib/puppet/util/diff.rb +4 -2
- data/lib/puppet/util/execution.rb +4 -2
- data/lib/puppet/util/feature.rb +7 -4
- data/lib/puppet/util/fileparsing.rb +57 -46
- data/lib/puppet/util/filetype.rb +2 -1
- data/lib/puppet/util/http_proxy.rb +2 -1
- data/lib/puppet/util/instance_loader.rb +2 -1
- data/lib/puppet/util/ldap/connection.rb +4 -2
- data/lib/puppet/util/ldap/manager.rb +6 -3
- data/lib/puppet/util/log.rb +6 -3
- data/lib/puppet/util/metric.rb +2 -1
- data/lib/puppet/util/posix.rb +4 -2
- data/lib/puppet/util/rdoc/code_objects.rb +2 -1
- data/lib/puppet/util/rdoc/generators/puppet_generator.rb +4 -2
- data/lib/puppet/util/selinux.rb +2 -1
- data/lib/puppet/version.rb +2 -5
- data/locales/puppet.pot +713 -685
- data/man/man5/puppet.conf.5 +9 -2
- data/man/man8/puppet-agent.8 +1 -1
- data/man/man8/puppet-apply.8 +1 -1
- data/man/man8/puppet-catalog.8 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- data/man/man8/puppet-parser.8 +1 -1
- data/man/man8/puppet-plugin.8 +1 -1
- data/man/man8/puppet-report.8 +1 -1
- 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 +1 -1
- data/man/man8/puppet.8 +2 -2
- data/spec/lib/puppet_spec/modules.rb +16 -2
- data/spec/unit/indirector/request_spec.rb +5 -6
- data/spec/unit/info_service_spec.rb +48 -0
- data/spec/unit/module_spec.rb +73 -0
- data/spec/unit/plan_spec.rb +65 -0
- data/spec/unit/puppet_pal_catalog_spec.rb +12 -0
- data/spec/unit/ssl/state_machine_spec.rb +68 -5
- metadata +6 -2
data/lib/puppet/module_tool.rb
CHANGED
@@ -31,7 +31,8 @@ module Puppet
|
|
31
31
|
# Return the +username+ and +modname+ for a given +full_module_name+, or raise an
|
32
32
|
# ArgumentError if the argument isn't parseable.
|
33
33
|
def self.username_and_modname_from(full_module_name)
|
34
|
-
|
34
|
+
matcher = full_module_name.match(FULL_MODULE_NAME_PATTERN)
|
35
|
+
if matcher
|
35
36
|
return matcher.captures
|
36
37
|
else
|
37
38
|
raise ArgumentError, _("Not a valid full name: %{full_module_name}") % { full_module_name: full_module_name }
|
@@ -68,7 +68,8 @@ module Puppet::ModuleTool
|
|
68
68
|
end
|
69
69
|
|
70
70
|
def parse_filename(filename)
|
71
|
-
|
71
|
+
match = /^((.*?)-(.*?))-(\d+\.\d+\.\d+.*?)$/.match(File.basename(filename, '.tar.gz'))
|
72
|
+
if match
|
72
73
|
module_name, author, shortname, version = match.captures
|
73
74
|
else
|
74
75
|
raise ArgumentError, _("Could not parse filename to obtain the username, module name and version. (%{release_name})") % { release_name: @release_name }
|
@@ -60,7 +60,8 @@ module Puppet::ModuleTool
|
|
60
60
|
results = { :action => :install, :module_name => name, :module_version => version }
|
61
61
|
|
62
62
|
begin
|
63
|
-
|
63
|
+
installed_module = installed_modules[name]
|
64
|
+
if installed_module
|
64
65
|
unless forced?
|
65
66
|
if Puppet::Module.parse_range(version).include? installed_module.version
|
66
67
|
results[:result] = :noop
|
@@ -136,7 +137,8 @@ module Puppet::ModuleTool
|
|
136
137
|
unless forced?
|
137
138
|
# Check for module name conflicts.
|
138
139
|
releases.each do |rel|
|
139
|
-
|
140
|
+
installed_module = installed_modules_source.by_name[rel.name.split('-').last]
|
141
|
+
if installed_module
|
140
142
|
next if installed_module.has_metadata? && installed_module.forge_name.tr('/', '-') == rel.name
|
141
143
|
|
142
144
|
if rel.name != name
|
@@ -144,7 +144,8 @@ module Puppet::ModuleTool
|
|
144
144
|
end
|
145
145
|
|
146
146
|
releases.each do |rel|
|
147
|
-
|
147
|
+
mod = installed_modules_source.by_name[rel.name.split('-').last]
|
148
|
+
if mod
|
148
149
|
next if mod.has_metadata? && mod.forge_name.tr('/', '-') == rel.name
|
149
150
|
|
150
151
|
if rel.name != name
|
@@ -189,7 +190,8 @@ module Puppet::ModuleTool
|
|
189
190
|
|
190
191
|
Puppet.notice _('Upgrading -- do not interrupt ...')
|
191
192
|
releases.each do |release|
|
192
|
-
|
193
|
+
installed = installed_modules[release.name]
|
194
|
+
if installed
|
193
195
|
release.install(Pathname.new(installed.mod.modulepath))
|
194
196
|
else
|
195
197
|
release.install(dir)
|
@@ -43,7 +43,8 @@ module Puppet::ModuleTool
|
|
43
43
|
end
|
44
44
|
|
45
45
|
type_names.each do |name|
|
46
|
-
|
46
|
+
type = Puppet::Type.type(name.to_sym)
|
47
|
+
if type
|
47
48
|
type_hash = {:name => name, :doc => type.doc}
|
48
49
|
type_hash[:properties] = attr_doc(type, :property)
|
49
50
|
type_hash[:parameters] = attr_doc(type, :param)
|
@@ -66,9 +66,8 @@ module Puppet::ModuleTool
|
|
66
66
|
validate_name(name)
|
67
67
|
validate_version_range(version_requirement) if version_requirement
|
68
68
|
|
69
|
-
|
70
|
-
|
71
|
-
end
|
69
|
+
dup = @data['dependencies'].find { |d| d.full_module_name == name && d.version_requirement != version_requirement }
|
70
|
+
raise ArgumentError, _("Dependency conflict for %{module_name}: Dependency %{name} was given conflicting version requirements %{version_requirement} and %{dup_version}. Verify that there are no duplicates in the metadata.json.") % { module_name: full_module_name, name: name, version_requirement: version_requirement, dup_version: dup.version_requirement } if dup
|
72
71
|
|
73
72
|
dep = Dependency.new(name, version_requirement, repository)
|
74
73
|
@data['dependencies'].add(dep)
|
@@ -111,7 +111,8 @@ module Puppet::ModuleTool::Shared
|
|
111
111
|
valid_versions = versions.select { |x| x[:semver].special == '' }
|
112
112
|
valid_versions = versions if valid_versions.empty?
|
113
113
|
|
114
|
-
|
114
|
+
version = valid_versions.last
|
115
|
+
unless version
|
115
116
|
req_module = @module_name
|
116
117
|
req_versions = @versions["#{@module_name}"].map { |v| v[:semver] }
|
117
118
|
raise NoVersionsSatisfyError,
|
@@ -54,7 +54,8 @@ module Puppet
|
|
54
54
|
right = @rights.newright(acl[:acl])
|
55
55
|
right.allow(acl[:allow] || "*")
|
56
56
|
|
57
|
-
|
57
|
+
method = acl[:method]
|
58
|
+
if method
|
58
59
|
method = [method] unless method.is_a?(Array)
|
59
60
|
method.each { |m| right.restrict_method(m) }
|
60
61
|
end
|
@@ -65,7 +66,8 @@ module Puppet
|
|
65
66
|
# raise an Puppet::Network::AuthorizedError if the request
|
66
67
|
# is denied.
|
67
68
|
def check_authorization(method, path, params)
|
68
|
-
|
69
|
+
authorization_failure_exception = @rights.is_request_forbidden_and_why?(method, path, params)
|
70
|
+
if authorization_failure_exception
|
69
71
|
Puppet.warning(_("Denying access: %{authorization_failure_exception}") % { authorization_failure_exception: authorization_failure_exception })
|
70
72
|
raise authorization_failure_exception
|
71
73
|
end
|
@@ -105,7 +105,8 @@ Puppet::Network::FormatHandler.create_serialized_formats(:pson, :weight => 10, :
|
|
105
105
|
# If they pass class information, we want to ignore it.
|
106
106
|
# This is required for compatibility with Puppet 3.x
|
107
107
|
def data_to_instance(klass, data)
|
108
|
-
|
108
|
+
d = data['data'] if data.is_a?(Hash)
|
109
|
+
if d
|
109
110
|
data = d
|
110
111
|
end
|
111
112
|
return data if data.is_a?(klass)
|
@@ -124,7 +124,8 @@ class Puppet::Network::HTTP::API::IndirectedRoutes
|
|
124
124
|
|
125
125
|
# Execute our find.
|
126
126
|
def do_find(indirection, key, params, request, response)
|
127
|
-
|
127
|
+
result = indirection.find(key, params)
|
128
|
+
unless result
|
128
129
|
raise Puppet::Network::HTTP::Error::HTTPNotFoundError.new(_("Could not find %{value0} %{key}") % { value0: indirection.name, key: key }, Puppet::Network::HTTP::Issues::RESOURCE_NOT_FOUND)
|
129
130
|
end
|
130
131
|
|
@@ -245,10 +246,11 @@ class Puppet::Network::HTTP::API::IndirectedRoutes
|
|
245
246
|
raise Puppet::Network::HTTP::Error::HTTPMethodNotAllowedError.new(
|
246
247
|
_("No support for http method %{http_method}") % { http_method: http_method }) unless METHOD_MAP[http_method]
|
247
248
|
|
248
|
-
|
249
|
-
|
249
|
+
method = METHOD_MAP[http_method][plurality(indirection)]
|
250
|
+
unless method
|
251
|
+
raise Puppet::Network::HTTP::Error::HTTPBadRequestError.new(
|
250
252
|
_("No support for plurality %{indirection} for %{http_method} operations") % { indirection: plurality(indirection), http_method: http_method })
|
251
|
-
|
253
|
+
end
|
252
254
|
|
253
255
|
method
|
254
256
|
end
|
@@ -105,7 +105,8 @@ module Puppet::Network::HTTP::Handler
|
|
105
105
|
end
|
106
106
|
|
107
107
|
def find_route_or_raise(request)
|
108
|
-
|
108
|
+
route = @routes.find { |r| r.matches?(request) }
|
109
|
+
if route
|
109
110
|
return route
|
110
111
|
else
|
111
112
|
raise Puppet::Network::HTTP::Error::HTTPNotFoundError.new(
|
@@ -20,7 +20,8 @@ Puppet::Network::HTTP::Request = Struct.new(:headers, :params, :method, :path, :
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def formatter
|
23
|
-
|
23
|
+
header = headers['content-type']
|
24
|
+
if header
|
24
25
|
header.gsub!(/\s*;.*$/,'') # strip any charset
|
25
26
|
format = Puppet::Network::FormatHandler.mime(header)
|
26
27
|
|
@@ -83,7 +83,8 @@ class Puppet::Network::HTTP::Route
|
|
83
83
|
end
|
84
84
|
|
85
85
|
subrequest = request.route_into(match(request.routing_path).to_s)
|
86
|
-
|
86
|
+
chained_route = @chained.find { |route| route.matches?(subrequest) }
|
87
|
+
if chained_route
|
87
88
|
chained_route.process(subrequest, response)
|
88
89
|
end
|
89
90
|
end
|
@@ -71,7 +71,7 @@ module Puppet::Network
|
|
71
71
|
each_srv_record(domain, :puppet, &block)
|
72
72
|
else
|
73
73
|
each_priority(records) do |recs|
|
74
|
-
while next_rr = recs.delete(find_weighted_server(recs))
|
74
|
+
while next_rr = recs.delete(find_weighted_server(recs)) #rubocop:disable Lint/AssignmentInCondition
|
75
75
|
Puppet.debug "Yielding next server of #{next_rr.target.to_s}:#{next_rr.port}"
|
76
76
|
yield next_rr.target.to_s, next_rr.port
|
77
77
|
end
|
@@ -125,7 +125,8 @@ module Puppet::Network
|
|
125
125
|
# @return [Boolean] true if the entry has expired, false otherwise.
|
126
126
|
# Always returns true if the record had no TTL.
|
127
127
|
def expired?(service_name)
|
128
|
-
|
128
|
+
entry = @record_cache[service_name]
|
129
|
+
if entry
|
129
130
|
return Time.now > (entry.resolution_time + entry.ttl)
|
130
131
|
else
|
131
132
|
return true
|
@@ -39,7 +39,8 @@ class Rights
|
|
39
39
|
# an acl can return :dunno, which means "I'm not qualified to answer your question,
|
40
40
|
# please ask someone else". This is used when for instance an acl matches, but not for the
|
41
41
|
# current rest method, where we might think some other acl might be more specific.
|
42
|
-
|
42
|
+
match = acl.match?(name)
|
43
|
+
if match
|
43
44
|
args[:match] = match
|
44
45
|
if (res = acl.allowed?(args[:node], args[:ip], args)) != :dunno
|
45
46
|
# return early if we're allowed
|
data/lib/puppet/node.rb
CHANGED
@@ -61,7 +61,8 @@ class Puppet::Node
|
|
61
61
|
if @environment
|
62
62
|
@environment
|
63
63
|
else
|
64
|
-
|
64
|
+
env = parameters[ENVIRONMENT]
|
65
|
+
if env
|
65
66
|
self.environment = env
|
66
67
|
elsif environment_name
|
67
68
|
self.environment = environment_name
|
@@ -101,7 +102,8 @@ class Puppet::Node
|
|
101
102
|
raise ArgumentError, _("Node names cannot be nil") unless name
|
102
103
|
@name = name
|
103
104
|
|
104
|
-
|
105
|
+
classes = options[:classes]
|
106
|
+
if classes
|
105
107
|
if classes.is_a?(String)
|
106
108
|
@classes = [classes]
|
107
109
|
else
|
@@ -117,7 +119,8 @@ class Puppet::Node
|
|
117
119
|
|
118
120
|
@server_facts = {}
|
119
121
|
|
120
|
-
|
122
|
+
env = options[:environment]
|
123
|
+
if env
|
121
124
|
self.environment = env
|
122
125
|
end
|
123
126
|
|
@@ -187,7 +190,8 @@ class Puppet::Node
|
|
187
190
|
names += split_name(name) if name.include?(".")
|
188
191
|
|
189
192
|
# First, get the fqdn
|
190
|
-
|
193
|
+
fqdn = parameters["fqdn"]
|
194
|
+
unless fqdn
|
191
195
|
if parameters["hostname"] and parameters["domain"]
|
192
196
|
fqdn = parameters["hostname"] + "." + parameters["domain"]
|
193
197
|
else
|
@@ -27,7 +27,7 @@ module Pal
|
|
27
27
|
# @example Get resulting catalog as pretty printed Json
|
28
28
|
# Puppet::Pal.in_environment(...) do |pal|
|
29
29
|
# pal.with_catalog_compiler(...) do |compiler|
|
30
|
-
# compiler.with_json_encoding {|
|
30
|
+
# compiler.with_json_encoding { |encoder| encoder.encode }
|
31
31
|
# end
|
32
32
|
# end
|
33
33
|
#
|
@@ -37,6 +37,13 @@ module Pal
|
|
37
37
|
yield JsonCatalogEncoder.new(catalog, pretty: pretty, exclude_virtual: exclude_virtual)
|
38
38
|
end
|
39
39
|
|
40
|
+
# Returns a hash representation of the compiled catalog.
|
41
|
+
#
|
42
|
+
# @api public
|
43
|
+
def catalog_data_hash
|
44
|
+
catalog.to_data_hash
|
45
|
+
end
|
46
|
+
|
40
47
|
# Evaluates an AST obtained from `parse_string` or `parse_file` in topscope.
|
41
48
|
# If the ast is a `Puppet::Pops::Model::Program` (what is returned from the `parse` methods, any definitions
|
42
49
|
# in the program (that is, any function, plan, etc. that is defined will be made available for use).
|
data/lib/puppet/pal/compiler.rb
CHANGED
@@ -41,7 +41,8 @@ module Pal
|
|
41
41
|
#
|
42
42
|
def function_signature(function_name)
|
43
43
|
loader = internal_compiler.loaders.private_environment_loader
|
44
|
-
|
44
|
+
func = loader.load(:function, function_name)
|
45
|
+
if func
|
45
46
|
return FunctionSignature.new(func.class)
|
46
47
|
end
|
47
48
|
# Could not find function
|
data/lib/puppet/pal/pal_impl.rb
CHANGED
@@ -176,6 +176,10 @@ module Pal
|
|
176
176
|
end
|
177
177
|
end
|
178
178
|
|
179
|
+
# We need to make sure to set these back when we're done
|
180
|
+
previous_tasks_value = Puppet[:tasks]
|
181
|
+
previous_code_value = Puppet[:code]
|
182
|
+
|
179
183
|
Puppet[:tasks] = false
|
180
184
|
# After the assertions, if code_string is non nil - it has the highest precedence
|
181
185
|
Puppet[:code] = code_string unless code_string.nil?
|
@@ -183,6 +187,10 @@ module Pal
|
|
183
187
|
# If manifest_file is nil, the #main method will use the env configured manifest
|
184
188
|
# to do things in the block while a Script Compiler is in effect
|
185
189
|
main(manifest_file, facts, variables, :catalog, &block)
|
190
|
+
ensure
|
191
|
+
# Clean up after ourselves
|
192
|
+
Puppet[:tasks] = previous_tasks_value
|
193
|
+
Puppet[:code] = previous_code_value
|
186
194
|
end
|
187
195
|
|
188
196
|
# Defines the context in which to perform puppet operations (evaluation, etc)
|
@@ -8,7 +8,8 @@ module Pal
|
|
8
8
|
#
|
9
9
|
def plan_signature(plan_name)
|
10
10
|
loader = internal_compiler.loaders.private_environment_loader
|
11
|
-
|
11
|
+
func = loader.load(:plan, plan_name)
|
12
|
+
if func
|
12
13
|
return PlanSignature.new(func)
|
13
14
|
end
|
14
15
|
# Could not find plan
|
@@ -40,7 +41,8 @@ module Pal
|
|
40
41
|
#
|
41
42
|
def task_signature(task_name)
|
42
43
|
loader = internal_compiler.loaders.private_environment_loader
|
43
|
-
|
44
|
+
task = loader.load(:task, task_name)
|
45
|
+
if task
|
44
46
|
return TaskSignature.new(task)
|
45
47
|
end
|
46
48
|
# Could not find task
|
data/lib/puppet/parameter.rb
CHANGED
@@ -110,11 +110,13 @@ class Puppet::Parameter
|
|
110
110
|
|
111
111
|
unless defined?(@addeddocvals)
|
112
112
|
@doc = Puppet::Util::Docs.scrub(@doc)
|
113
|
-
|
113
|
+
vals = value_collection.doc
|
114
|
+
if vals
|
114
115
|
@doc << "\n\n#{vals}"
|
115
116
|
end
|
116
117
|
|
117
|
-
|
118
|
+
features = self.required_features
|
119
|
+
if features
|
118
120
|
@doc << "\n\nRequires features #{features.flatten.collect { |f| f.to_s }.join(" ")}."
|
119
121
|
end
|
120
122
|
@addeddocvals = true
|
@@ -18,9 +18,8 @@ class Puppet::Parameter::ValueCollection
|
|
18
18
|
#
|
19
19
|
def aliasvalue(name, other)
|
20
20
|
other = other.to_sym
|
21
|
-
|
22
|
-
|
23
|
-
end
|
21
|
+
value = match?(other)
|
22
|
+
raise Puppet::DevError, _("Cannot alias nonexistent value %{value}") % { value: other } unless value
|
24
23
|
|
25
24
|
value.alias(name)
|
26
25
|
end
|
@@ -35,7 +34,8 @@ class Puppet::Parameter::ValueCollection
|
|
35
34
|
unless values.empty?
|
36
35
|
@doc << "Valid values are "
|
37
36
|
@doc << @strings.collect do |value|
|
38
|
-
|
37
|
+
aliases = value.aliases
|
38
|
+
if aliases && ! aliases.empty?
|
39
39
|
"`#{value.name}` (also called `#{aliases.join(", ")}`)"
|
40
40
|
else
|
41
41
|
"`#{value.name}`"
|
@@ -81,9 +81,8 @@ class Puppet::Parameter::ValueCollection
|
|
81
81
|
#
|
82
82
|
def match?(test_value)
|
83
83
|
# First look for normal values
|
84
|
-
|
85
|
-
|
86
|
-
end
|
84
|
+
value = @strings.find { |v| v.match?(test_value) }
|
85
|
+
return value if value
|
87
86
|
|
88
87
|
# Then look for a regex match
|
89
88
|
@regexes.find { |v| v.match?(test_value) }
|
@@ -100,7 +99,8 @@ class Puppet::Parameter::ValueCollection
|
|
100
99
|
def munge(value)
|
101
100
|
return value if empty?
|
102
101
|
|
103
|
-
|
102
|
+
instance = match?(value)
|
103
|
+
if instance
|
104
104
|
if instance.regex?
|
105
105
|
return value
|
106
106
|
else
|
@@ -176,7 +176,8 @@ class Puppet::Parser::AST::PopsBridge
|
|
176
176
|
# reused and we may reenter without a scope (which is fine). A debug message is then output in case
|
177
177
|
# there is the need to track down the odd corner case. See {#obtain_scope}.
|
178
178
|
#
|
179
|
-
|
179
|
+
scope = obtain_scope
|
180
|
+
if scope
|
180
181
|
typed_parameters.each do |p|
|
181
182
|
result[p.name] = @@evaluator.evaluate(scope, p.type_expr)
|
182
183
|
end
|
@@ -61,7 +61,8 @@ class Puppet::Parser::Compiler
|
|
61
61
|
# Store a resource override.
|
62
62
|
def add_override(override)
|
63
63
|
# If possible, merge the override in immediately.
|
64
|
-
|
64
|
+
resource = @catalog.resource(override.ref)
|
65
|
+
if resource
|
65
66
|
resource.merge(override)
|
66
67
|
else
|
67
68
|
# Otherwise, store the override for later; these
|
@@ -493,7 +494,8 @@ class Puppet::Parser::Compiler
|
|
493
494
|
# Now see if we can find the node.
|
494
495
|
astnode = nil
|
495
496
|
@node.names.each do |name|
|
496
|
-
|
497
|
+
astnode = krt.node(name.to_s.downcase)
|
498
|
+
break if astnode
|
497
499
|
end
|
498
500
|
|
499
501
|
unless (astnode ||= krt.node("default"))
|
@@ -627,7 +629,8 @@ class Puppet::Parser::Compiler
|
|
627
629
|
|
628
630
|
resources.each do |resource|
|
629
631
|
# Add in any resource overrides.
|
630
|
-
|
632
|
+
overrides = resource_overrides(resource)
|
633
|
+
if overrides
|
631
634
|
overrides.each do |over|
|
632
635
|
resource.merge(over)
|
633
636
|
end
|
@@ -645,7 +648,8 @@ class Puppet::Parser::Compiler
|
|
645
648
|
protected :finish
|
646
649
|
|
647
650
|
def add_resource_metaparams
|
648
|
-
|
651
|
+
main = catalog.resource(:class, :main)
|
652
|
+
unless main
|
649
653
|
#TRANSLATORS "main" is a function name and should not be translated
|
650
654
|
raise _("Couldn't find main")
|
651
655
|
end
|
@@ -655,7 +659,8 @@ class Puppet::Parser::Compiler
|
|
655
659
|
end
|
656
660
|
data = {}
|
657
661
|
catalog.walk(main, :out) do |source, target|
|
658
|
-
|
662
|
+
source_data = data[source] || metaparams_as_data(source, names)
|
663
|
+
if source_data
|
659
664
|
# only store anything in the data hash if we've actually got
|
660
665
|
# data
|
661
666
|
data[source] ||= source_data
|