summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
authorMarkus Roberts <Markus@reality.com>2010-06-07 13:53:14 -0700
committertest branch <puppet-dev@googlegroups.com>2010-02-17 06:50:53 -0800
commit58a3d27f30731af6c28eebc53f85997a060edf05 (patch)
tree67c30af14126b46326cbb595dc8e901a48753cb8 /lib/puppet
parentb755f7faaf490c97223f68b3b51b3ea1e08c3547 (diff)
downloadpuppet-58a3d27f30731af6c28eebc53f85997a060edf05.tar.gz
puppet-58a3d27f30731af6c28eebc53f85997a060edf05.tar.xz
puppet-58a3d27f30731af6c28eebc53f85997a060edf05.zip
Fix for #3949 and related
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.
Diffstat (limited to 'lib/puppet')
-rw-r--r--lib/puppet/util/zaml.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/puppet/util/zaml.rb b/lib/puppet/util/zaml.rb
index dcf0e1921..b0e22a3ff 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\x0B\x0C\x0E-\x1F\x80-\xFF]/) or