jssimporter / JSSImporter

JSSImporter is deprecated. Please see the wiki for alternatives
Apache License 2.0
145 stars 38 forks source link

If a script's category doesn't exist, JSSImporter fails with response code 409. #55

Closed homebysix closed 7 years ago

homebysix commented 9 years ago

When running a recipe for which a ScriptTemplate.xml is defined and contains <category>Foo</category>, if the Foo category doesn't already exist, the recipe run fails.

This is in contrast to policy categories, which are created automatically if they don't already exist.

I ran three times in a row just to make sure this wasn't a one-off error, and it occurred the same way each time. Upon creating the Foo category manually on the JSS and running the recipe again, the recipe succeeded.

The JSSImporter output plus traceback is below.

JSSImporter
JSSImporter: Category type: category-'Productivity' already exists according to JSS, moving on...
JSSImporter: Category type: policy_category-'Testing' already exists according to JSS, moving on...
JSSImporter: Pkg-object already exists according to JSS, moving on...
JSSImporter: Package upload not needed.
JSSImporter: Found file: .../TextExpanderSmartGroupTemplate-testing.xml
JSSImporter: ComputerGroup: TextExpander-testing updated.
JSSImporter: Found file: .../TextExpander_licensing_script.sh
JSSImporter: Found file: .../TextExpanderScriptTemplate.xml
Traceback (most recent call last):
  File "/usr/local/bin/autopkg", line 1651, in <module>
    sys.exit(main(sys.argv))
  File "/usr/local/bin/autopkg", line 1645, in main
    exit(subcommands[verb]['function'](argv))
  File "/usr/local/bin/autopkg", line 1458, in run_recipes
    autopackager.process(recipe)
  File "/Library/AutoPkg/autopkglib/__init__.py", line 470, in process
    self.env = processor.process()
  File "/Library/AutoPkg/autopkglib/__init__.py", line 299, in process
    self.main()
  File "/Library/AutoPkg/autopkglib/JSSImporter.py", line 920, in main
    self.scripts = self.handle_scripts()
  File "/Library/AutoPkg/autopkglib/JSSImporter.py", line 671, in handle_scripts
    update_env="jss_script_updated")
  File "/Library/AutoPkg/autopkglib/JSSImporter.py", line 534, in _update_or_create_new
    recipe_object.save()
  File "/Library/Python/2.7/site-packages/jss/jss.py", line 686, in save
    raise JSSPostError(e)
jss.exceptions.JSSPostError: Response Code: 409 Response: Conflict. Error: Problem with category name
sheagcraig commented 8 years ago

Good eyes sir. Add it to the list for the next release!

sheagcraig commented 7 years ago

This should be resolved in 1.0.0 (currently the testing branch). Let me know if it doesn't work and I'll reinvestigate.