Hi,

I am trying to manage the file authorized_keys with puppet. I am using
http://reductivelabs.com/trac/puppet/wiki/Recipes/Authorized_keys as
reference.

I was not able to delete an unwanted key from the file. Unfortuantely
there are "/" within the key:

ssh-rsa AAAAB3NzaC1yc2EAA/5GytXDjAR3XoxTR6uM= test...@test

This is a problem for the perl-command:

debug: Executing '/usr/bin/perl -ni -e 'print unless /^\Qssh-rsa
AAAAB3NzaC1yc2EAA/5GytXDjAR3XoxTR6uM= test...@test
\E$/' '/root/.ssh/authorized_keys''
err: 
//nine_authorized_keys/Nine_authorized_keys::Nine_authorized_keys::Revoke[test]/Line[remove-key-test]/Exec[remove
 from file remove-key-test]/returns: change from notrun to 0 failed: 
/usr/bin/perl -ni -e 'print unless /^\Qssh-rsa 
AAAAB3NzaC1yc2EAA/5GytXDjAR3XoxTR6uM= test...@test
\E$/' '/root/.ssh/authorized_keys' returned 255 instead of one of [0]
at /etc/puppet/development/definitions/line.pp:25

The perl-oneliner gives the following error due to the "/" in the key.

Number found where operator expected at -e line 1, near "/^\Qssh-rsa
AAAAB3NzaC1yc2EAA/5"
        (Missing operator before 5?)

In order to use /bin/sed, I have to escape the "/", wich is not a
problem. I have found a function for that in the SimpleTextRecipes.
Unfortunately, there is an "\n" at the end of the line, so that the sed
throws an error, too:

debug: Executing '/bin/sed -i '/ssh-rsa AAAAB3NzaC1yc2EAA
\/5GytXDjAR3XoxTR6uM=
test...@test                                                                    
       
/d'
'/root/.ssh/authorized_keys''                                                   
                                                                                
  
err: 
//nine_authorized_keys/Nine_authorized_keys::Nine_authorized_keys::Revoke[test]/Line[remove-key-test]/Exec[remove
 from file remove-key-test]/returns: change from notrun to 0 failed: /bin/sed 
-i '/ssh-rsa AAAAB3NzaC1yc2EAA\/5GytXDjAR3XoxTR6uM= test...@test                
                                                        
/d' '/root/.ssh/authorized_keys' returned 1 instead of one of [0]
at /etc/puppet/development/definitions/line.pp:25   

If I run the sed without the "\n" between "test...@test" and "/d'" the
sed itself works.

Can anyone give me a hint how to either make perl ignore the "/" within
the key or to get rid of the "/n" when using sed? Perl did not remove
the line if I use the escaped "/".

Greetz,
Andre

-- 
Andre Timmermann <an...@nine.ch>

-- 
Mit freundlichen Gruessen

Andre Timmermann
Nine Internet Solutions AG, Albisriederstr. 243c, CH-8047 Zuerich
Tel +41 44 637 40 00 | Direkt +41 44 637 40 06 | Fax +41 44 637 40 01

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.


Reply via email to