(11298) Utilize facter/util/cfpropertylist to read/write plist files on OS X#262
Closed
glarizza wants to merge 11 commits intopuppetlabs:2.7.xfrom
Closed
(11298) Utilize facter/util/cfpropertylist to read/write plist files on OS X#262glarizza wants to merge 11 commits intopuppetlabs:2.7.xfrom
glarizza wants to merge 11 commits intopuppetlabs:2.7.xfrom
Conversation
added 11 commits
December 8, 2011 10:47
Remove support for the facter/util/plist library and plutil.
Add support for CFPropertyList that will be vendored in facter/util.
If a launchd plist reports nil, skip it.
Instead of explicitly saving all plists to XML, use FORMAT_AUTO to save to their existing format.
Setting FORMAT_AUTO caused errors in Puppet. Reverting the change until it can be sorted out.
The implementation had a bug where the save method was attempted on a Hash instead of a CFPropertyList::List Plist file. This commit fixes that.
Since we no longer use Plist::Emit to save changes, the spec tests were adapted to the newer methods.
When a plist file has a bad doctype string it will still pass lint, but ruby's libxml will flag it as malformed and throw an error. This is compounded by the fact that Apple ships a plist in 10.6 that has a bad doctype string (/System/Library/LaunchDaemons/org.ntp.ntpd.plist). It's not our job to 'correct' the file, so instead a debug message is thrown, the plist file is read into a variable, and the doctype string in the variable is substituted for a correct doctype string.
The CFPropertyList library vendored in facter/util will parse plists faster than the facter/util/plist library, however if CFPropertyList isn't installed there needs to be a failback to facter/util/plist. If facter/util/cfpropertylist is installed, we will default to that behavior, but if it isn't, the $legacy_plist_support variable will be set to true and Puppet will default back to facter/util/plist library.
We've introduced facter/util/cfpropertylist as a method by which to read/save plist files, so we need to test for that. This commit adapts our tests to ultimately test for the same end-result while adjusting what Mocha expects depending on the plist library used. The $legacy_plist_support variable will be set in the launchd provider when we're using the older facter/util/plist library, so we're using the presence of that variable to indicate whether we're using the older facter/util/plist library or newer facter/util/cfpropertylist library.
Author
|
This code relies on the corresponding pull request for Facter, which is here puppetlabs/facter#109 |
Contributor
|
The pair is closed as "pending other changes, not merged", so I am going to close this off on the same basis. Sorry it took so long to get this looked at. I have no in-principal object to the change. |
hlindberg
pushed a commit
to hlindberg/puppet
that referenced
this pull request
Oct 16, 2014
minor update to event code of conduct
melissa
pushed a commit
to melissa/puppet
that referenced
this pull request
Mar 30, 2018
(PCP-174) Acceptance - refactor cert paths LGTM @ commit 8040582 I'll follow up with a PR to add the helper method to give neat test failures when retry_on fails
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CFPropertyList is a Ruby library that can read/write XML AND binary plist files without having to use the 'plutil' command on OS X. The end-result is exponentially faster Puppet runs that have to query/stop/start OS X services.
This set of commits will utilize that library if it's found in Facter, and roll back to the older facter/util/plist library should it not exist. I will be filing a pull request against Facter simultaneously.