Hi,

it is a shame, that file_line is not able to delete line on the basis of a 
substing.
Currently I use this to delete a line 
  exec { "/usr/bin/perl -ni -e '/${line}/ or print' '${file}'":
    onlyif => "${grep} -qF '${line}' '${file}'"
  }

Best regards
Andreas

Am Donnerstag, 26. Februar 2015 15:52:22 UTC+1 schrieb jcbollinger:
>
>
>
> 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 puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/c2b87e1d-dfd4-4073-b934-2c65d257c5a8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to