Skip to content
Graham Pugh edited this page Dec 14, 2020 · 6 revisions

The recipe isn't creating a policy if there is already a package on the server

Recent versions of JSSImporter do not continue if the package you are trying to upload already exists on the distribution point. This is by design, to prevent policies and smart groups being unnecessarily re-created or overwritten on scheduled AutoPkg runs when no new package exists.

This behaviour is set using the STOP_IF_NO_JSS_UPLOAD key, set to True by default.

If you need to override this behaviour to suit your workflow, or because an error occurred the first time the package was uploaded, then you have a number of options:

  1. To run an individual recipe once with the key set to False, run the following:
autopkg run -v SOME-RECIPE.jss --key STOP_IF_NO_JSS_UPLOAD=False

NOTE: You cannot pass booleans via parameters, so here the word False is a string, and is case-sensitive - only False is correct. These will NOT work: false, FALSE, 0, no, No

  1. To run a recipe list with the key set to False, run the following:
autopkg run -v --recipe-list /path/to/RECIPE-LIST.txt --key STOP_IF_NO_JSS_UPLOAD=False 

NOTE: You cannot pass booleans via parameters, so here the word False is a string, and is case-sensitive - only False is correct. These will NOT work: false, FALSE, 0, no, No

Alternatively if your recipe list is in plist format, you can add this key to the plist file:

    <key>STOP_IF_NO_JSS_UPLOAD</key>
    <false/>
  1. To permanently change an individual recipe, add this to the recipe override file (or actual recipe if you are writing your own) in the Input dictionary:
    <key>STOP_IF_NO_JSS_UPLOAD</key>
    <false/>
  1. To permanently change the behaviour of all recipes, run the following command to add the key to your AutoPkg preferences:
defaults write /Library/Preferences/com.github.autopkg.plist STOP_IF_NO_JSS_UPLOAD --bool false

NOTE: In this case, you are entering a boolean, so the following are acceptable: false, no

I'm getting an error saying that there is no requests module. What do I do?

If you're setting up JSSImporter for the first time, you might see a message like [ERROR] ImportError: No module named requests the first time you run a JSS recipe. The error message means that the requests module is not found on the Mac running a version of JSSImporter that requires it. You can install requests with pip:

sudo pip install requests

If your Mac doesn't have pip installed, it can be installed with easy_install:

sudo easy_install pip

Can I create the API user using the API?

Yes you can!

The required template is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<account>
  <name>AutoPkg</name>
  <password>%JSS_AUTOPKG_PASSWORD%</password>
  <directory_user>false</directory_user>
  <full_name>AutoPkg JSSImporter</full_name>
  <email>%EMAIL_ADDRESS%</email>
  <email_address>%EMAIL_ADDRESS%</email_address>
  <enabled>Enabled</enabled>
  <force_password_change>false</force_password_change>
  <access_level>Full Access</access_level>
  <privilege_set>Custom</privilege_set>
  <privileges>
    <jss_objects>
      <privilege/>
      <privilege>Create Categories</privilege>
      <privilege>Read Categories</privilege>
      <privilege>Update Categories</privilege>
      <privilege>Create Computer Extension Attributes</privilege>
      <privilege>Read Computer Extension Attributes</privilege>
      <privilege>Update Computer Extension Attributes</privilege>
      <privilege>Read Distribution Points</privilege>
      <privilege>Create Packages</privilege>
      <privilege>Read Packages</privilege>
      <privilege>Update Packages</privilege>
      <privilege>Create Policies</privilege>
      <privilege>Read Policies</privilege>
      <privilege>Update Policies</privilege>
      <privilege>Create Scripts</privilege>
      <privilege>Read Scripts</privilege>
      <privilege>Update Scripts</privilege>
      <privilege>Create Smart Computer Groups</privilege>
      <privilege>Read Smart Computer Groups</privilege>
      <privilege>Update Smart Computer Groups</privilege>
      <privilege>Create Static Computer Groups</privilege>
      <privilege>Read Static Computer Groups</privilege>
      <privilege>Update Static Computer Groups</privilege>
    </jss_objects>
    <jss_settings/>
    <jss_actions/>
    <recon/>
    <casper_admin/>
    <casper_remote/>
    <casper_imaging/>
  </privileges>
</account>

Substitute the values for %JSS_AUTOPKG_PASSWORD% and %EMAIL_ADDRESS% with real values.

To upload the XML template and create the user from the terminal, use the following command:

curl -s -k -i -H "Content-Type: application/xml" \
   -d @"%PATH_TO_ABOVE_XML_TEMPLATE%" \
   --user "%JSSADMINUSER%:%JSSADMINPWD%" \
   "%JSS_URL%/JSSResource/accounts/userid/0"

Substitute the values for %PATH_TO_ABOVE_XML_TEMPLATE%, %JSSADMINUSER%, %JSSADMINPWD% and %JSS_URL% with real values.