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
@@ -71,7 +71,8 @@ module Puppet
|
|
71
71
|
end
|
72
72
|
|
73
73
|
def retrieve_checksum(resource)
|
74
|
-
|
74
|
+
stat = resource.stat
|
75
|
+
return :absent unless stat
|
75
76
|
ftype = stat.ftype
|
76
77
|
# Don't even try to manage the content on directories or links
|
77
78
|
return nil if ["directory","link"].include?(ftype)
|
@@ -62,9 +62,8 @@ module Puppet
|
|
62
62
|
|
63
63
|
newvalue(:file, :event => :file_created) do
|
64
64
|
# Make sure we're not managing the content some other way
|
65
|
-
|
66
|
-
|
67
|
-
elsif property = @resource.property(:checksum_value)
|
65
|
+
property = @resource.property(:content) || @resource.property(:checksum_value)
|
66
|
+
if property
|
68
67
|
property.sync
|
69
68
|
else
|
70
69
|
@resource.write
|
@@ -99,7 +98,8 @@ module Puppet
|
|
99
98
|
|
100
99
|
|
101
100
|
newvalue(:link, :event => :link_created, :required_features => :manages_symlinks) do
|
102
|
-
|
101
|
+
property = resource.property(:target)
|
102
|
+
fail "Cannot create a symlink without a target" unless property
|
103
103
|
property.retrieve
|
104
104
|
property.mklink
|
105
105
|
end
|
@@ -120,11 +120,13 @@ module Puppet
|
|
120
120
|
def change_to_s(currentvalue, newvalue)
|
121
121
|
return super unless [:file, :present].include?(newvalue)
|
122
122
|
|
123
|
-
|
123
|
+
property = @resource.property(:content)
|
124
|
+
return super unless property
|
124
125
|
|
125
126
|
# We know that content is out of sync if we're here, because
|
126
127
|
# it's essentially equivalent to 'ensure' in the transaction.
|
127
|
-
|
128
|
+
source = @resource.parameter(:source)
|
129
|
+
if source
|
128
130
|
should = source.checksum
|
129
131
|
else
|
130
132
|
should = property.should
|
@@ -166,7 +168,8 @@ module Puppet
|
|
166
168
|
end
|
167
169
|
|
168
170
|
def retrieve
|
169
|
-
|
171
|
+
stat = @resource.stat
|
172
|
+
if stat
|
170
173
|
return stat.ftype.intern
|
171
174
|
else
|
172
175
|
if self.should == :false
|
@@ -121,7 +121,8 @@ module Puppet
|
|
121
121
|
return false if munged_mode.nil?
|
122
122
|
currentvalue = munged_mode
|
123
123
|
end
|
124
|
-
|
124
|
+
stat = @resource.stat
|
125
|
+
if stat && stat.ftype == "link" && @resource[:links] != :follow
|
125
126
|
self.debug _("Not managing symlink mode")
|
126
127
|
return true
|
127
128
|
else
|
@@ -134,7 +134,8 @@ module Puppet
|
|
134
134
|
return @content if @content
|
135
135
|
raise Puppet::DevError, _("No source for content was stored with the metadata") unless metadata.source
|
136
136
|
|
137
|
-
|
137
|
+
tmp = Puppet::FileServing::Content.indirection.find(metadata.source, :environment => resource.catalog.environment_instance, :links => resource[:links])
|
138
|
+
unless tmp
|
138
139
|
self.fail "Could not find any content at %s" % metadata.source
|
139
140
|
end
|
140
141
|
@content = tmp.content
|
@@ -183,12 +184,9 @@ module Puppet
|
|
183
184
|
# if we can't find data about this host, and fail if there are any
|
184
185
|
# problems in our query.
|
185
186
|
def metadata
|
187
|
+
@metadata ||= resource.catalog.metadata[resource.title]
|
186
188
|
return @metadata if @metadata
|
187
189
|
|
188
|
-
if @metadata = resource.catalog.metadata[resource.title]
|
189
|
-
return @metadata
|
190
|
-
end
|
191
|
-
|
192
190
|
return nil unless value
|
193
191
|
value.each do |source|
|
194
192
|
begin
|
@@ -199,7 +197,8 @@ module Puppet
|
|
199
197
|
:source_permissions => resource[:source_permissions]
|
200
198
|
}
|
201
199
|
|
202
|
-
|
200
|
+
data = Puppet::FileServing::Metadata.indirection.find(source, options)
|
201
|
+
if data
|
203
202
|
@metadata = data
|
204
203
|
@metadata.source = source
|
205
204
|
break
|
@@ -286,7 +285,7 @@ module Puppet
|
|
286
285
|
|
287
286
|
def chunk_file_from_disk
|
288
287
|
File.open(full_path, "rb") do |src|
|
289
|
-
while chunk = src.read(8192)
|
288
|
+
while chunk = src.read(8192) #rubocop:disable Lint/AssignmentInCondition
|
290
289
|
yield chunk
|
291
290
|
end
|
292
291
|
end
|
data/lib/puppet/type/package.rb
CHANGED
@@ -544,12 +544,14 @@ module Puppet
|
|
544
544
|
autorequire(:file) do
|
545
545
|
autos = []
|
546
546
|
[:responsefile, :adminfile].each { |param|
|
547
|
-
|
547
|
+
val = self[param]
|
548
|
+
if val
|
548
549
|
autos << val
|
549
550
|
end
|
550
551
|
}
|
551
552
|
|
552
|
-
|
553
|
+
source = self[:source]
|
554
|
+
if source && absolute_path?(source)
|
553
555
|
autos << source
|
554
556
|
end
|
555
557
|
autos
|
@@ -557,7 +559,8 @@ module Puppet
|
|
557
559
|
|
558
560
|
# This only exists for testing.
|
559
561
|
def clear
|
560
|
-
|
562
|
+
obj = @parameters[:ensure]
|
563
|
+
if obj
|
561
564
|
obj.latest = nil
|
562
565
|
end
|
563
566
|
end
|
@@ -132,7 +132,8 @@ Puppet::Type.newtype(:resources) do
|
|
132
132
|
|
133
133
|
def resource_type
|
134
134
|
unless defined?(@resource_type)
|
135
|
-
|
135
|
+
type = Puppet::Type.type(self[:name])
|
136
|
+
unless type
|
136
137
|
raise Puppet::DevError, _("Could not find resource type")
|
137
138
|
end
|
138
139
|
@resource_type = type
|
data/lib/puppet/type/service.rb
CHANGED
data/lib/puppet/type/tidy.rb
CHANGED
@@ -118,7 +118,8 @@ Puppet::Type.newtype(:tidy) do
|
|
118
118
|
}
|
119
119
|
|
120
120
|
def convert(unit, multi)
|
121
|
-
|
121
|
+
num = AgeConvertors[unit]
|
122
|
+
if num
|
122
123
|
return num * multi
|
123
124
|
else
|
124
125
|
self.fail _("Invalid age unit '%{unit}'") % { unit: unit }
|
@@ -157,7 +158,8 @@ Puppet::Type.newtype(:tidy) do
|
|
157
158
|
be used."
|
158
159
|
|
159
160
|
def convert(unit, multi)
|
160
|
-
|
161
|
+
num = { :b => 0, :k => 1, :m => 2, :g => 3, :t => 4 }[unit]
|
162
|
+
if num
|
161
163
|
result = multi
|
162
164
|
num.times do result *= 1024 end
|
163
165
|
return result
|
@@ -236,7 +238,8 @@ Puppet::Type.newtype(:tidy) do
|
|
236
238
|
|
237
239
|
def retrieve
|
238
240
|
# Our ensure property knows how to retrieve everything for us.
|
239
|
-
|
241
|
+
obj = @parameters[:ensure]
|
242
|
+
if obj
|
240
243
|
return obj.retrieve
|
241
244
|
else
|
242
245
|
return {}
|
@@ -282,7 +285,8 @@ Puppet::Type.newtype(:tidy) do
|
|
282
285
|
|
283
286
|
files_by_name.keys.sort { |a,b| b <=> a }.each do |path|
|
284
287
|
dir = ::File.dirname(path)
|
285
|
-
|
288
|
+
resource = files_by_name[dir]
|
289
|
+
next unless resource
|
286
290
|
if resource[:require]
|
287
291
|
resource[:require] << Puppet::Resource.new(:file, path)
|
288
292
|
else
|
@@ -314,17 +318,20 @@ Puppet::Type.newtype(:tidy) do
|
|
314
318
|
# those files anyway
|
315
319
|
return false if catalog.resource(:file, path)
|
316
320
|
|
317
|
-
|
321
|
+
stat = self.stat(path)
|
322
|
+
return false unless stat
|
318
323
|
|
319
324
|
return false if stat.ftype == "directory" and ! rmdirs?
|
320
325
|
|
321
326
|
# The 'matches' parameter isn't OR'ed with the other tests --
|
322
327
|
# it's just used to reduce the list of files we can match.
|
323
|
-
|
328
|
+
param = parameter(:matches)
|
329
|
+
return false if param && ! param.tidy?(path, stat)
|
324
330
|
|
325
331
|
tested = false
|
326
332
|
[:age, :size].each do |name|
|
327
|
-
|
333
|
+
param = parameter(name)
|
334
|
+
next unless param
|
328
335
|
tested = true
|
329
336
|
return true if param.tidy?(path, stat)
|
330
337
|
end
|
data/lib/puppet/type/user.rb
CHANGED
@@ -147,7 +147,7 @@ module Puppet
|
|
147
147
|
# We know the 'is' is a number, so we need to convert the 'should' to a number,
|
148
148
|
# too.
|
149
149
|
@should.each do |value|
|
150
|
-
return true if
|
150
|
+
return true if is == Puppet::Util.gid(value)
|
151
151
|
end
|
152
152
|
|
153
153
|
false
|
@@ -156,7 +156,8 @@ module Puppet
|
|
156
156
|
def sync
|
157
157
|
found = false
|
158
158
|
@should.each do |value|
|
159
|
-
|
159
|
+
number = Puppet::Util.gid(value)
|
160
|
+
if number
|
160
161
|
provider.gid = number
|
161
162
|
found = true
|
162
163
|
break
|
@@ -444,7 +445,10 @@ module Puppet
|
|
444
445
|
autorequire(:group) do
|
445
446
|
autos = []
|
446
447
|
|
447
|
-
|
448
|
+
# autorequire primary group, if managed
|
449
|
+
obj = @parameters[:gid]
|
450
|
+
groups = obj.shouldorig if obj
|
451
|
+
if groups
|
448
452
|
groups = groups.collect { |group|
|
449
453
|
if group =~ /^\d+$/
|
450
454
|
Integer(group)
|
@@ -455,7 +459,8 @@ module Puppet
|
|
455
459
|
groups.each { |group|
|
456
460
|
case group
|
457
461
|
when Integer
|
458
|
-
|
462
|
+
resource = catalog.resources.find { |r| r.is_a?(Puppet::Type.type(:group)) && r.should(:gid) == group }
|
463
|
+
if resource
|
459
464
|
autos << resource
|
460
465
|
end
|
461
466
|
else
|
@@ -464,8 +469,13 @@ module Puppet
|
|
464
469
|
}
|
465
470
|
end
|
466
471
|
|
467
|
-
|
468
|
-
|
472
|
+
# autorequire groups, excluding primary group, if managed
|
473
|
+
obj = @parameters[:groups]
|
474
|
+
if obj
|
475
|
+
groups = obj.should
|
476
|
+
if groups
|
477
|
+
autos += groups.split(",")
|
478
|
+
end
|
469
479
|
end
|
470
480
|
|
471
481
|
autos
|
@@ -522,7 +532,9 @@ module Puppet
|
|
522
532
|
autorequire(:user) do
|
523
533
|
reqs = []
|
524
534
|
|
525
|
-
|
535
|
+
roles_property = @parameters[:roles]
|
536
|
+
roles = roles_property.should if roles_property
|
537
|
+
if roles
|
526
538
|
reqs += roles.split(',')
|
527
539
|
end
|
528
540
|
|
data/lib/puppet/util.rb
CHANGED
@@ -148,7 +148,8 @@ module Util
|
|
148
148
|
|
149
149
|
# Change the process to a different user
|
150
150
|
def self.chuser
|
151
|
-
|
151
|
+
group = Puppet[:group]
|
152
|
+
if group
|
152
153
|
begin
|
153
154
|
Puppet::Util::SUIDManager.change_group(group, true)
|
154
155
|
rescue => detail
|
@@ -161,7 +162,8 @@ module Util
|
|
161
162
|
end
|
162
163
|
end
|
163
164
|
|
164
|
-
|
165
|
+
user = Puppet[:user]
|
166
|
+
if user
|
165
167
|
begin
|
166
168
|
Puppet::Util::SUIDManager.change_user(user, true)
|
167
169
|
rescue => detail
|
@@ -324,7 +326,8 @@ module Util
|
|
324
326
|
if Puppet::Util::Platform.windows?
|
325
327
|
path = path.gsub(/\\/, '/')
|
326
328
|
|
327
|
-
|
329
|
+
unc = /^\/\/([^\/]+)(\/.+)/.match(path)
|
330
|
+
if unc
|
328
331
|
params[:host] = unc[1]
|
329
332
|
path = unc[2]
|
330
333
|
elsif path =~ /^[a-z]:\//i
|
@@ -344,7 +344,7 @@ module Puppet::Util::Checksums
|
|
344
344
|
def checksum_file(digest, filename, lite = false)
|
345
345
|
buffer = lite ? 512 : 4096
|
346
346
|
File.open(filename, 'rb') do |file|
|
347
|
-
while content = file.read(buffer)
|
347
|
+
while content = file.read(buffer) #rubocop:disable Lint/AssignmentInCondition
|
348
348
|
digest << content
|
349
349
|
break if lite
|
350
350
|
end
|
data/lib/puppet/util/classgen.rb
CHANGED
@@ -70,7 +70,8 @@ module Puppet::Util::ClassGen
|
|
70
70
|
retval = true
|
71
71
|
end
|
72
72
|
|
73
|
-
|
73
|
+
hash = options[:hash]
|
74
|
+
if hash && hash.include?(name)
|
74
75
|
hash.delete(name)
|
75
76
|
retval = true
|
76
77
|
end
|
@@ -84,7 +85,8 @@ module Puppet::Util::ClassGen
|
|
84
85
|
# Generates the constant to create or remove.
|
85
86
|
# @api private
|
86
87
|
def genconst_string(name, options)
|
87
|
-
|
88
|
+
const = options[:constant]
|
89
|
+
unless const
|
88
90
|
prefix = options[:prefix] || ""
|
89
91
|
const = prefix + name2const(name)
|
90
92
|
end
|
@@ -169,7 +171,8 @@ module Puppet::Util::ClassGen
|
|
169
171
|
def initclass(klass, options)
|
170
172
|
klass.initvars if klass.respond_to? :initvars
|
171
173
|
|
172
|
-
|
174
|
+
attrs = options[:attributes]
|
175
|
+
if attrs
|
173
176
|
attrs.each do |param, value|
|
174
177
|
method = param.to_s + "="
|
175
178
|
klass.send(method, value) if klass.respond_to? method
|
@@ -177,7 +180,8 @@ module Puppet::Util::ClassGen
|
|
177
180
|
end
|
178
181
|
|
179
182
|
[:include, :extend].each do |method|
|
180
|
-
|
183
|
+
set = options[method]
|
184
|
+
if set
|
181
185
|
set = [set] unless set.is_a?(Array)
|
182
186
|
set.each do |mod|
|
183
187
|
klass.send(method, mod)
|
@@ -197,7 +201,8 @@ module Puppet::Util::ClassGen
|
|
197
201
|
# Store the class in the appropriate places.
|
198
202
|
# @api private
|
199
203
|
def storeclass(klass, klassname, options)
|
200
|
-
|
204
|
+
hash = options[:hash]
|
205
|
+
if hash
|
201
206
|
if hash.include? klassname and ! options[:overwrite]
|
202
207
|
raise Puppet::SubclassAlreadyDefined,
|
203
208
|
_("Already a generated class named %{klassname}") % { klassname: klassname }
|
@@ -207,7 +212,8 @@ module Puppet::Util::ClassGen
|
|
207
212
|
end
|
208
213
|
|
209
214
|
# If we were told to stick it in a hash, then do so
|
210
|
-
|
215
|
+
array = options[:array]
|
216
|
+
if array
|
211
217
|
if (klass.respond_to? :name and
|
212
218
|
array.find { |c| c.name == klassname } and
|
213
219
|
! options[:overwrite])
|
@@ -93,10 +93,13 @@ module Puppet
|
|
93
93
|
end
|
94
94
|
elsif Puppet::Application.available_application_names.include?(subcommand_name)
|
95
95
|
ApplicationSubcommand.new(subcommand_name, self)
|
96
|
-
elsif path_to_subcommand = external_subcommand
|
97
|
-
ExternalSubcommand.new(path_to_subcommand, self)
|
98
96
|
else
|
99
|
-
|
97
|
+
path_to_subcommand = external_subcommand
|
98
|
+
if path_to_subcommand
|
99
|
+
ExternalSubcommand.new(path_to_subcommand, self)
|
100
|
+
else
|
101
|
+
UnknownSubcommand.new(subcommand_name, self)
|
102
|
+
end
|
100
103
|
end
|
101
104
|
end
|
102
105
|
|
@@ -121,7 +124,8 @@ module Puppet
|
|
121
124
|
# If we cannot find the configured environment, which may not exist,
|
122
125
|
# we do not attempt to add plugin directories to the load path.
|
123
126
|
unless @subcommand_name == 'master' || @subcommand_name == 'agent' || (@subcommand_name == 'device' && (['--apply', '--facts', '--resource'] - @command_line.args).empty?)
|
124
|
-
|
127
|
+
configured_environment = Puppet.lookup(:environments).get(Puppet[:environment])
|
128
|
+
if configured_environment
|
125
129
|
configured_environment.each_plugin_directory do |dir|
|
126
130
|
$LOAD_PATH << dir unless $LOAD_PATH.include?(dir)
|
127
131
|
end
|