On Thursday, February 26, 2015 at 2:39:51 AM UTC-6, Andreas Dvorak wrote:
>
> Hi,
>
> I have just tried the stdlib version 4.5.1.
> According to the change log with version 4.5.0 
> "Don't require line to match the match parameter"
> But my test does not work
>   file_line {'test':
>     ensure => 'absent',
>     path   => '/root/.ssh/authorized_keys',
>     match  => 'test',
>   }
> Error: Failed to apply catalog: Validation of File_line[test] failed: Both 
> line and path are required attributes at 
> /data/git/test/modules/accounts/manifests/del_key_in_root.pp:204
> Wrapped exception:
> Both line and path are required attributes
>
>

You could solve that issue by providing a 'line' property with a dummy 
value, as in some of your previous attempts.  Alas, although that should 
prevent the exception, it will not get you to where you want to be.  
File_line doesn't do that.

The key thing to understand here is that File_line represents a *specific* 
line in a file.  The 'match' parameter is *not* about recognizing that 
line, it is about how to introduce it into the file if that is necessary.  
When you ensure a File_line 'absent', you are saying that the file 
identified by it's 'path' should not contain any line that is an exact, 
character-for-character match to the 'line' parameter (because *that* is 
what the resource represents).

For SSH authorized keys in particular, you should look into the built-in 
Ssh_authorized_key resource type.  More generally, if there is not already 
a module or built-in resource type specific to the file you're trying to 
manage, and you don't want to create one, then the more-or-less universal 
fallback is an Exec resource.


John

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/fce3018d-8cc6-429c-8951-736e19ee528b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to