jssimporter / JSSImporter

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

Python Error #48

Closed JonMunford closed 9 years ago

JonMunford commented 9 years ago

Hey Shea,

I'm getting this python error. @homebysix thinks its a JSSimporter error and asked me to post this log here.

The following errors occurred:

A Python exception occurred during the execution of autopkg, see the system log for more details. [ERROR] jss.exceptions.JSSPutError: Response Code: 500 Response: Internal Server Error. The server encountered an unexpected condition which prevented it from fulfilling the request This report was generated by AutoPkgr

autopackager:jss administrator$ autopkg run -v GoogleChrome.jss Processing GoogleChrome.jss... URLDownloader URLDownloader: Item at URL is unchanged. URLDownloader: Using existing /Users/administrator/Library/AutoPkg/Cache/local.jss.GoogleChrome/downloads/GoogleChrome.dmg EndOfCheckPhase AppDmgVersioner AppDmgVersioner: Mounted disk image /Users/administrator/Library/AutoPkg/Cache/local.jss.GoogleChrome/downloads/GoogleChrome.dmg AppDmgVersioner: BundleID: com.google.Chrome AppDmgVersioner: Version: 44.0.2403.155 PkgRootCreator PkgRootCreator: Created /Users/administrator/Library/AutoPkg/Cache/local.jss.GoogleChrome/GoogleChrome PkgRootCreator: Created /Users/administrator/Library/AutoPkg/Cache/local.jss.GoogleChrome/GoogleChrome/Applications Copier Copier: Mounted disk image /Users/administrator/Library/AutoPkg/Cache/local.jss.GoogleChrome/downloads/GoogleChrome.dmg Copier: Copied /private/tmp/dmg.a4FDah/Google Chrome.app to /Users/administrator/Library/AutoPkg/Cache/local.jss.GoogleChrome/GoogleChrome/Applications/Google Chrome.app PkgCreator PkgCreator: Package already exists at path /Users/administrator/Library/AutoPkg/Cache/local.jss.GoogleChrome/GoogleChrome-44.0.2403.155.pkg. PkgCreator: Existing package matches version and identifier, not building. JSSImporter JSSImporter: Category type: category-'Browsers' already exists according to JSS, moving on... JSSImporter: Category type: policy_category-'Auto Update' 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: /Users/administrator/Library/AutoPkg/RecipeOverrides/AutoUpdateSmartGroupTemplate.xml Traceback (most recent call last): File "/usr/local/bin/autopkg", line 1651, in sys.exit(main(sys.argv)) File "/usr/local/bin/autopkg", line 1645, in main exit(subcommands[verb]'function') 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 919, in main self.groups = self.handle_groups() File "/Library/AutoPkg/autopkglib/JSSImporter.py", line 431, in handle_groups computer_group = self._add_or_update_smart_group(group) File "/Library/AutoPkg/autopkglib/JSSImporter.py", line 472, in _add_or_update_smart_group update_env="jss_group_updated", added_env="jss_group_added") File "/Library/AutoPkg/autopkglib/JSSImporter.py", line 526, in _update_or_create_new self.j.put(url, recipe_object) File "/Library/Python/2.7/site-packages/python_jss-1.2.0-py2.7.egg/jss/jss.py", line 270, in put self._error_handler(JSSPutError, response) File "/Library/Python/2.7/site-packages/python_jss-1.2.0-py2.7.egg/jss/jss.py", line 185, in _error_handler raise exception jss.exceptions.JSSPutError: Response Code: 500 Response: Internal Server Error. The server encountered an unexpected condition which prevented it from fulfilling the request

sheagcraig commented 9 years ago

Hello!

So taking a quick look at that, I see that you're using AutoUpdateSmartGroupTemplate.xml in your recipe override, and that the JSSImporter is failing with HTTP response 500 while it is trying to update a smart group.

Without the -vvvv output from AutoPkg, I can say for certain, but the first thing I would do is make sure that the XML file above correctly references the smart group's name; i.e. does the smart group's name as specified in the recipe override match what is specified as the name in the xml file (or is it substituted in).

Normally that would throw a 409 error; but otherwise I don't know what it would be. A 500 indicates a server error, which normally is "not your fault", but sometimes I see these when it gets confused about the XML that is getting sent to it.

JonMunford commented 9 years ago

Hey Shea, Here is the -vvvv output. could you take a look at it for me and see if you see anything. I see that it's not liking the AutoUpdateSmartGroupTemplate.xml but i'm not sure what to do to fix it.

