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'=&gt;'bar', 
'baz'=&gt;[1,2,3]}.to_plist(); puts p"
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" 
"http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
&lt;plist version="1.0"&gt;
&lt;dict&gt;
  &lt;key&gt;baz&lt;/key&gt;
  &lt;array&gt;
    &lt;integer&gt;1&lt;/integer&gt;
    &lt;integer&gt;2&lt;/integer&gt;
    &lt;integer&gt;3&lt;/integer&gt;
  &lt;/array&gt;
  &lt;key&gt;foo&lt;/key&gt;
  &lt;string&gt;bar&lt;/string&gt;
&lt;/dict&gt;
&lt;/plist&gt;
$ 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'=&gt;'bar', 
'baz'=&gt;[1,2,3]}.to_plist({:plist_format=&gt;2}); puts p"
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" 
"http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
&lt;plist 
version="1.0"&gt;&lt;dict&gt;&lt;key&gt;baz&lt;/key&gt;&lt;array&gt;&lt;integer&gt;1&lt;/integer&gt;&lt;integer&gt;2&lt;/integer&gt;&lt;integer&gt;3&lt;/integer&gt;&lt;/array&gt;&lt;key&gt;foo&lt;/key&gt;&lt;string&gt;bar&lt;/string&gt;&lt;/dict&gt;&lt;/plist&gt;
$ 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.


Reply via email to