Issue #21530 has been updated by Brian Warsing.
This problem is strange, but there is maybe a better workaround. See... https://github.com/dayglojesus/facter/commit/e2bd87944c107818eb6a43e4d3458f133a9efdb3 Here, I have inverted the conditional that determines whether or not to pretty-print the XML. The XML#to_str method says it can handle a Hash of params, but there's no easy way for it to be passed in. This is not a good fix, but you can see what happens when you swap the defaults. The fix for this begins a little deeper in the stack, but if you want the default to be formatted XML, then this simple enough. It seems to me that the default *should* be properly formatted XML as Clay prescribes. The only question is, will it break something else? ---------------------------------------- Bug #21530: cfpropertylist .to_plist method doesn't output Apple standard XML format https://projects.puppetlabs.com/issues/21530#change-95703 * Author: Clay Caviness * Status: Accepted * Priority: Normal * Assignee: * Category: * Target version: * Keywords: * Branch: * Affected Facter version: ---------------------------------------- The output when using FORMAT_XML isn't in Apple style, with tab indention, but is instead all on one line. While this is valid XML, it's not pretty. We generally like to write XML plists and not binary, as they're simpler to read without extra tools. <pre> $ ruby -r facter -r facter/util/plist -e "p = {'foo'=>'bar', 'baz'=>[1,2,3]}.to_plist(); puts p" <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>baz</key> <array> <integer>1</integer> <integer>2</integer> <integer>3</integer> </array> <key>foo</key> <string>bar</string> </dict> </plist> $ facter --version 1.6.2 $ sudo pkgutil --forget com.reductivelabs.facter Forgot package 'com.reductivelabs.facter' on '/'. $ sudo installer -target / -pkg /Volumes/facter-1.7.1/facter-1.7.1.pkg installer: Package name is facter-1.7.1 installer: Installing at base path / installer: The install was successful. $ ruby -r facter -r facter/util/cfpropertylist -e "p = {'foo'=>'bar', 'baz'=>[1,2,3]}.to_plist({:plist_format=>2}); puts p" <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"><dict><key>baz</key><array><integer>1</integer><integer>2</integer><integer>3</integer></array><key>foo</key><string>bar</string></dict></plist> $ facter --version 1.7.1 </pre> -- 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 unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/groups/opt_out.