autopackager:~ administrator$ autopkg run -vvvv GoogleChrome.jss Processing GoogleChrome.jss... {u'API_PASSWORD': u'XXX', u'API_USERNAME': u'XXX', 'AUTOPKG_VERSION': u'0.5.0', u'CATEGORY': u'Browsers', u'DOWNLOAD_URL': u'https://dl.google.com/chrome/mac/stable/GGRO/googlechrome.dmg', u'GIT_PATH': u'/Applications/Xcode.app/Contents/Developer/usr/bin/git', u'GROUP_NAME': u'^Google Chrome-update-smart', u'GROUP_TEMPLATE': u'/Users/administrator/Library/AutoPkg/RecipeOverrides/AutoUpdateSmartGroupTemplate.xml', u'JSS_REPOS': [{ URL = "smb://jss.new-london.k12.ia.us"; name = JSS; password = XXX; "share_name" = CasperShare; type = SMB; username = XXX; }], u'JSS_URL': u'https://jss.new-london.k12.ia.us:8443', u'JSS_VERIFY_SSL': True, u'NAME': u'Google Chrome', 'PARENT_RECIPES': [u'/Users/administrator/Library/AutoPkg/RecipeRepos/com.github.autopkg.jss-recipes/Google Chrome/Google Chrome.jss.recipe', u'/Users/administrator/Library/AutoPkg/RecipeRepos/com.github.autopkg.recipes/GoogleChrome/GoogleChrome.pkg.recipe', u'/Users/administrator/Library/AutoPkg/RecipeRepos/com.github.autopkg.recipes/GoogleChrome/GoogleChrome.download.recipe'], u'POLICY_CATEGORY': u'Auto Update', u'POLICY_TEMPLATE': u'/Users/administrator/Library/AutoPkg/RecipeOverrides/AutoUpdatePolicyTemplate.xml', 'RECIPE_CACHE_DIR': u'/Users/administrator/Library/AutoPkg/Cache/local.jss.GoogleChrome', 'RECIPE_DIR': '/Users/administrator/Library/AutoPkg/RecipeOverrides', 'RECIPE_OVERRIDE_DIRS': ['~/Library/AutoPkg/RecipeOverrides'], 'RECIPE_PATH': '/Users/administrator/Library/AutoPkg/RecipeOverrides/GoogleChrome.jss.recipe', u'RECIPE_REPOS': {u'/Users/administrator/Library/AutoPkg/RecipeRepos/com.github.autopkg.jss-recipes': { URL = "https://github.com/autopkg/jss-recipes.git"; }, u'/Users/administrator/Library/AutoPkg/RecipeRepos/com.github.autopkg.recipes': { URL = "https://github.com/autopkg/recipes.git"; }}, u'RECIPE_SEARCH_DIRS': [u'.', u'~/Library/AutoPkg/Recipes', u'/Library/AutoPkg/Recipes', u'/Users/administrator/Library/AutoPkg/RecipeRepos/com.github.autopkg.recipes', u'/Users/administrator/Library/AutoPkg/RecipeRepos/com.github.autopkg.jss-recipes', '/Users/administrator/Library/AutoPkg/RecipeOverrides', u'/Users/administrator/Library/AutoPkg/RecipeRepos/com.github.autopkg.jss-recipes/Google Chrome', u'/Users/administrator/Library/AutoPkg/RecipeRepos/com.github.autopkg.recipes/GoogleChrome'], u'SELF_SERVICE_DESCRIPTION': u'Google Chrome is a browser that combines a minimal design with sophisticated technology to make the web faster, safer, and easier.', u'SELF_SERVICE_ICON': u'Google Chrome.png', 'verbose': 4} URLDownloader {'Input': {'filename': u'Google Chrome.dmg', 'url': u'https://dl.google.com/chrome/mac/stable/GGRO/googlechrome.dmg'}} URLDownloader: Item at URL is unchanged. URLDownloader: Using existing /Users/administrator/Library/AutoPkg/Cache/local.jss.GoogleChrome/downloads/Google Chrome.dmg {'Output': {'pathname': u'/Users/administrator/Library/AutoPkg/Cache/local.jss.GoogleChrome/downloads/Google Chrome.dmg'}} EndOfCheckPhase {'Input': {}} {'Output': {}} AppDmgVersioner {'Input': {'dmg_path': u'/Users/administrator/Library/AutoPkg/Cache/local.jss.GoogleChrome/downloads/Google Chrome.dmg'}} AppDmgVersioner: Mounted disk image /Users/administrator/Library/AutoPkg/Cache/local.jss.GoogleChrome/downloads/Google Chrome.dmg AppDmgVersioner: BundleID: com.google.Chrome AppDmgVersioner: Version: 44.0.2403.155 {'Output': {'app_name': u'Google Chrome.app', 'bundleid': u'com.google.Chrome', 'version': u'44.0.2403.155'}} PkgRootCreator {'Input': {'pkgdirs': { Applications = 0775; }, 'pkgroot': u'/Users/administrator/Library/AutoPkg/Cache/local.jss.GoogleChrome/Google Chrome'}} PkgRootCreator: Created /Users/administrator/Library/AutoPkg/Cache/local.jss.GoogleChrome/Google Chrome PkgRootCreator: Creating Applications PkgRootCreator: Created /Users/administrator/Library/AutoPkg/Cache/local.jss.GoogleChrome/Google Chrome/Applications {'Output': {}} Copier {'Input': {'destination_path': u'/Users/administrator/Library/AutoPkg/Cache/local.jss.GoogleChrome/Google Chrome/Applications/Google Chrome.app', 'source_path': u'/Users/administrator/Library/AutoPkg/Cache/local.jss.GoogleChrome/downloads/Google Chrome.dmg/Google Chrome.app'}} Copier: Mounted disk image /Users/administrator/Library/AutoPkg/Cache/local.jss.GoogleChrome/downloads/Google Chrome.dmg Copier: Copied /private/tmp/dmg.mkHcrL/Google Chrome.app to /Users/administrator/Library/AutoPkg/Cache/local.jss.GoogleChrome/Google Chrome/Applications/Google Chrome.app {'Output': {}} PkgCreator {'Input': {'pkg_request': { chown = ( { group = admin; path = Applications; user = root; } ); id = "com.google.Chrome"; options = "purge_ds_store"; pkgname = "Google Chrome-44.0.2403.155"; version = "44.0.2403.155"; }}} PkgCreator: Package already exists at path /Users/administrator/Library/AutoPkg/Cache/local.jss.GoogleChrome/Google Chrome-44.0.2403.155.pkg. PkgCreator: Existing package matches version and identifier, not building. {'Output': {'pkg_path': u'/Users/administrator/Library/AutoPkg/Cache/local.jss.GoogleChrome/Google Chrome-44.0.2403.155.pkg'}} JSSImporter {'Input': {'API_PASSWORD': u'XXX', 'API_USERNAME': u'XXX', 'JSS_REPOS': [{ URL = "smb://jss.new-london.k12.ia.us"; name = JSS; password = XXX; "share_name" = CasperShare; type = SMB; username = XXX; }], 'JSS_URL': u'https://jss.new-london.k12.ia.us:8443', 'JSS_VERIFY_SSL': True, 'category': u'Browsers', 'groups': ( { name = "^Google Chrome-update-smart"; smart = 1; "template_path" = "/Users/administrator/Library/AutoPkg/RecipeOverrides/AutoUpdateSmartGroupTemplate.xml"; } ), 'pkg_path': u'/Users/administrator/Library/AutoPkg/Cache/local.jss.GoogleChrome/Google Chrome-44.0.2403.155.pkg', 'policy_category': u'Auto Update', 'policy_template': u'/Users/administrator/Library/AutoPkg/RecipeOverrides/AutoUpdatePolicyTemplate.xml', 'prod_name': u'Google Chrome', 'self_service_description': u'Google Chrome is a browser that combines a minimal design with sophisticated technology to make the web faster, safer, and easier.', 'self_service_icon': u'Google Chrome.png', 'version': u'44.0.2403.155'}} JSSImporter: No value supplied for package_info, setting default value of: JSSImporter: No value supplied for package_notes, setting default value of: JSSImporter: No value supplied for JSS_MIGRATED, setting default value of: False JSSImporter: No value supplied for os_requirements, setting default value of: JSSImporter: No value supplied for JSS_SUPPRESS_WARNINGS, setting default value of: True JSSImporter: Category type: category-'Browsers' already exists according to JSS, moving on... JSSImporter: Category type: policy_category-'Auto Update' 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: /Users/administrator/Library/AutoPkg/RecipeOverrides/AutoUpdateSmartGroupTemplate.xml Traceback (most recent call last): File "/usr/local/bin/autopkg", line 1651, in sys.exit(main(sys.argv)) File "/usr/local/bin/autopkg", line 1645, in main exit(subcommands[verb]'function') 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 919, in main self.groups = self.handle_groups() File "/Library/AutoPkg/autopkglib/JSSImporter.py", line 431, in handle_groups computer_group = self._add_or_update_smart_group(group) File "/Library/AutoPkg/autopkglib/JSSImporter.py", line 472, in _add_or_update_smart_group update_env="jss_group_updated", added_env="jss_group_added") File "/Library/AutoPkg/autopkglib/JSSImporter.py", line 526, in _update_or_create_new self.j.put(url, recipe_object) File "/Library/Python/2.7/site-packages/python_jss-1.2.1-py2.7.egg/jss/jss.py", line 270, in put self._error_handler(JSSPutError, response) File "/Library/Python/2.7/site-packages/python_jss-1.2.1-py2.7.egg/jss/jss.py", line 185, in _error_handler raise exception jss.exceptions.JSSPutError: Response Code: 500 Response: Internal Server Error. The server encountered an unexpected condition which prevented it from fulfilling the request

