Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-6132

Puppet::Util::Plist should emit formatted plists

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: PUP 4.4.1
    • Fix Version/s: PUP 4.5.0
    • Component/s: None
    • Labels:
      None
    • Template:
    • Acceptance Criteria:
      Hide

      Use Puppet to enable/disable a service (or manage something else with plists) and verify the updated plist file is properly formatted.

      Show
      Use Puppet to enable/disable a service (or manage something else with plists) and verify the updated plist file is properly formatted.
    • Story Points:
      1
    • Sprint:
      Client 2016-05-04
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      Puppet 4.4.0 introduced a new library for managing Mac plists, but as a side-effect it degraded formatting when updating those files. Restore prettier formatting.

      Description

      Puppet::Util::Plist's dump_plist and write_plist_file methods both emit poorly-formatted XML plists by default:

      $ ruby -e "require 'puppet';require 'puppet/util/plist'; puts Puppet::Util::Plist.dump_plist(['array','of','things'])"
      <?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"><array><string>array</string><string>of</string><string>things</string></array></plist>
      

      While this is valid XML, it's ugly. Formatted, the output should be:

      <?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">
        <array>
          <string>array</string>
          <string>of</string>
          <string>things</string>
        </array>
      </plist>
      

      Thankfully, the cfpropertylist module this depends on has a :formatted option for both .to_str and .save. Setting this to true results in properly-formatted XML.

        Attachments

          Activity

            jsd-sla-details-panel

              People

              • Assignee:
                qa qa
                Reporter:
                ccaviness Clay Caviness
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: