Issue #10237 has been updated by Stefan Schulte.

Description updated

I agree with you, an empty array should remove any principals that might appear 
in the file.

FWIW this is due to the way `insync?` is implemented in `puppet/property.rb`:
<pre>
172   def insync?(is)
173     self.devfail "#{self.class.name}'s should is not array" unless 
@should.is_a?(Array)
174 
175     # an empty array is analogous to no should values
176     return true if @should.empty?
177 
178     # Look for a matching value
179     return (is == @should or is == @should.collect { |v| v.to_s }) if 
match_all?
180 
181     @should.each { |val| return true if is == val or is == val.to_s }
182 
183     # otherwise, return false
184     false
185   end
</pre>

I can see two possible solutions:

- interchange line 176 and 179 (seems reasonable to me)
- use `Puppet::Property::List` instead of `Puppet::Property` and don't depend 
on `array_matching => true ` at all.
----------------------------------------
Bug #10237: An empty array of principals to k5login type does not empty the 
.k5login.
https://projects.puppetlabs.com/issues/10237

Author: Steve Traylen
Status: Unreviewed
Priority: Normal
Assignee: 
Category: 
Target version: 
Affected Puppet version: 2.6.6
Keywords: 
Branch: 


Running 2.6.6 on RHEL6.1 and starting with a non-empty /root/.k5login

    # cat /root/.k5login 
    [email protected]

The the following configuration 

    k5login {'/root/.k5login': principals => []}

Results in an unchanged /root/.k5login still containing the principal. I 
believe in this case
the file should be emptied.

In the null string case the file is emptied.

    k5login {'/root/.k5login': principals => ''}

however in the this case nothing happens

    k5login {'/root/.k5login': }

which is quite possibly correct?

Certainly the zero length array should be empty, it's important to me
since I'm returning the array from a custom function. 

Apologies for not confirming with the latest greatest puppet, I'll set
one up shortly for confirming these kind of things are still present
if they are.




-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to