homebysix commented 9 years ago

@JonMunford Could you post your AutoUpdateSmartGroupTemplate.xml file, too?

JonMunford commented 9 years ago
<computer_group>
    <name>%group_name%</name>
    <is_smart>true</is_smart>
    <criteria>
            <criterion>
            <name>Application Title</name>
            <priority>0</priority>
            <and_or>and</and_or>
            <search_type>does not have</search_type>
            <value>%JSS_INVENTORY_NAME%</value>
        </criterion>
        <criterion>
            <name>Application Title</name>
            <priority>1</priority>
            <and_or>or</and_or>
            <search_type>is</search_type>
            <value>%JSS_INVENTORY_NAME%</value>
        </criterion>
        <criterion>
            <name>Application Version</name>
            <priority>2</priority>
            <and_or>and</and_or>
            <search_type>is not</search_type>
            <value>%VERSION%</value>
        </criterion>
    </criteria>
</computer_group>
homebysix commented 9 years ago

@JonMunford Could you put triple-backticks above and below? It's not parsing properly.

XML goes here
JonMunford commented 9 years ago

Thanks.. I couldn't remember how to mark it as code.

JonMunford commented 9 years ago

And here is a recipe override

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Identifier</key>
    <string>local.jss.Google Chrome</string>
    <key>Input</key>
    <dict>
        <key>CATEGORY</key>
        <string>Browsers</string>
        <key>GROUP_NAME</key>
        <string>%NAME%-update-smart</string>
        <key>GROUP_TEMPLATE</key>
        <string>AutoUpdateSmartGroupTemplate.xml</string>
        <key>POLICY_CATEGORY</key>
        <string>Auto Update</string>
        <key>POLICY_TEMPLATE</key>
        <string>AutoUpdatePolicyTemplate.xml</string>
    </dict>
    <key>ParentRecipe</key>
    <string>com.github.jss-recipes.jss.GoogleChrome</string>
