Comments (5)
I understand the idea and the usefulness; not sure how you would implement it without making the (already somewhat complicated) recipe format even more complicated. Any ideas?
from autopkg.
Perhaps too simplistic but just a "MergeInputVariables" boolean key in the top level? If on it would use the merging algorithm for all keys in the Input section merging with the Input section of the parent receipt. If off the behavior is as it is now.
Or maybe a "multiple" type. If it's a boolean everything is merged. If it's an array then only the variables listed are merged, others are overwritten as usual. If it's a dictionary then only the subtrees of the variables are merged (but that just might be too much complication).
from autopkg.
I can see the value of being able to have this control, although I'm not sure it's worth the syntax and usage complications, at least not now.
I'm not sure I understand the idea of the MergeInputVariables key, unless you mean something like a "deep" or recursive merge of dict keys?
Probably 90% of recipes don't need to have their Munki pkginfo contents changing in between minor version updates. And when it does happen, you would still need to react and do something manually to your override in order to control which of your keys will persist.
At this point, the simplest way to have total control is to fork the recipe and maintain your own copy merging from upstream changes, and Git makes this trivial.
I could also see the idea being servicable for top-level pkginfo keys, but then you may want to also override things like installs
items, and this could just create more user confusion about at what step this can actually be handled.
from autopkg.
I hear your points. I still feel it's a useful feature. :)
Something like this:
<key>MergeInputVariablesFromParent</key>
<array>
<string>pkginfo</string>
</array>
If this is present then keys inside the local pkginfo are merged with the parent overriding any that existing in the parent.
The more complicated example could be like this:
<key>MergeInputVariablesFromParent</key>
<dict>
<key>pkginfo</key>
<array>
<string>display_name</string>
<string>catalogs</string>
</array>
</dict>
So that only the display_name and catalogs variables are merged.
Speaking more generally, though, avoiding forking would be ideal here. E.g. making less changes in Overrides and not having to fork. For the more complicated packages that have uninstall_scripts, involved installs keys, etc. just like to avoid the duplication, hard-coding, and having to manually track the upstream seems ideal.
from autopkg.
Just to put a more concrete example of what I'm proposing it looks like this in the autopkg code:
diff --git a/Code/autopkg b/Code/autopkg
index a1fbea5..058a3ff 100755
--- a/Code/autopkg
+++ b/Code/autopkg
@@ -336,8 +336,12 @@ def load_recipe(name, override_dirs, recipe_dirs,
recipe["Identifier"] = get_identifier(child_recipe)
recipe["Description"] = child_recipe.get(
"Description", recipe.get("Description", ""))
+ from Foundation import NSMutableDictionary
for key in child_recipe["Input"].keys():
- recipe["Input"][key] = child_recipe["Input"][key]
+ if child_recipe.get("MergeChildInputVariables") and isinstance(child_recipe["Input"][key], NSMutableDictionary):
+ recipe["Input"][key].update(child_recipe["Input"][key])
+ else:
+ recipe["Input"][key] = child_recipe["Input"][key]
# take the highest of the two MinimumVersion keys, if they exist
for candidate_recipe in [recipe, child_recipe]:
This makes it such that you add a boolean key to your override recipe called MergeChildInputVariables
and then your dictionary Input variables from your override are merged (Python update()
method called - which apparently is actually PyObjC over an NSMutableDictionary) into the child "real" recipe.
My practical use of this is to change (and change only) the catalogs in the pkginfo of most munki recipes. Another would be overriding Munki 2 categories in pkginfos. However I'd like to keep the descriptions, and display_names, preinstall_scripts, and all other keys of recipes in case other people change those and I don't notice.
An example override file might look like this:
<?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>Identifier</key>
<string>local.munki.VMwareTools</string>
<key>MergeChildInputVariables</key>
<true/>
<key>Input</key>
<dict>
<key>MUNKI_REPO_SUBDIR</key>
<string>my/special/place</string>
<key>NAME</key>
<string>VMwareTools</string>
<key>pkginfo</key>
<dict>
<key>catalogs</key>
<array>
<string>testing</string>
<string>development</string>
</array>
</dict>
</dict>
<key>ParentRecipe</key>
<string>com.github.jessepeterson.munki.VMwareTools</string>
</dict>
</plist>
... and because I have the MergeChildInputVariables
in this example override I get to keep all the keys in the "real" child recipe rather than duplicate and risk being possibly out of sync if the recipe ever gets changed.
from autopkg.
Related Issues (20)
- FR: Add python boto3 module for use with Jamf Pro HOT 1
- Archive vmule-recipes repository HOT 3
- Autopkg takes up to 70 min. to process recipe, no diagnostic output provided for majority of processing time HOT 8
- Error incorrect when "Ignore ownership on this volume" set on an APFS Volume
- Recipe Map doesn't locate items in `~/Library/AutoPkg/Recipes` HOT 2
- Feature Request: In versions 3.0+, make search for recipes case-insensitive again (or selectable by user?) HOT 4
- SparkleUpdateInfoProvider crashes with "AttributeError: 'str' object has no attribute 'decode'" HOT 9
- Fork jc0b-recipes HOT 5
- audit verb with plist output includes standard output
- Expose on-disk GitHub token as a variable for use in processors
- Add members to recipe repo team HOT 1
- Re-implement recipe chain trust verification
- Generating the Recipe Map for the first time is very slow
- GitHubReleasesInfoProvider additional functionality - raise a warning if a repo has been archived or disabled. HOT 2
- Add repo pandemicus-recipes HOT 1
- FR: Mark certain fields as non-logging/debug only. HOT 4
- Offering a new recipe list HOT 4
- Repo add bryanheinz-recipes HOT 2
- Add repo ccaviness-recipes HOT 3
- Trouble adding new recipes HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from autopkg.