Issue #21530 has been updated by Christian Kruse.
Brian Warsing wrote: > The only question is, will it break something else? It wont break something, but it will only work on machines where neither libxml nor nokogiri is installed. I think a better solution would be a default flag in CFPropertyList. I implemented it this way: https://github.com/ckruse/CFPropertyList/commit/6e41a0cb16188cef368aeb80e42e054e18008b51 You only need to set plist.formatted = true and the plist is formatted by default ---------------------------------------- Bug #21530: cfpropertylist .to_plist method doesn't output Apple standard XML format https://projects.puppetlabs.com/issues/21530#change-95741 * 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.