</dict>
</plist>
homebysix commented 9 years ago

@JonMunford - I think line 16 of your AutoUpdateSmartGroupTemplate.xml should be <search_type>has</search_type> instead of <search_type>is</search_type>.

JonMunford commented 9 years ago

I had it "has" originally but in @sheagcraig new JSS recipe set it is now "is" by default. I'm seeing the issues either way.

JonMunford commented 9 years ago

Another symptom. If i delete all records of the policy and smart group from the JSS and then run it on AutoPkg, the policy will work just fine. How ever when I run it a second time it fails.

JonMunford commented 9 years ago

Hey @homebysix , don't work on this any more right now. I tracked it down to issues with modifying the smart groups in the jss. Even when I try to do it by hand in the JSS i get a JSS server error. I'm going to work with them for a bit.

Sorry for the goose chase this morning.

homebysix commented 9 years ago

Interesting. Sounds like you've got a JAMF support ticket in your future. Good luck!

JonMunford commented 9 years ago

Thanks @homebysix for looking at this with me. I ended up having a ghost record in my JSS that was causing conflicting smart group entries from different tables causing the error when that record was added to or removed from a smart group.

ChrisDDBAus commented 7 years ago

Thanks @JonMunford has instead of is. Has changed my life. This problem was driving me to the looney bin ;)

JSS importer could not change existing groups. New ones were fine. The same issues reported here, thanks mate.