Issue #4488 has been updated by Alan Barrett.

I have the following change, which allows unrecognised lines to be passed 
through unmolested.

<pre>
--- puppet-0.25.5/lib/puppet/provider/ssh_authorized_key/parsed.rb   Mon May 17 
06:10:24 2010
+++ new/lib/puppet/provider/ssh_authorized_key/parsed.rb        Thu Jun 17 
14:59:02 2010
@@ -14,7 +14,11 @@
         :fields   => %w{options type key name},
         :optional => %w{options},
         :rts => /^\s+/,
-        :match    => /^(?:(.+) )?(ssh-dss|ssh-rsa) ([^ ]+) ?(.*)$/,
+        # The name field is not optional here.  Lines without a name
+        # will be matched by the "text_line :unrecognised" rule instead.
+        # (Do not change the (.+) at the end to (.*), or make the preceding
+        # space optional.)
+        :match    => /^(?:(.+) )?(ssh-dss|ssh-rsa) ([^ ]+) (.+)$/,
         :post_parse => proc { |h|
             h[:name] = "" if h[:name] == :absent
             h[:options] ||= [:absent]
@@ -30,6 +34,8 @@
         :optional => %w{options},
         :rts      => /^\s+/,
         :match    => /^(?:(.+) )?(\d+) (\d+) (\d+)(?: (.+))?$/
+
+    text_line :unrecognised, :match => //

     def dir_perm
         # Determine correct permission for created directory and file
</pre>

The :unrecognised rule should probably be in a parent class instead of in the 
ssh_authorized_keys provider.  The part about making the name field compulsory 
is there to deal with errors (whose details I do not remember) where some other 
part of puppet was unhappy about having the empty string as the name of a 
resource.
----------------------------------------
Bug #4488: ssh_authorized_key trips over comments in file
http://projects.puppetlabs.com/issues/4488

Author: martin krafft
Status: Accepted
Priority: Normal
Assigned to: 
Category: ssh
Target version: Statler
Affected version: 0.25.4
Keywords: ssh_authorized_key parser comments
Branch: 


I am getting:

<pre>
err: Could not prefetch ssh_authorized_key provider 'parsed': Could not parse 
line "" at /root/.ssh/authorized_keys:4
</pre>

This is due to the fact that I use comments in the authorized_keys file, which 
I assemble automatically:

<pre>
% sed -ne 4p /root/.ssh/authorized_keys
### from authorized_keys.d/[email protected]:
</pre>

Please use a more robust way to scan for puppet comments.



-- 
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