Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allows skipping upload of group/policy if template is explicitly 'False' #94

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jonesiscoding
Copy link
Contributor

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.

@grahampugh
Copy link
Owner

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:

  1. create_policy=True, replace_policy=False -> policy is created if it doesn't exist but not updated if it exists.
  2. create_policy=True, replace_policy=True -> policy is created if it doesn't exist and also updated if it exists.
  3. create_policy=False, replace_policy=False -> policy is neither created or updated.
  4. 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.

@grahampugh grahampugh added enhancement New feature or request question Further information is requested by the person who opened the issue labels Mar 8, 2023
@jonesiscoding
Copy link
Contributor Author

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.

@grahampugh grahampugh marked this pull request as draft June 7, 2023 14:36
tedja03 pushed a commit to tedja03/jamf-upload that referenced this pull request Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested by the person who opened the issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants