jamf-upload
jamf-upload copied to clipboard
Allows skipping upload of group/policy if template is explicitly 'False'
The processor StopProcessingIf
is useful if one wants to stop processing if a certain condition exists, but isn't as handy if you want the rest of the recipe process to proceed except a particular step.
This change would allow a recipe to be written with multiple groups and policies, optionally skipping one or more based on Input
dictionary values, or more importantly, based on those values in an override.
In my specific use case, a custom processor is being used to evaluate a list of 'allowed' and 'required' group names obtained via recipe Input
, write custom group (using that criteria) and policy templates, then output the relevant values for use in JamfComputerGroupUploader
and JamfPolicyUploader
. With this change the processors are then be able to upload or skip the relevant groups and policies; this has cut down the complexity of our recipes and reduced the number of templates needed.
For simplicity, I evaluated the existing computergroup_template
and policy_template
arguments. Alternatively, a new argument could be added, if this was thought to be a better approach.
Hi, I guess that's an interesting idea though I'm a little reluctant to add a feature that nobody could really use without writing their own custom processor.
However, my initial thoughts are that if this was to be implemented, I would not like to use the _template
key as that's not obvious to explain, and also could not be expanded to those processors that don't use a template (e.g. category, EA, script).
What could be interesting is to have a create_policy
key (with True
as default), which would work exactly the same as the replace_policy
key but applies to the circumstance where the policy does not yet exist. (I'm sure you can see the if/else statement that checks if obj_id
is 0 (which means there is no policy yet) or greater (which means it already exists).
This would give a set of interesting options:
-
create_policy=True
,replace_policy=False
-> policy is created if it doesn't exist but not updated if it exists. -
create_policy=True
,replace_policy=True
-> policy is created if it doesn't exist and also updated if it exists. -
create_policy=False
,replace_policy=False
-> policy is neither created or updated. -
create_policy=False
,replace_policy=True
-> policy is not created if it doesn't exist but is updated if it exists.
Since this would be independent of the template key, all of the JamfUploader processor could theoretically have these options.
I like the create_policy option -- I'll update the branch in the PR accordingly, as soon as I am able. My apologies for the duplicate reply.