puppet 6.6.0 → 6.7.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/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
@@ -22,7 +22,8 @@ Puppet::Face.define(:module, '1.0.0') do
|
|
22
22
|
|
23
23
|
when_invoked do |path, options|
|
24
24
|
Puppet::ModuleTool.set_option_defaults options
|
25
|
-
|
25
|
+
root_path = Puppet::ModuleTool.find_module_root(path)
|
26
|
+
unless root_path
|
26
27
|
raise ArgumentError, _("Could not find a valid module at %{path}") % { path: path.inspect }
|
27
28
|
end
|
28
29
|
Puppet::ModuleTool::Applications::Checksummer.run(root_path, options)
|
@@ -126,7 +126,8 @@ class Puppet::FileBucket::Dipper
|
|
126
126
|
end
|
127
127
|
|
128
128
|
if restore
|
129
|
-
|
129
|
+
newcontents = get_bucket_file(sum)
|
130
|
+
if newcontents
|
130
131
|
newsum = newcontents.checksum_data
|
131
132
|
changed = nil
|
132
133
|
if Puppet::FileSystem.exist?(file_handle) and ! Puppet::FileSystem.writable?(file_handle)
|
@@ -55,7 +55,8 @@ class Puppet::FileServing::Configuration
|
|
55
55
|
raise(ArgumentError, _("Cannot find file: Invalid mount '%{mount_name}'") % { mount_name: mount_name }) unless mount_name =~ %r{^[-\w]+$}
|
56
56
|
raise(ArgumentError, _("Cannot find file: Invalid relative path '%{path}'") % { path: path }) if path and path.split('/').include?('..')
|
57
57
|
|
58
|
-
|
58
|
+
mount = find_mount(mount_name, request.environment)
|
59
|
+
return nil unless mount
|
59
60
|
if mount.name == "modules" and mount_name != "modules"
|
60
61
|
# yay backward-compatibility
|
61
62
|
path = "#{mount_name}/#{path}"
|
@@ -148,7 +148,7 @@ class Puppet::FileServing::Fileset
|
|
148
148
|
|
149
149
|
result = []
|
150
150
|
|
151
|
-
while entry = current_dirs.shift
|
151
|
+
while entry = current_dirs.shift #rubocop:disable Lint/AssignmentInCondition
|
152
152
|
if continue_recursion_at?(entry.depth + 1)
|
153
153
|
entry.children.each do |child|
|
154
154
|
result << child.path
|
@@ -15,13 +15,15 @@ class Puppet::FileServing::HttpMetadata < Puppet::FileServing::Metadata
|
|
15
15
|
# use a default mtime in case there is no usable HTTP header
|
16
16
|
@checksums[:mtime] = "{mtime}#{Time.now}"
|
17
17
|
|
18
|
-
|
18
|
+
checksum = http_response['content-md5']
|
19
|
+
if checksum
|
19
20
|
# convert base64 digest to hex
|
20
21
|
checksum = checksum.unpack("m0").first.unpack("H*").first
|
21
22
|
@checksums[:md5] = "{md5}#{checksum}"
|
22
23
|
end
|
23
24
|
|
24
|
-
|
25
|
+
last_modified = http_response['last-modified']
|
26
|
+
if last_modified
|
25
27
|
mtime = DateTime.httpdate(last_modified).to_time
|
26
28
|
@checksums[:mtime] = "{mtime}#{mtime.utc}"
|
27
29
|
end
|
@@ -127,7 +127,8 @@ class Puppet::FileServing::Metadata < Puppet::FileServing::Base
|
|
127
127
|
@owner = data.delete('owner')
|
128
128
|
@group = data.delete('group')
|
129
129
|
@mode = data.delete('mode')
|
130
|
-
|
130
|
+
checksum = data.delete('checksum')
|
131
|
+
if checksum
|
131
132
|
@checksum_type = checksum['type']
|
132
133
|
@checksum = checksum['value']
|
133
134
|
end
|
@@ -60,7 +60,8 @@ class Puppet::FileServing::Mount::File < Puppet::FileServing::Mount
|
|
60
60
|
end
|
61
61
|
|
62
62
|
def search(path, request)
|
63
|
-
|
63
|
+
path = complete_path(path, request.node)
|
64
|
+
return nil unless path
|
64
65
|
[path]
|
65
66
|
end
|
66
67
|
|
@@ -6,7 +6,8 @@ require 'puppet/file_serving/mount'
|
|
6
6
|
class Puppet::FileServing::Mount::Locales < Puppet::FileServing::Mount
|
7
7
|
# Return an instance of the appropriate class.
|
8
8
|
def find(relative_path, request)
|
9
|
-
|
9
|
+
mod = request.environment.modules.find { |m| m.locale(relative_path) }
|
10
|
+
return nil unless mod
|
10
11
|
|
11
12
|
path = mod.locale(relative_path)
|
12
13
|
|
@@ -7,13 +7,15 @@ class Puppet::FileServing::Mount::Modules < Puppet::FileServing::Mount
|
|
7
7
|
def find(path, request)
|
8
8
|
raise _("No module specified") if path.to_s.empty?
|
9
9
|
module_name, relative_path = path.split("/", 2)
|
10
|
-
|
10
|
+
mod = request.environment.module(module_name)
|
11
|
+
return nil unless mod
|
11
12
|
|
12
13
|
mod.file(relative_path)
|
13
14
|
end
|
14
15
|
|
15
16
|
def search(path, request)
|
16
|
-
|
17
|
+
result = find(path, request)
|
18
|
+
if result
|
17
19
|
[result]
|
18
20
|
end
|
19
21
|
end
|
@@ -6,7 +6,8 @@ require 'puppet/file_serving/mount'
|
|
6
6
|
class Puppet::FileServing::Mount::PluginFacts < Puppet::FileServing::Mount
|
7
7
|
# Return an instance of the appropriate class.
|
8
8
|
def find(relative_path, request)
|
9
|
-
|
9
|
+
mod = request.environment.modules.find { |m| m.pluginfact(relative_path) }
|
10
|
+
return nil unless mod
|
10
11
|
|
11
12
|
path = mod.pluginfact(relative_path)
|
12
13
|
|
@@ -6,7 +6,8 @@ require 'puppet/file_serving/mount'
|
|
6
6
|
class Puppet::FileServing::Mount::Plugins < Puppet::FileServing::Mount
|
7
7
|
# Return an instance of the appropriate class.
|
8
8
|
def find(relative_path, request)
|
9
|
-
|
9
|
+
mod = request.environment.modules.find { |m| m.plugin(relative_path) }
|
10
|
+
return nil unless mod
|
10
11
|
|
11
12
|
path = mod.plugin(relative_path)
|
12
13
|
|
@@ -4,13 +4,15 @@ class Puppet::FileServing::Mount::Tasks < Puppet::FileServing::Mount
|
|
4
4
|
def find(path, request)
|
5
5
|
raise _("No task specified") if path.to_s.empty?
|
6
6
|
module_name, task_path = path.split("/", 2)
|
7
|
-
|
7
|
+
mod = request.environment.module(module_name)
|
8
|
+
return nil unless mod
|
8
9
|
|
9
10
|
mod.task_file(task_path)
|
10
11
|
end
|
11
12
|
|
12
13
|
def search(path, request)
|
13
|
-
|
14
|
+
result = find(path, request)
|
15
|
+
if result
|
14
16
|
[result]
|
15
17
|
end
|
16
18
|
end
|
@@ -115,7 +115,8 @@ class Puppet::FileSystem::Uniquefile < DelegateClass(File)
|
|
115
115
|
end
|
116
116
|
|
117
117
|
def create_tmpname(basename, *rest)
|
118
|
-
|
118
|
+
opts = try_convert_to_hash(rest[-1])
|
119
|
+
if opts
|
119
120
|
opts = opts.dup if rest.pop.equal?(opts)
|
120
121
|
max_try = opts.delete(:max_try)
|
121
122
|
opts = [opts]
|
@@ -157,7 +158,8 @@ class Puppet::FileSystem::Uniquefile < DelegateClass(File)
|
|
157
158
|
@@systmpdir
|
158
159
|
else
|
159
160
|
for dir in [ Puppet::Util.get_env('TMPDIR'), Puppet::Util.get_env('TMP'), Puppet::Util.get_env('TEMP'), @@systmpdir, '/tmp']
|
160
|
-
|
161
|
+
stat = File.stat(dir) if dir
|
162
|
+
if stat && stat.directory? && stat.writable?
|
161
163
|
tmp = dir
|
162
164
|
break
|
163
165
|
end rescue nil
|
data/lib/puppet/generate/type.rb
CHANGED
@@ -195,7 +195,8 @@ module Puppet
|
|
195
195
|
types ||= Puppet::Type.instance_variable_get('@types')
|
196
196
|
|
197
197
|
# Assume the type follows the naming convention
|
198
|
-
|
198
|
+
type = types[type_name]
|
199
|
+
unless type
|
199
200
|
Puppet.err _("Custom type '%{type_name}' was not defined in '%{input}'.") % { type_name: type_name, input: input }
|
200
201
|
next
|
201
202
|
end
|
@@ -104,7 +104,8 @@ class Puppet::Graph::RelationshipGraph < Puppet::Graph::SimpleGraph
|
|
104
104
|
teardown = options[:teardown] || lambda {}
|
105
105
|
graph_cycle_handler = options[:graph_cycle_handler] || lambda { [] }
|
106
106
|
|
107
|
-
|
107
|
+
cycles = report_cycles_in_graph
|
108
|
+
if cycles
|
108
109
|
graph_cycle_handler.call(cycles)
|
109
110
|
end
|
110
111
|
|
@@ -208,7 +208,7 @@ class Puppet::Graph::SimpleGraph
|
|
208
208
|
|
209
209
|
# frame struct is vertex, [path]
|
210
210
|
stack = [[cycle.first, []]]
|
211
|
-
while frame = stack.shift do
|
211
|
+
while frame = stack.shift do #rubocop:disable Lint/AssignmentInCondition
|
212
212
|
if frame[1].member?(frame[0]) then
|
213
213
|
found << frame[1] + [frame[0]]
|
214
214
|
break if found.length >= max_paths
|
@@ -343,7 +343,8 @@ class Puppet::Graph::SimpleGraph
|
|
343
343
|
|
344
344
|
# Find adjacent edges.
|
345
345
|
def adjacent(v, options = {})
|
346
|
-
|
346
|
+
ns = (options[:direction] == :in) ? @in_to[v] : @out_from[v]
|
347
|
+
return [] unless ns
|
347
348
|
(options[:type] == :edges) ? ns.values.flatten : ns.keys
|
348
349
|
end
|
349
350
|
|
@@ -18,8 +18,10 @@ class Puppet::Resource::Catalog::Compiler < Puppet::Indirector::Code
|
|
18
18
|
# (possibly) containing facts
|
19
19
|
# @return [Puppet::Node::Facts] facts object corresponding to facts in request
|
20
20
|
def extract_facts_from_request(request)
|
21
|
-
|
22
|
-
unless
|
21
|
+
text_facts = request.options[:facts]
|
22
|
+
return unless text_facts
|
23
|
+
format = request.options[:facts_format]
|
24
|
+
unless format
|
23
25
|
raise ArgumentError, _("Facts but no fact format provided for %{request}") % { request: request.key }
|
24
26
|
end
|
25
27
|
|
@@ -199,7 +201,8 @@ class Puppet::Resource::Catalog::Compiler < Puppet::Indirector::Code
|
|
199
201
|
sources.each do |source|
|
200
202
|
source = Puppet::Type.type(:file).attrclass(:source).normalize(source)
|
201
203
|
|
202
|
-
|
204
|
+
list_of_data = Puppet::FileServing::Metadata.indirection.search(source, options)
|
205
|
+
if list_of_data
|
203
206
|
basedir_meta = list_of_data.find {|meta| meta.relative_path == '.'}
|
204
207
|
devfail "FileServing::Metadata search should always return the root search path" if basedir_meta.nil?
|
205
208
|
|
@@ -243,7 +246,8 @@ class Puppet::Resource::Catalog::Compiler < Puppet::Indirector::Code
|
|
243
246
|
sources.each do |source|
|
244
247
|
source = Puppet::Type.type(:file).attrclass(:source).normalize(source)
|
245
248
|
|
246
|
-
|
249
|
+
data = Puppet::FileServing::Metadata.indirection.find(source, options)
|
250
|
+
if data
|
247
251
|
metadata = data
|
248
252
|
metadata.source = source
|
249
253
|
break
|
@@ -362,7 +366,8 @@ class Puppet::Resource::Catalog::Compiler < Puppet::Indirector::Code
|
|
362
366
|
# Extract the node from the request, or use the request
|
363
367
|
# to find the node.
|
364
368
|
def node_from_request(facts, request)
|
365
|
-
|
369
|
+
node = request.options[:use_node]
|
370
|
+
if node
|
366
371
|
if request.remote?
|
367
372
|
raise Puppet::Error, _("Invalid option use_node for a remote request")
|
368
373
|
else
|
@@ -378,7 +383,8 @@ class Puppet::Resource::Catalog::Compiler < Puppet::Indirector::Code
|
|
378
383
|
# node's catalog with only one certificate and a modification to auth.conf
|
379
384
|
# If no key is provided we can only compile the currently connected node.
|
380
385
|
name = request.key || request.node
|
381
|
-
|
386
|
+
node = find_node(name, request.environment, request.options[:transaction_uuid], request.options[:configured_environment], facts)
|
387
|
+
if node
|
382
388
|
return node
|
383
389
|
end
|
384
390
|
|
@@ -397,7 +403,8 @@ class Puppet::Resource::Catalog::Compiler < Puppet::Indirector::Code
|
|
397
403
|
{"servername" => "fqdn",
|
398
404
|
"serverip" => "ipaddress"
|
399
405
|
}.each do |var, fact|
|
400
|
-
|
406
|
+
value = Facter.value(fact)
|
407
|
+
if value
|
401
408
|
@server_facts[var] = value
|
402
409
|
else
|
403
410
|
Puppet.warning _("Could not retrieve fact %{fact}") % { fact: fact }
|
@@ -406,7 +413,8 @@ class Puppet::Resource::Catalog::Compiler < Puppet::Indirector::Code
|
|
406
413
|
|
407
414
|
if @server_facts["servername"].nil?
|
408
415
|
host = Facter.value(:hostname)
|
409
|
-
|
416
|
+
domain = Facter.value(:domain)
|
417
|
+
if domain
|
410
418
|
@server_facts["servername"] = [host, domain].join(".")
|
411
419
|
else
|
412
420
|
@server_facts["servername"] = host
|
@@ -9,7 +9,8 @@ class Puppet::SSL::Certificate::Rest < Puppet::Indirector::REST
|
|
9
9
|
use_srv_service(:ca)
|
10
10
|
|
11
11
|
def find(request)
|
12
|
-
|
12
|
+
result = super
|
13
|
+
return nil unless result
|
13
14
|
result.name = request.key unless result.name == request.key
|
14
15
|
result
|
15
16
|
end
|
@@ -112,8 +112,8 @@ class Puppet::Indirector::Face < Puppet::Face
|
|
112
112
|
EOT
|
113
113
|
|
114
114
|
when_invoked do |options|
|
115
|
-
if
|
116
|
-
_("Run mode '%{mode}': %{terminus}") % { mode: Puppet.run_mode.name, terminus:
|
115
|
+
if indirection.terminus_class
|
116
|
+
_("Run mode '%{mode}': %{terminus}") % { mode: Puppet.run_mode.name, terminus: indirection.terminus_class }
|
117
117
|
else
|
118
118
|
_("No default terminus class for run mode '%{mode}'") % { mode: Puppet.run_mode.name }
|
119
119
|
end
|
@@ -34,7 +34,8 @@ class Puppet::Indirector::FileServer < Puppet::Indirector::Terminus
|
|
34
34
|
|
35
35
|
# The mount checks to see if the file exists, and returns nil
|
36
36
|
# if not.
|
37
|
-
|
37
|
+
path = mount.find(relative_path, request)
|
38
|
+
return nil unless path
|
38
39
|
path2instance(request, path)
|
39
40
|
end
|
40
41
|
|
@@ -43,7 +44,8 @@ class Puppet::Indirector::FileServer < Puppet::Indirector::Terminus
|
|
43
44
|
def search(request)
|
44
45
|
mount, relative_path = configuration.split_path(request)
|
45
46
|
|
46
|
-
|
47
|
+
paths = mount.search(relative_path, request) if mount
|
48
|
+
unless paths
|
47
49
|
Puppet.info _("Could not find filesystem info for file '%{request}' in environment %{env}") % { request: request.key, env: request.environment }
|
48
50
|
return nil
|
49
51
|
end
|
@@ -29,7 +29,8 @@ class Puppet::Indirector::Indirection
|
|
29
29
|
# Find an indirected model by name. This is provided so that Terminus classes
|
30
30
|
# can specifically hook up with the indirections they are associated with.
|
31
31
|
def self.model(name)
|
32
|
-
|
32
|
+
match = @@indirections.find { |i| i.name == name }
|
33
|
+
return nil unless match
|
33
34
|
match.model
|
34
35
|
end
|
35
36
|
|
@@ -125,7 +126,8 @@ class Puppet::Indirector::Indirection
|
|
125
126
|
# Determine the terminus class.
|
126
127
|
def terminus_class
|
127
128
|
unless @terminus_class
|
128
|
-
|
129
|
+
setting = self.terminus_setting
|
130
|
+
if setting
|
129
131
|
self.terminus_class = Puppet.settings[setting]
|
130
132
|
else
|
131
133
|
raise Puppet::DevError, _("No terminus class nor terminus setting was provided for indirection %{name}") % { name: self.name}
|
@@ -163,7 +165,8 @@ class Puppet::Indirector::Indirection
|
|
163
165
|
|
164
166
|
return nil unless cache? && !request.ignore_cache_save?
|
165
167
|
|
166
|
-
|
168
|
+
instance = cache.find(request(:find, key, nil, options))
|
169
|
+
return nil unless instance
|
167
170
|
|
168
171
|
Puppet.info _("Expiring the %{cache} cache of %{instance}") % { cache: self.name, instance: instance.name }
|
169
172
|
|
@@ -233,7 +236,8 @@ class Puppet::Indirector::Indirection
|
|
233
236
|
|
234
237
|
def find_in_cache(request)
|
235
238
|
# See if our instance is in the cache and up to date.
|
236
|
-
|
239
|
+
cached = cache.find(request) if cache? && ! request.ignore_cache?
|
240
|
+
return nil unless cached
|
237
241
|
if cached.expired?
|
238
242
|
Puppet.info _("Not using expired %{indirection} for %{request} from cache; expired at %{expiration}") % { indirection: self.name, request: request.key, expiration: cached.expiration }
|
239
243
|
return nil
|
@@ -266,7 +270,8 @@ class Puppet::Indirector::Indirection
|
|
266
270
|
request = request(:search, key, nil, options)
|
267
271
|
terminus = prepare(request)
|
268
272
|
|
269
|
-
|
273
|
+
result = terminus.search(request)
|
274
|
+
if result
|
270
275
|
raise Puppet::DevError, _("Search results from terminus %{terminus_name} are not an array") % { terminus_name: terminus.name } unless result.is_a?(Array)
|
271
276
|
result.each do |instance|
|
272
277
|
next unless instance.respond_to? :expiration
|
@@ -332,7 +337,8 @@ class Puppet::Indirector::Indirection
|
|
332
337
|
# Create a new terminus instance.
|
333
338
|
def make_terminus(terminus_class)
|
334
339
|
# Load our terminus class.
|
335
|
-
|
340
|
+
klass = Puppet::Indirector::Terminus.terminus_class(self.name, terminus_class)
|
341
|
+
unless klass
|
336
342
|
raise ArgumentError, _("Could not find terminus %{terminus_class} for indirection %{indirection}") % { terminus_class: terminus_class, indirection: self.name }
|
337
343
|
end
|
338
344
|
klass.new
|
@@ -39,7 +39,8 @@ class Puppet::Node::Exec < Puppet::Indirector::Exec
|
|
39
39
|
def create_node(name, result, facts = nil)
|
40
40
|
node = Puppet::Node.new(name)
|
41
41
|
[:parameters, :classes, :environment].each do |param|
|
42
|
-
|
42
|
+
value = result[param]
|
43
|
+
if value
|
43
44
|
node.send(param.to_s + "=", value)
|
44
45
|
end
|
45
46
|
end
|
@@ -49,7 +49,8 @@ class Puppet::Transaction::Report::Processor < Puppet::Indirector::Code
|
|
49
49
|
def processors(&blk)
|
50
50
|
return [] if Puppet[:reports] == "none"
|
51
51
|
reports.each do |name|
|
52
|
-
|
52
|
+
mod = Puppet::Reports.report(name)
|
53
|
+
if mod
|
53
54
|
yield(mod)
|
54
55
|
else
|
55
56
|
Puppet.warning _("No report named '%{name}'") % { name: name }
|
@@ -99,8 +99,9 @@ class Puppet::Indirector::Request
|
|
99
99
|
end
|
100
100
|
|
101
101
|
def model
|
102
|
-
|
103
|
-
|
102
|
+
ind = indirection
|
103
|
+
raise ArgumentError, _("Could not find indirection '%{indirection}'") % { indirection: indirection_name } unless ind
|
104
|
+
ind.model
|
104
105
|
end
|
105
106
|
|
106
107
|
# Are we trying to interact with multiple resources, or just one?
|
@@ -169,7 +170,8 @@ class Puppet::Indirector::Request
|
|
169
170
|
result = options.dup
|
170
171
|
|
171
172
|
OPTION_ATTRIBUTES.each do |attribute|
|
172
|
-
|
173
|
+
value = send(attribute)
|
174
|
+
if value
|
173
175
|
result[attribute] = value
|
174
176
|
end
|
175
177
|
end
|
@@ -206,7 +208,8 @@ class Puppet::Indirector::Request
|
|
206
208
|
self.server = default_server
|
207
209
|
else
|
208
210
|
self.server = Puppet.lookup(:server) do
|
209
|
-
|
211
|
+
primary_server = Puppet.settings[:server_list][0]
|
212
|
+
if primary_server
|
210
213
|
#TRANSLATORS 'server_list' is the name of a setting and should not be translated
|
211
214
|
debug_once _("Selected server from first entry of the `server_list` setting: %{server}") % {server: primary_server[0]}
|
212
215
|
primary_server[0]
|
@@ -222,7 +225,8 @@ class Puppet::Indirector::Request
|
|
222
225
|
self.port = default_port
|
223
226
|
else
|
224
227
|
self.port = Puppet.lookup(:serverport) do
|
225
|
-
|
228
|
+
primary_server = Puppet.settings[:server_list][0]
|
229
|
+
if primary_server
|
226
230
|
#TRANSLATORS 'server_list' is the name of a setting and should not be translated
|
227
231
|
debug_once _("Selected port from the first entry of the `server_list` setting: %{port}") % {port: primary_server[1]}
|
228
232
|
primary_server[1]
|