Syck/Yaml quietly passes on undefined classes as strings, so that if objects
of those classes are loaded and re-serialized they passthrough unmodified.
While not technically correct, it's still the POLS behavior, and we now support
it.

Signed-off-by: Markus Roberts <[email protected]>
---
 lib/puppet/util/zaml.rb |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/puppet/util/zaml.rb b/lib/puppet/util/zaml.rb
index 22045e1..8762703 100644
--- a/lib/puppet/util/zaml.rb
+++ b/lib/puppet/util/zaml.rb
@@ -121,7 +121,8 @@ class Object
         instance_variables.sort        # Default YAML behavior
     end
     def zamlized_class_name(root)
-        "!ruby/#{root.name.downcase}#{self.class == root ? '' : 
":#{self.class.name}"}"
+        cls = self.class
+        "!ruby/#{root.name.downcase}#{cls == root ? '' : 
":#{cls.respond_to?(:name) ? cls.name : cls}"}"
     end
     def to_zaml(z)
         z.first_time_only(self) {
@@ -231,7 +232,7 @@ class String
               when (
                     (self =~ 
/\A(true|false|yes|no|on|null|off|#{num}(:#{num})*|!|=|~)$/i) or 
                     (self =~ /\A\n* /) or
-                    (self =~ /\s$/) or
+                    (self =~ /[\s:]$/) or
                     (self =~ /^[>|][-+\d]*\s/i) or
                     (self[-1..-1] =~ /\s/) or 
                     (self =~ /[\x00-\x08\x0A-\x1F\x80-\xFF]/) or
-- 
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