diff options
author | Stefan Schulte <stefan.schulte@taunusstein.net> | 2010-12-05 16:25:06 +0100 |
---|---|---|
committer | Stefan Schulte <stefan.schulte@taunusstein.net> | 2010-12-23 21:27:42 +0100 |
commit | 2a0c970b8f91c9687d3f2a1dea5adac44b5f96fb (patch) | |
tree | 0f358facc3a1c075797968fa796468046a85950b /lib/puppet | |
parent | cc1f2b39a65e8b74c8e59a2bf7d8f47a35985ee4 (diff) | |
download | puppet-2a0c970b8f91c9687d3f2a1dea5adac44b5f96fb.tar.gz puppet-2a0c970b8f91c9687d3f2a1dea5adac44b5f96fb.tar.xz puppet-2a0c970b8f91c9687d3f2a1dea5adac44b5f96fb.zip |
(#5662) Parsedfile doesnt work with mult keyattr
When one wants to use the parsedfile provider for a type with more than
one key_attribute (e.g. a type for entries in /etc/services with name
and protocol as key_attributes) the provider will not store all
key_attributes in property_hash and not all keyattributes will be
visible in the to_line function.
The create method of parsedfile will only put validproperties into the
propertyhash. As result :name and all the other key_attributes will not
be set.
In the flush method however the :name parameter is put in the
property_hash but the method does not handle other keyattributes.
This patch modifies flush to put all key_attributes into the property
hash
(Note: @resource.name is basically just an alias for @resource[:name])
Diffstat (limited to 'lib/puppet')
-rwxr-xr-x | lib/puppet/provider/parsedfile.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/puppet/provider/parsedfile.rb b/lib/puppet/provider/parsedfile.rb index ffd36e59f..75a215f4b 100755 --- a/lib/puppet/provider/parsedfile.rb +++ b/lib/puppet/provider/parsedfile.rb @@ -334,7 +334,9 @@ class Puppet::Provider::ParsedFile < Puppet::Provider @property_hash[:target] = @resource.should(:target) || self.class.default_target self.class.modified(@property_hash[:target]) end - @property_hash[:name] ||= @resource.name + @resource.class.key_attributes.each do |attr| + @property_hash[attr] ||= @resource[attr] + end self.class.flush(@property_hash) |