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
@@ -46,10 +46,13 @@ class Puppet::Provider::ParsedFile < Puppet::Provider
|
|
46
46
|
def self.filetype=(type)
|
47
47
|
if type.is_a?(Class)
|
48
48
|
@filetype = type
|
49
|
-
elsif klass = Puppet::Util::FileType.filetype(type)
|
50
|
-
@filetype = klass
|
51
49
|
else
|
52
|
-
|
50
|
+
klass = Puppet::Util::FileType.filetype(type)
|
51
|
+
if klass
|
52
|
+
@filetype = klass
|
53
|
+
else
|
54
|
+
raise ArgumentError, _("Invalid filetype %{type}") % { type: type }
|
55
|
+
end
|
53
56
|
end
|
54
57
|
end
|
55
58
|
|
@@ -240,7 +243,8 @@ class Puppet::Provider::ParsedFile < Puppet::Provider
|
|
240
243
|
if (resource = resource_for_record(record, resources))
|
241
244
|
resource.provider = new(record)
|
242
245
|
elsif respond_to?(:match)
|
243
|
-
|
246
|
+
resource = match(record, matchers)
|
247
|
+
if resource
|
244
248
|
matchers.delete(resource.title)
|
245
249
|
record[:name] = resource[:name]
|
246
250
|
resource.provider = new(record)
|
@@ -380,7 +384,8 @@ class Puppet::Provider::ParsedFile < Puppet::Provider
|
|
380
384
|
# Lastly, check the file from any resource instances
|
381
385
|
if resources
|
382
386
|
resources.each do |name, resource|
|
383
|
-
|
387
|
+
value = resource.should(:target)
|
388
|
+
if value
|
384
389
|
targets << value
|
385
390
|
end
|
386
391
|
end
|
@@ -414,7 +419,8 @@ class Puppet::Provider::ParsedFile < Puppet::Provider
|
|
414
419
|
|
415
420
|
def create
|
416
421
|
@resource.class.validproperties.each do |property|
|
417
|
-
|
422
|
+
value = @resource.should(property)
|
423
|
+
if value
|
418
424
|
@property_hash[property] = value
|
419
425
|
end
|
420
426
|
end
|
@@ -472,7 +478,8 @@ class Puppet::Provider::ParsedFile < Puppet::Provider
|
|
472
478
|
|
473
479
|
# Mark both the resource and provider target as modified.
|
474
480
|
def mark_target_modified
|
475
|
-
|
481
|
+
restarget = @resource.should(:target) if defined?(@resource)
|
482
|
+
if restarget && restarget != @property_hash[:target]
|
476
483
|
self.class.modified(restarget)
|
477
484
|
end
|
478
485
|
self.class.modified(@property_hash[:target]) if @property_hash[:target] != :absent and @property_hash[:target]
|
@@ -76,11 +76,14 @@ Puppet::Type.type(:service).provide :base, :parent => :service do
|
|
76
76
|
else
|
77
77
|
return :stopped
|
78
78
|
end
|
79
|
-
elsif pid = getpid
|
80
|
-
self.debug "PID is #{pid}"
|
81
|
-
return :running
|
82
79
|
else
|
83
|
-
|
80
|
+
pid = getpid
|
81
|
+
if pid
|
82
|
+
self.debug "PID is #{pid}"
|
83
|
+
return :running
|
84
|
+
else
|
85
|
+
return :stopped
|
86
|
+
end
|
84
87
|
end
|
85
88
|
end
|
86
89
|
|
@@ -92,7 +92,8 @@ Puppet::Type.type(:service).provide :launchd, :parent => :base do
|
|
92
92
|
# clear out our cache when we're done.
|
93
93
|
def self.prefetch(resources)
|
94
94
|
instances.each do |prov|
|
95
|
-
|
95
|
+
resource = resources[prov.name]
|
96
|
+
if resource
|
96
97
|
resource.provider = prov
|
97
98
|
end
|
98
99
|
end
|
@@ -316,7 +317,8 @@ Puppet::Type.type(:service).provide :launchd, :parent => :base do
|
|
316
317
|
_, job_plist = plist_from_label(resource[:name])
|
317
318
|
job_plist_disabled = job_plist["Disabled"] if job_plist.has_key?("Disabled")
|
318
319
|
|
319
|
-
if FileTest.file?(self.class.launchd_overrides)
|
320
|
+
overrides = self.class.read_overrides if FileTest.file?(self.class.launchd_overrides)
|
321
|
+
if overrides
|
320
322
|
if overrides.has_key?(resource[:name])
|
321
323
|
if self.class.get_os_version < 14
|
322
324
|
overrides_disabled = overrides[resource[:name]]["Disabled"] if overrides[resource[:name]].has_key?("Disabled")
|
@@ -31,7 +31,8 @@ Puppet::Type.type(:service).provide :service do
|
|
31
31
|
|
32
32
|
# Use either a specified command or the default for our provider.
|
33
33
|
def ucommand(type, fof = true)
|
34
|
-
|
34
|
+
c = @resource[type]
|
35
|
+
if c
|
35
36
|
cmd = [c]
|
36
37
|
else
|
37
38
|
cmd = [send("#{type}cmd")].flatten
|
@@ -76,14 +76,17 @@ Puppet::Type.type(:service).provide :upstart, :parent => :debian do
|
|
76
76
|
# network-interface (lo) start/running
|
77
77
|
# network-interface (eth0) start/running
|
78
78
|
# network-interface-security start/running
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
79
|
+
matcher = line.match(/^(network-interface)\s\(([^\)]+)\)/)
|
80
|
+
name = if matcher
|
81
|
+
"#{matcher[1]} INTERFACE=#{matcher[2]}"
|
82
|
+
else
|
83
|
+
matcher = line.match(/^(network-interface-security)\s\(([^\)]+)\)/)
|
84
|
+
if matcher
|
85
|
+
"#{matcher[1]} JOB=#{matcher[2]}"
|
86
|
+
else
|
87
|
+
line.split.first
|
88
|
+
end
|
89
|
+
end
|
87
90
|
instances << new(:name => name)
|
88
91
|
}
|
89
92
|
}
|
@@ -71,7 +71,8 @@ Puppet::Type.type(:user).provide :directoryservice do
|
|
71
71
|
# takes time and front-loads your Puppet run.
|
72
72
|
def self.prefetch(resources)
|
73
73
|
instances.each do |prov|
|
74
|
-
|
74
|
+
resource = resources[prov.name]
|
75
|
+
if resource
|
75
76
|
resource.provider = prov
|
76
77
|
end
|
77
78
|
end
|
@@ -46,7 +46,7 @@ Puppet::Type.type(:user).provide :hpuxuseradd, :parent => :useradd do
|
|
46
46
|
def password
|
47
47
|
# Password management routine for trusted and non-trusted systems
|
48
48
|
#temp=""
|
49
|
-
while ent = Etc.getpwent() do
|
49
|
+
while ent = Etc.getpwent() do # rubocop:disable Lint/AssignmentInCondition
|
50
50
|
if ent.name == resource.name
|
51
51
|
temp=ent.name
|
52
52
|
break
|
@@ -34,9 +34,11 @@ Puppet::Type.type(:user).provide :ldap, :parent => Puppet::Provider::Ldap do
|
|
34
34
|
provider = self
|
35
35
|
manager.generates(:uidNumber).with do
|
36
36
|
largest = 500
|
37
|
-
|
37
|
+
existing = provider.manager.search
|
38
|
+
if existing
|
38
39
|
existing.each do |hash|
|
39
|
-
|
40
|
+
value = hash[:uid]
|
41
|
+
next unless value
|
40
42
|
num = value[0].to_i
|
41
43
|
largest = num if num > largest
|
42
44
|
end
|
@@ -56,7 +58,8 @@ Puppet::Type.type(:user).provide :ldap, :parent => Puppet::Provider::Ldap do
|
|
56
58
|
# We want to cache the current result, so we know if we
|
57
59
|
# have to remove old values.
|
58
60
|
unless @property_hash[:groups]
|
59
|
-
|
61
|
+
result = group_manager.search("memberUid=#{name}")
|
62
|
+
unless result
|
60
63
|
return @property_hash[:groups] = :absent
|
61
64
|
end
|
62
65
|
|
@@ -88,7 +91,8 @@ Puppet::Type.type(:user).provide :ldap, :parent => Puppet::Provider::Ldap do
|
|
88
91
|
end
|
89
92
|
|
90
93
|
modes.each do |group, form|
|
91
|
-
|
94
|
+
ldap_group = group_manager.find(group)
|
95
|
+
self.fail "Could not find ldap group #{group}" unless ldap_group
|
92
96
|
|
93
97
|
current = ldap_group[:members]
|
94
98
|
|
@@ -39,7 +39,8 @@ Puppet::Type.type(:user).provide :openbsd, :parent => :useradd do
|
|
39
39
|
[:expiry, :password, :loginclass].each do |shadow_property|
|
40
40
|
define_method(shadow_property) do
|
41
41
|
if Puppet.features.libshadow?
|
42
|
-
|
42
|
+
ent = Shadow::Passwd.getspnam(@resource.name)
|
43
|
+
if ent
|
43
44
|
method = self.class.option(shadow_property, :method)
|
44
45
|
# ruby-shadow may not be new enough (< 2.4.1) and therefore lack the
|
45
46
|
# sp_loginclass field.
|
@@ -31,7 +31,8 @@ Puppet::Type.type(:user).provide :pw, :parent => Puppet::Provider::NameService::
|
|
31
31
|
cmd = [command(:pw), "useradd", @resource[:name]]
|
32
32
|
@resource.class.validproperties.each do |property|
|
33
33
|
next if property == :ensure or property == :password
|
34
|
-
|
34
|
+
value = @resource.should(property)
|
35
|
+
if value and value != ""
|
35
36
|
cmd << flag(property) << munge(property,value)
|
36
37
|
end
|
37
38
|
end
|
@@ -53,7 +53,8 @@ Puppet::Type.type(:user).provide :user_role_add, :parent => :useradd, :source =>
|
|
53
53
|
# 1680 Now you can set the hashed passwords on solaris:lib/puppet/provider/user/user_role_add.rb
|
54
54
|
# the value needs to be quoted, mostly because -c might
|
55
55
|
# have spaces in it
|
56
|
-
|
56
|
+
value = @resource.should(property)
|
57
|
+
if value && value != ""
|
57
58
|
if property == :keys
|
58
59
|
cmd += build_keys_cmd(value)
|
59
60
|
else
|
@@ -99,7 +100,8 @@ Puppet::Type.type(:user).provide :user_role_add, :parent => :useradd, :source =>
|
|
99
100
|
run(transition("normal"), "transition role to")
|
100
101
|
else
|
101
102
|
run(addcmd, "create")
|
102
|
-
|
103
|
+
cmd = passcmd
|
104
|
+
if cmd
|
103
105
|
run(cmd, "change password policy for")
|
104
106
|
end
|
105
107
|
end
|
@@ -151,9 +151,11 @@ Puppet::Type.type(:user).provide :useradd, :parent => Puppet::Provider::NameServ
|
|
151
151
|
next if property_manages_password_age?(property)
|
152
152
|
next if (property == :groups) && @resource.forcelocal?
|
153
153
|
next if (property == :expiry) && @resource.forcelocal?
|
154
|
-
|
155
|
-
|
156
|
-
if
|
154
|
+
|
155
|
+
value = @resource.should(property)
|
156
|
+
if value && value != ""
|
157
|
+
# the value needs to be quoted, mostly because -c might
|
158
|
+
# have spaces in it
|
157
159
|
cmd << flag(property) << munge(property, value)
|
158
160
|
end
|
159
161
|
end
|
@@ -228,7 +230,8 @@ Puppet::Type.type(:user).provide :useradd, :parent => Puppet::Provider::NameServ
|
|
228
230
|
[:expiry, :password_min_age, :password_max_age, :password_warn_days, :password].each do |shadow_property|
|
229
231
|
define_method(shadow_property) do
|
230
232
|
if Puppet.features.libshadow?
|
231
|
-
|
233
|
+
ent = Shadow::Passwd.getspnam(@canonical_name)
|
234
|
+
if ent
|
232
235
|
method = self.class.option(shadow_property, :method)
|
233
236
|
return unmunge(shadow_property, ent.send(method))
|
234
237
|
end
|
@@ -32,7 +32,6 @@ providers = Puppet::Util::Reference.newreference :providers, :title => "Provider
|
|
32
32
|
|
33
33
|
table_data = {}
|
34
34
|
|
35
|
-
functional = false
|
36
35
|
notes = []
|
37
36
|
default = type.defaultprovider ? type.defaultprovider.name : 'none'
|
38
37
|
type.providers.sort { |a,b| a.to_s <=> b.to_s }.each do |pname|
|
@@ -41,10 +40,10 @@ providers = Puppet::Util::Reference.newreference :providers, :title => "Provider
|
|
41
40
|
provider = type.provider(pname)
|
42
41
|
|
43
42
|
# Add the suitability note
|
44
|
-
|
43
|
+
missing = provider.suitable?(false)
|
44
|
+
if missing && missing.empty?
|
45
45
|
data << "*X*"
|
46
46
|
suit = true
|
47
|
-
functional = true
|
48
47
|
else
|
49
48
|
data << "[#{count}]_" # A pointer to the appropriate footnote
|
50
49
|
suit = false
|
@@ -63,7 +63,8 @@ Puppet::Util::Reference.newreference :type, :doc => "All Puppet resource types a
|
|
63
63
|
str << scrub(type.doc) + "\n\n"
|
64
64
|
|
65
65
|
# Handle the feature docs.
|
66
|
-
|
66
|
+
featuredocs = type.featuredocs
|
67
|
+
if featuredocs
|
67
68
|
str << markdown_header("Features", 4)
|
68
69
|
str << featuredocs
|
69
70
|
end
|
@@ -79,7 +80,8 @@ Puppet::Util::Reference.newreference :type, :doc => "All Puppet resource types a
|
|
79
80
|
|
80
81
|
raise _("Could not retrieve property %{sname} on type %{type_name}") % { sname: sname, type_name: type.name } unless property
|
81
82
|
|
82
|
-
|
83
|
+
doc = property.doc
|
84
|
+
unless doc
|
83
85
|
$stderr.puts _("No docs for %{type}[%{sname}]") % { type: type, sname: sname }
|
84
86
|
next
|
85
87
|
end
|
data/lib/puppet/relationship.rb
CHANGED
@@ -19,12 +19,8 @@ class Puppet::Relationship
|
|
19
19
|
target = data['target']
|
20
20
|
|
21
21
|
args = {}
|
22
|
-
|
23
|
-
|
24
|
-
end
|
25
|
-
if callback = data["callback"]
|
26
|
-
args[:callback] = :"#{callback}"
|
27
|
-
end
|
22
|
+
args[:event] = :"#{data['event']}" if data["event"]
|
23
|
+
args[:callback] = :"#{data['callback']}" if data["callback"]
|
28
24
|
|
29
25
|
new(source, target, args)
|
30
26
|
end
|
@@ -40,9 +36,8 @@ class Puppet::Relationship
|
|
40
36
|
|
41
37
|
options = (options || {}).inject({}) { |h,a| h[a[0].to_sym] = a[1]; h }
|
42
38
|
[:callback, :event].each do |option|
|
43
|
-
|
44
|
-
|
45
|
-
end
|
39
|
+
value = options[option]
|
40
|
+
send(option.to_s + "=", value) if value
|
46
41
|
end
|
47
42
|
end
|
48
43
|
|
data/lib/puppet/resource.rb
CHANGED
@@ -44,11 +44,14 @@ class Puppet::Resource
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def initialize_from_hash(data)
|
47
|
-
|
48
|
-
raise ArgumentError, _('No resource
|
47
|
+
type = data['type']
|
48
|
+
raise ArgumentError, _('No resource type provided in serialized data') unless type
|
49
|
+
title = data['title']
|
50
|
+
raise ArgumentError, _('No resource title provided in serialized data') unless title
|
49
51
|
@type, @title = self.class.type_and_title(type, title)
|
50
52
|
|
51
|
-
|
53
|
+
params = data['parameters']
|
54
|
+
if params
|
52
55
|
params = Puppet::Pops::Serialization::FromDataConverter.convert(params)
|
53
56
|
@parameters = {}
|
54
57
|
params.each { |param, value| self[param] = value }
|
@@ -56,13 +59,15 @@ class Puppet::Resource
|
|
56
59
|
@parameters = EMPTY_HASH
|
57
60
|
end
|
58
61
|
|
59
|
-
|
62
|
+
sensitives = data['sensitive_parameters']
|
63
|
+
if sensitives
|
60
64
|
@sensitive_parameters = sensitives.map(&:to_sym)
|
61
65
|
else
|
62
66
|
@sensitive_parameters = EMPTY_ARRAY
|
63
67
|
end
|
64
68
|
|
65
|
-
|
69
|
+
tags = data['tags']
|
70
|
+
if tags
|
66
71
|
tag(*tags)
|
67
72
|
end
|
68
73
|
|
@@ -554,7 +559,8 @@ class Puppet::Resource
|
|
554
559
|
arg_types = resource_type.argument_types
|
555
560
|
# Parameters is a map from name, to parameter, and the parameter again has name and value
|
556
561
|
parameters.each do |name, value|
|
557
|
-
|
562
|
+
t = arg_types[name.to_s] # untyped, and parameters are symbols here (aargh, strings in the type)
|
563
|
+
next unless t
|
558
564
|
unless Puppet::Pops::Types::TypeCalculator.instance?(t, value.value)
|
559
565
|
inferred_type = Puppet::Pops::Types::TypeCalculator.infer_set(value.value)
|
560
566
|
actual = inferred_type.generalize()
|
@@ -657,8 +663,9 @@ class Puppet::Resource
|
|
657
663
|
h = {}
|
658
664
|
type = resource_type
|
659
665
|
if type.respond_to?(:title_patterns) && !type.title_patterns.nil?
|
660
|
-
type.title_patterns.each
|
661
|
-
|
666
|
+
type.title_patterns.each do |regexp, symbols_and_lambdas|
|
667
|
+
captures = regexp.match(title.to_s)
|
668
|
+
if captures
|
662
669
|
symbols_and_lambdas.zip(captures[1..-1]).each do |symbol_and_lambda,capture|
|
663
670
|
symbol, proc = symbol_and_lambda
|
664
671
|
# Many types pass "identity" as the proc; we might as well give
|
@@ -677,7 +684,7 @@ class Puppet::Resource
|
|
677
684
|
end
|
678
685
|
return h
|
679
686
|
end
|
680
|
-
|
687
|
+
end
|
681
688
|
# If we've gotten this far, then none of the provided title patterns
|
682
689
|
# matched. Since there's no way to determine the title then the
|
683
690
|
# resource should fail here.
|
@@ -38,14 +38,17 @@ module Puppet::Resource::CapabilityFinder
|
|
38
38
|
Puppet.debug "Could not find capability resource #{cap} in PuppetDB"
|
39
39
|
elsif resources.size == 1
|
40
40
|
resource_hash = resources.first
|
41
|
-
elsif code_id_resource = disambiguate_by_code_id(environment, code_id, cap)
|
42
|
-
resource_hash = code_id_resource
|
43
41
|
else
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
42
|
+
code_id_resource = disambiguate_by_code_id(environment, code_id, cap)
|
43
|
+
if code_id_resource
|
44
|
+
resource_hash = code_id_resource
|
45
|
+
else
|
46
|
+
#TRANSLATOR PuppetDB is a product name and should not be translated
|
47
|
+
message = _("Unexpected response from PuppetDB when looking up %{capability}:") % { capability: cap }
|
48
|
+
message += "\n" + _("expected exactly one resource but got %{count};") % { count: resources.size }
|
49
|
+
message += "\n" + _("returned data is:\n%{resources}") % { resources: resources.inspect }
|
50
|
+
raise Puppet::DevError, message
|
51
|
+
end
|
49
52
|
end
|
50
53
|
|
51
54
|
if resource_hash
|
@@ -138,7 +141,8 @@ module Puppet::Resource::CapabilityFinder
|
|
138
141
|
real_type.parameters.each do |param|
|
139
142
|
param = param.to_s
|
140
143
|
next if param == 'name'
|
141
|
-
|
144
|
+
value = resource_hash['parameters'][param]
|
145
|
+
if value
|
142
146
|
resource[param] = value
|
143
147
|
else
|
144
148
|
Puppet.debug "No capability value for #{resource}->#{param}"
|
@@ -197,7 +197,8 @@ class Puppet::Resource::Catalog < Puppet::Graph::SimpleGraph
|
|
197
197
|
# because sometimes an alias is created before the resource is
|
198
198
|
# added to the catalog, so comparing inside the below if block
|
199
199
|
# isn't sufficient.
|
200
|
-
|
200
|
+
existing = @resource_table[newref]
|
201
|
+
if existing
|
201
202
|
return if existing == resource
|
202
203
|
resource_declaration = Puppet::Util::Errors.error_location(resource.file, resource.line)
|
203
204
|
msg = if resource_declaration.empty?
|
@@ -286,10 +287,12 @@ class Puppet::Resource::Catalog < Puppet::Graph::SimpleGraph
|
|
286
287
|
|
287
288
|
# Create a new resource and register it in the catalog.
|
288
289
|
def create_resource(type, options)
|
289
|
-
|
290
|
+
klass = Puppet::Type.type(type)
|
291
|
+
unless klass
|
290
292
|
raise ArgumentError, _("Unknown resource type %{type}") % { type: type }
|
291
293
|
end
|
292
|
-
|
294
|
+
resource = klass.new(options)
|
295
|
+
return unless resource
|
293
296
|
|
294
297
|
add_resource(resource)
|
295
298
|
resource
|
@@ -342,7 +345,8 @@ class Puppet::Resource::Catalog < Puppet::Graph::SimpleGraph
|
|
342
345
|
Puppet::Type.type(:schedule).mkdefaultschedules.each { |res| add_resource(res) unless resource(res.ref) }
|
343
346
|
|
344
347
|
# And filebuckets
|
345
|
-
|
348
|
+
bucket = Puppet::Type.type(:filebucket).mkdefaultbucket
|
349
|
+
if bucket
|
346
350
|
add_resource(bucket) unless resource(bucket.ref)
|
347
351
|
end
|
348
352
|
end
|
@@ -355,7 +359,8 @@ class Puppet::Resource::Catalog < Puppet::Graph::SimpleGraph
|
|
355
359
|
ref = resource.ref
|
356
360
|
title_key = title_key_for_ref(ref)
|
357
361
|
@resource_table.delete(title_key)
|
358
|
-
|
362
|
+
aliases = @aliases[ref]
|
363
|
+
if aliases
|
359
364
|
aliases.each { |res_alias| @resource_table.delete(res_alias) }
|
360
365
|
@aliases.delete(ref)
|
361
366
|
end
|
@@ -415,45 +420,36 @@ class Puppet::Resource::Catalog < Puppet::Graph::SimpleGraph
|
|
415
420
|
def self.from_data_hash(data)
|
416
421
|
result = new(data['name'], Puppet::Node::Environment::NONE)
|
417
422
|
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
if version = data['version']
|
423
|
-
result.version = version
|
424
|
-
end
|
425
|
-
|
426
|
-
if code_id = data['code_id']
|
427
|
-
result.code_id = code_id
|
428
|
-
end
|
429
|
-
|
430
|
-
if catalog_uuid = data['catalog_uuid']
|
431
|
-
result.catalog_uuid = catalog_uuid
|
432
|
-
end
|
433
|
-
|
423
|
+
result.tag(*data['tags']) if data['tags']
|
424
|
+
result.version = data['version'] if data['version']
|
425
|
+
result.code_id = data['code_id'] if data['code_id']
|
426
|
+
result.catalog_uuid = data['catalog_uuid'] if data['catalog_uuid']
|
434
427
|
result.catalog_format = data['catalog_format'] || 0
|
435
428
|
|
436
|
-
|
429
|
+
environment = data['environment']
|
430
|
+
if environment
|
437
431
|
result.environment = environment
|
438
432
|
result.environment_instance = Puppet::Node::Environment.remote(environment.to_sym)
|
439
433
|
end
|
440
434
|
|
441
|
-
|
442
|
-
|
435
|
+
result.add_resource(
|
436
|
+
*data['resources'].collect do |res|
|
443
437
|
Puppet::Resource.from_data_hash(res)
|
444
|
-
end
|
445
|
-
|
438
|
+
end
|
439
|
+
) if data['resources']
|
446
440
|
|
447
|
-
if
|
448
|
-
edges.each do |edge_hash|
|
441
|
+
if data['edges']
|
442
|
+
data['edges'].each do |edge_hash|
|
449
443
|
edge = Puppet::Relationship.from_data_hash(edge_hash)
|
450
|
-
|
444
|
+
source = result.resource(edge.source)
|
445
|
+
unless source
|
451
446
|
raise ArgumentError, _("Could not intern from data: Could not find relationship source %{source} for %{target}") %
|
452
447
|
{ source: edge.source.inspect, target: edge.target.to_s }
|
453
448
|
end
|
454
449
|
edge.source = source
|
455
450
|
|
456
|
-
|
451
|
+
target = result.resource(edge.target)
|
452
|
+
unless target
|
457
453
|
raise ArgumentError, _("Could not intern from data: Could not find relationship target %{target} for %{source}") %
|
458
454
|
{ target: edge.target.inspect, source: edge.source.to_s }
|
459
455
|
end
|
@@ -463,15 +459,12 @@ class Puppet::Resource::Catalog < Puppet::Graph::SimpleGraph
|
|
463
459
|
end
|
464
460
|
end
|
465
461
|
|
466
|
-
|
467
|
-
result.add_class(*classes)
|
468
|
-
end
|
462
|
+
result.add_class(*data['classes']) if data['classes']
|
469
463
|
|
470
|
-
|
471
|
-
result.metadata = metadata.inject({}) { |h, (k, v)| h[k] = Puppet::FileServing::Metadata.from_data_hash(v); h }
|
472
|
-
end
|
464
|
+
result.metadata = data['metadata'].inject({}) { |h, (k, v)| h[k] = Puppet::FileServing::Metadata.from_data_hash(v); h } if data['metadata']
|
473
465
|
|
474
|
-
|
466
|
+
recursive_metadata = data['recursive_metadata']
|
467
|
+
if recursive_metadata
|
475
468
|
result.recursive_metadata = recursive_metadata.inject({}) do |h, (title, source_to_meta_hash)|
|
476
469
|
h[title] = source_to_meta_hash.inject({}) do |inner_h, (source, metas)|
|
477
470
|
inner_h[source] = metas.map {|meta| Puppet::FileServing::Metadata.from_data_hash(meta)}
|
@@ -592,7 +585,8 @@ class Puppet::Resource::Catalog < Puppet::Graph::SimpleGraph
|
|
592
585
|
# Verify that the given resource isn't declared elsewhere.
|
593
586
|
def fail_on_duplicate_type_and_title(resource, title_key)
|
594
587
|
# Short-circuit the common case,
|
595
|
-
|
588
|
+
existing_resource = @resource_table[title_key]
|
589
|
+
return unless existing_resource
|
596
590
|
|
597
591
|
# If we've gotten this far, it's a real conflict
|
598
592
|
error_location_str = Puppet::Util::Errors.error_location(existing_resource.file, existing_resource.line)
|
@@ -646,11 +640,13 @@ class Puppet::Resource::Catalog < Puppet::Graph::SimpleGraph
|
|
646
640
|
next if virtual_not_exported?(edge.target)
|
647
641
|
next if block_given? and yield edge.target
|
648
642
|
|
649
|
-
|
643
|
+
source = map[edge.source.ref]
|
644
|
+
unless source
|
650
645
|
raise Puppet::DevError, _("Could not find resource %{resource} when converting %{message} resources") % { resource: edge.source.ref, message: message }
|
651
646
|
end
|
652
647
|
|
653
|
-
|
648
|
+
target = map[edge.target.ref]
|
649
|
+
unless target
|
654
650
|
raise Puppet::DevError, _("Could not find resource %{resource} when converting %{message} resources") % { resource: edge.target.ref, message: message }
|
655
651
|
end
|
656
652
|
|