grahampugh / jamf-upload

Scripts for uploading packages to Jamf Cloud
Apache License 2.0
149 stars 37 forks source link

create multiple policies with JamfPolicyUploader #95

Closed user1233445 closed 1 year ago

user1233445 commented 1 year ago

Hi Guys,

I'm trying to create one jamf recipe, which creates one jamf patch policy and two normal policies. Is it possible to create two policies with one jamf recipe? The reason I ask is that I got an error message as soon as I add the second JamfPolicyUploader:

The following recipes failed: local.jamf.RocketChat Error in local.jamf.RocketChat: Processor: com.github.grahampugh.jamf-upload.processors/JamfPolicyUploader: Error: 'NoneType' object has no attribute 'startswith'

The processors in my recipe:

- Processor: com.github.grahampugh.jamf-upload.processors/JamfPolicyUploader
  Arguments:
    provisioning_policy_name: '%PROVISIONING_POLICY_NAME%'
    provisioning_trigger: '%PROVISIONING_TRIGGER%'
    provisioning_category: '%PROVISIONING_CATEGORY%'
    provisioning_policy_template: '%PROVISIONING_POLICY_TEMPLATE%'
    replace_policy: 'true'
- Processor: com.github.grahampugh.jamf-upload.processors/JamfPolicyUploader
  Arguments:
    icon: '%SELFSERVICE_ICON%'
    policy_name: '%SELFSERVICE_POLICY_NAME%'
    selfserivce_category: '%SELFSERVICE_CATEGORY%'
    selfservice_display_name: '%SELFSERVICE_DISPLAY_NAME%'
    selfservice_description: '%SELFSERVICE_DESCRIPTION%'
    selfservice_main_page: '%SELFSERVICE_MAIN_PAGE%'
    selfservice_force_description: '%SELFSERVICE_FORCE_DESCRIPTION%'
    policy_template: '%SELFSERVICE_POLICY_TEMPLATE%'
    replace_policy: 'true'
    replace_icon: 'true'

Best regards

grahampugh commented 1 year ago

Hi @user1233445 yes it's perfectly possible to make multiple policies in a single recipe. Based on what error you have mentioned, my guess is that you have not provided one of the substituted keys, but you can normally figure out yourself what you missed out if you run the recipe with -vv level of verbosity.

user1233445 commented 1 year ago

Hi @grahampugh , thank you for your fast reply. I did run the recipe with -vv and I got the following reply:

JamfPolicyUploader: No value supplied for policy_name, setting default value of: 
JamfPolicyUploader: No value supplied for icon, setting default value of: 
JamfPolicyUploader: No value supplied for replace_icon, setting default value of: False
'NoneType' object has no attribute 'startswith'
Failed.

Do you have an idea where the problem could be?

grahampugh commented 1 year ago

startswith is only present in two places in JamfPolicyUploader: when checking the policy_template key and when checking the icon key. So I guess you have not supplied one or other of these correctly.

user1233445 commented 1 year ago

I found my mistake. Thank you for your help!