In post processing a Symbol was being passed to StringScanner.
StringScanner was not happy with this.  The error message lost
backtrace information and the test coverage was both inadequate
and broken (see #2745).

To be fully effective, this patch needs/assumes the patch for

Signed-off-by: Markus Roberts <[email protected]>
---
 lib/puppet/property.rb                             |    1 +
 lib/puppet/provider/ssh_authorized_key/parsed.rb   |   18 ++++++------------
 .../ssh_authorized_key/parsed/authorized_keys2     |    1 +
 3 files changed, 8 insertions(+), 12 deletions(-)
 create mode 100644 
test/data/providers/ssh_authorized_key/parsed/authorized_keys2

diff --git a/lib/puppet/property.rb b/lib/puppet/property.rb
index abbc71c..76c388e 100644
--- a/lib/puppet/property.rb
+++ b/lib/puppet/property.rb
@@ -144,6 +144,7 @@ class Puppet::Property < Puppet::Parameter
         rescue Puppet::Error, Puppet::DevError
             raise
         rescue => detail
+            puts detail.backtrace if Puppet[:trace]
             raise Puppet::DevError, "Could not convert change %s to string: 
%s" %
                 [self.name, detail]
         end
diff --git a/lib/puppet/provider/ssh_authorized_key/parsed.rb 
b/lib/puppet/provider/ssh_authorized_key/parsed.rb
index 6df7f8a..57dca4b 100644
--- a/lib/puppet/provider/ssh_authorized_key/parsed.rb
+++ b/lib/puppet/provider/ssh_authorized_key/parsed.rb
@@ -15,19 +15,13 @@ Puppet::Type.type(:ssh_authorized_key).provide(:parsed,
         :optional => %w{options},
         :rts => /^\s+/,
         :match    => /^(?:(.+) )?(ssh-dss|ssh-rsa) ([^ ]+)(?: (.+))?$/,
-        :post_parse => proc { |record|
-            if record[:options].nil?
-                record[:options] = [:absent]
-            else
-                record[:options] = 
Puppet::Type::Ssh_authorized_key::ProviderParsed.parse_options(record[:options])
-            end
+        :post_parse => proc { |h|
+            h[:options] ||= [:absent]
+            h[:options] = 
Puppet::Type::Ssh_authorized_key::ProviderParsed.parse_options(h[:options]) if 
h[:options].is_a? String
         },
-        :pre_gen => proc { |record|
-            if record[:options].include?(:absent)
-                record[:options] = ""
-            else
-                record[:options] = record[:options].join(',')
-            end
+        :pre_gen => proc { |h|
+            h[:options] = [] if h[:options].include?(:absent)
+            h[:options] = h[:options].join(',')
         }
 
     record_line :key_v1,
diff --git a/test/data/providers/ssh_authorized_key/parsed/authorized_keys2 
b/test/data/providers/ssh_authorized_key/parsed/authorized_keys2
new file mode 100644
index 0000000..9bf8301
--- /dev/null
+++ b/test/data/providers/ssh_authorized_key/parsed/authorized_keys2
@@ -0,0 +1 @@
+false ssh-dss 
AAAAB3NzaC1kc3MAAACBAJkupmdsJSDXfUy5EU5NTRBDr9Woo3w0YnB8KmnJW9ghU8C7SkWPB1fIHVe+esFfd3qWBseb83PoFX63geZJAg6bjV4/Rdn1zEoa9EO2QyUdYUen4+rpsh3vVKZ6HFNsn3+W5+kPYgE1F/N4INqkbjY3sqCkP/W1BL9+sbVVbuJFAAAAFQCfjWDk5XhvGUkPjNWWVqltBYzHtwAAAIEAg/XL7ky7x9Ad5banzPFAfmM+DGFe0A/JEbLDjKmr5KBM5x4RFohtEvZ8ECuVGUOqBWdgAjyYwsG4oRVjLnKrf/rgmbNRzSFgEWkcAye3BVwk7Dt6hh4knEl+mNfOLq+FH0011UhecOiqTcESMzQDtgQ1vJh2VchElBLjl3x/ZugAAACAAh5jGQC338t5ObP8trSlOefkx0sXmmEzUbo3Mt8mGUuGJPx8m+X0L8Xd+l5rQxytqE3SmV/RD+6REqBuPqHM8RQuqAzfjdOeg/Ajdggx1CRMTVhltZsgQoxO30cz9Qo0SdPoL+Jp1fLuaLZq7m/RmsWYvoLT3jebBlpvvQE8YlI=
 Francois Deppierraz
-- 
1.6.4


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" 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-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to