lindegroup / autopkgr

AutoPkgr is a free Mac app that makes it easy to install and configure AutoPkg.
http://www.lindegroup.com/autopkgr
Apache License 2.0
531 stars 51 forks source link

Using Autopkgr for the first time #642

Closed imasupersadpanda closed 4 years ago

imasupersadpanda commented 4 years ago

Going through the overview put together by homebysix here: https://github.com/homebysix/auto-update-magic#overview

When I run the Firefox-testing.jss recipe, I receive the following error: Traceback (most recent call last): File "/Library/AutoPkg/autopkglib/init.py", line 673, in process self.env = processor.process() File "/Library/AutoPkg/autopkglib/init.py", line 480, in process self.main() File "/Library/AutoPkg/autopkglib/JSSImporter.py", line 1203, in main self.create_jss() File "/Library/AutoPkg/autopkglib/JSSImporter.py", line 354, in create_jss self.jss = jss.JSS(**kwargs) File "/Library/AutoPkg/JSSImporter/jss/jamf_software_server.py", line 206, in init self.distribution_points = DistributionPoints(self) File "/Library/AutoPkg/JSSImporter/jss/distribution_points.py", line 81, in init self.dp_info = self.jss.DistributionPoint() File "/Library/AutoPkg/JSSImporter/jss/jamf_software_server.py", line 694, in api_method if data.find("size") is not None: TypeError: argument should be integer or bytes-like object, not 'str' File "/Library/AutoPkg/autopkglib/init.py", line 673, in process self.env = processor.process() argument should be integer or bytes-like object, not 'str' Failed. Receipt written to /Users/superpanda/Library/AutoPkg/Cache/local.jss.Firefox-testing/receipts/Firefox-testing-receipt-20200412-132046.plist

The following recipes failed: Firefox-testing.jss Error in local.jss.Firefox-testing: Processor: JSSImporter: Error: argument should be integer or bytes-like object, not 'str'

Note: My JSS uses a CDP provided by AWS.

shawnhonsberger commented 4 years ago

Hi @imasupersadpanda. Can you please tell me which version you are using of the following:

Thanks!

imasupersadpanda commented 4 years ago

Surely.

AutoPkgr: 1.5.2 AutoPkg: 2.0.2 JSSImporter: 1.1.0

shawnhonsberger commented 4 years ago

Thanks. Do you get the same issue when you run it via command line? e.g. autopkg run -vv /path/to/recipe/override?

imasupersadpanda commented 4 years ago

I actually was running it by command line, just without -vv:

autopkg run -v Firefox-testing.jss

Adding that second v in there resulted in the same error, just with more verbosity.

output.txt

shawnhonsberger commented 4 years ago

Can you post a sanitized version of your AutoPkg preferences? e.g. defaults read com.github.autopkg

imasupersadpanda commented 4 years ago

Yep, here you go. autopkg-prefs.txt

shawnhonsberger commented 4 years ago

@imasupersadpanda Can you please post these outputs inline in text? Thank you.

imasupersadpanda commented 4 years ago

I'm sorry, I don't understand. Is the output supplied not making sense?

shawnhonsberger commented 4 years ago

Thanks, @imasupersadpanda. I would prefer to read it in line, rather than download it. Also, when does this happen e.g. every time, auto-run only, etc?

shawnhonsberger commented 4 years ago

@imasupersadpanda I would remove the ?failover from your CDP url, then save. If AutoPkgr prompts you, you can select ignore. Please let me know how it goes after that change. Thanks!

imasupersadpanda commented 4 years ago

Output of my AutoPkg prefs:

superpanda@ML-C02XC4RCJG5L ~ % defaults read com.github.autopkg { "API_PASSWORD" = [sanitized]; "API_USERNAME" = autopkg; "GIT_PATH" = "/usr/local/git/bin/git"; "JSS_REPOS" = ( { type = CDP; } ); "JSS_URL" = "https://myjssinstance.com:8443/?failover"; "JSS_VERIFY_SSL" = 1; "RECIPE_REPOS" = { "/Users/superpanda/Library/AutoPkg/RecipeRepos/com.github.autopkg.jss-recipes" = { URL = "https://github.com/autopkg/jss-recipes.git"; }; "/Users/superpanda/Library/AutoPkg/RecipeRepos/com.github.autopkg.recipes" = { URL = "https://github.com/autopkg/recipes.git"; }; }; "RECIPE_SEARCH_DIRS" = ( ".", "~/Library/AutoPkg/Recipes", "/Library/AutoPkg/Recipes", "/Users/superpanda/Library/AutoPkg/RecipeRepos/com.github.autopkg.recipes", "/Users/superpanda/Library/AutoPkg/RecipeRepos/com.github.autopkg.jss-recipes" ); } superpanda@ML-C02XC4RCJG5L ~ %

Yes, this happens every time I run the command.

We need to use the ?failover login area as we normally use SSO to access the Jamf Pro UI. I'd need to create an SSO-enabled service account in AD in order to use the normal initial login page.

shawnhonsberger commented 4 years ago

Thanks @imasupersadpanda. You don't actually need the ?failover in your CDP url in your AutoPkg preferences, even with SSO enabled. Try saving without it, then when AutoPkgr prompts you, select Ignore and try it out.

Please note, if you are using Jamf Cloud, you can also remove the :8443/.

imasupersadpanda commented 4 years ago

Got it. Made the change to JSSImporter config (removing the ?failover portion of the URL) and chose ignore when prompted. FYI, our Jamf instance is on-prem.

When running the command I still get an error, but I'm not sure whether the error is expected or not since I don't know whether some earlier recipe was supposed to have created the noted missing smart group. Thoughts?

Warning: Ton of output incoming...

superpanda@ML-C02XC4RCJG5L ~ % autopkg run -vv Firefox-testing.jss Processing Firefox-testing.jss... MozillaURLProvider {'Input': {'locale': 'en-US', 'product_name': 'firefox', 'release': 'latest'}} MozillaURLProvider: Found URL https://download.mozilla.org/?product=firefox-latest&os=osx&lang=en-US {'Output': {'url': 'https://download.mozilla.org/?product=firefox-latest&os=osx&lang=en-US'}} URLDownloader {'Input': {'filename': 'Firefox.dmg', 'url': 'https://download.mozilla.org/?product=firefox-latest&os=osx&lang=en-US'}} URLDownloader: No value supplied for prefetch_filename, setting default value of: False URLDownloader: No value supplied for CHECK_FILESIZE_ONLY, setting default value of: False URLDownloader: Item at URL is unchanged. URLDownloader: Using existing /Users/superpanda/Library/AutoPkg/Cache/local.jss.Firefox-testing/downloads/Firefox.dmg {'Output': {'pathname': '/Users/superpanda/Library/AutoPkg/Cache/local.jss.Firefox-testing/downloads/Firefox.dmg'}} EndOfCheckPhase {'Input': {}} {'Output': {}} CodeSignatureVerifier {'Input': {'DISABLE_CODE_SIGNATURE_VERIFICATION': False, 'input_path': '/Users/superpanda/Library/AutoPkg/Cache/local.jss.Firefox-testing/downloads/Firefox.dmg/Firefox.app', 'requirement': 'anchor apple generic and certificate ' 'leaf[field.1.2.840.113635.100.6.1.9] / exists / ' 'or anchor apple generic and certificate ' '1[field.1.2.840.113635.100.6.2.6] / exists / and ' 'certificate leaf[field.1.2.840.113635.100.6.1.13] ' '/ exists / and certificate leaf[subject.OU] = ' '"43AQ936H96"'}} CodeSignatureVerifier: Mounted disk image /Users/superpanda/Library/AutoPkg/Cache/local.jss.Firefox-testing/downloads/Firefox.dmg CodeSignatureVerifier: Using path '/private/tmp/dmg.NEwSbU/Firefox.app' matched from globbed '/private/tmp/dmg.NEwSbU/Firefox.app'. CodeSignatureVerifier: Verifying code signature... CodeSignatureVerifier: Deep verification enabled... CodeSignatureVerifier: Strict verification not defined. Using codesign defaults... CodeSignatureVerifier: /private/tmp/dmg.NEwSbU/Firefox.app: valid on disk CodeSignatureVerifier: /private/tmp/dmg.NEwSbU/Firefox.app: satisfies its Designated Requirement CodeSignatureVerifier: /private/tmp/dmg.NEwSbU/Firefox.app: explicit requirement satisfied CodeSignatureVerifier: Signature is valid {'Output': {}} AppDmgVersioner {'Input': {'dmg_path': '/Users/superpanda/Library/AutoPkg/Cache/local.jss.Firefox-testing/downloads/Firefox.dmg'}} AppDmgVersioner: Mounted disk image /Users/superpanda/Library/AutoPkg/Cache/local.jss.Firefox-testing/downloads/Firefox.dmg AppDmgVersioner: BundleID: org.mozilla.firefox AppDmgVersioner: Version: 75.0 {'Output': {'app_name': 'Firefox.app', 'bundleid': 'org.mozilla.firefox', 'version': '75.0'}} PkgRootCreator {'Input': {'pkgdirs': {'Applications': '0775'}, 'pkgroot': '/Users/superpanda/Library/AutoPkg/Cache/local.jss.Firefox-testing/Firefox'}} PkgRootCreator: Created /Users/superpanda/Library/AutoPkg/Cache/local.jss.Firefox-testing/Firefox PkgRootCreator: Creating Applications PkgRootCreator: Created /Users/superpanda/Library/AutoPkg/Cache/local.jss.Firefox-testing/Firefox/Applications {'Output': {}} Copier {'Input': {'destination_path': '/Users/superpanda/Library/AutoPkg/Cache/local.jss.Firefox-testing/Firefox/Applications/Firefox.app', 'source_path': '/Users/superpanda/Library/AutoPkg/Cache/local.jss.Firefox-testing/downloads/Firefox.dmg/Firefox.app'}} Copier: Parsed dmg results: dmg_path: /Users/superpanda/Library/AutoPkg/Cache/local.jss.Firefox-testing/downloads/Firefox.dmg, dmg: .dmg/, dmg_source_path: Firefox.app Copier: Mounted disk image /Users/superpanda/Library/AutoPkg/Cache/local.jss.Firefox-testing/downloads/Firefox.dmg Copier: Copied /private/tmp/dmg.fBzU7C/Firefox.app to /Users/superpanda/Library/AutoPkg/Cache/local.jss.Firefox-testing/Firefox/Applications/Firefox.app {'Output': {}} PkgCreator {'Input': {'pkg_request': {'chown': [{'group': 'admin', 'path': 'Applications', 'user': 'root'}], 'id': 'org.mozilla.firefox.pkg', 'options': 'purge_ds_store', 'pkgdir': '/Users/superpanda/Library/AutoPkg/Cache/local.jss.Firefox-testing'}}} PkgCreator: Package already exists at path /Users/superpanda/Library/AutoPkg/Cache/local.jss.Firefox-testing/Firefox-75.0.pkg. PkgCreator: Existing package matches version and identifier, not building. {'Output': {'pkg_path': '/Users/superpanda/Library/AutoPkg/Cache/local.jss.Firefox-testing/Firefox-75.0.pkg'}} JSSImporter {'Input': {'API_PASSWORD': 'UuRPDDNXMqbmwUATZ3NEXnq8yv7qdbW', 'API_USERNAME': 'autopkg', 'JSS_REPOS': [{'type': 'CDP'}], 'JSS_URL': 'https://[sanitized]:8443/', 'JSS_VERIFY_SSL': True, 'category': 'Web Browsers', 'groups': [{'name': 'Firefox-update-smart', 'smart': True, 'template_path': 'SmartGroupTemplate.xml'}], 'pkg_path': '/Users/superpanda/Library/AutoPkg/Cache/local.jss.Firefox-testing/Firefox-75.0.pkg', 'policy_category': 'Testing', 'policy_template': 'PolicyTemplate.xml', 'prod_name': 'Firefox', 'self_service_description': 'Mozilla Firefox is a free and open ' 'source web browser.', 'self_service_icon': 'Firefox.png', 'version': '75.0'}} JSSImporter: No value supplied for JSS_SUPPRESS_WARNINGS, setting default value of: True JSSImporter: No value supplied for force_policy_state, setting default value of: True JSSImporter: No value supplied for os_requirements, setting default value of: 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 package_priority, setting default value of: 10 JSSImporter: No value supplied for package_reboot, setting default value of: False JSSImporter: No value supplied for package_boot_volume_required, setting default value of: True JSSImporter: No value supplied for policy_action_type, setting default value of: Install JSSImporter: No value supplied for STOP_IF_NO_JSS_UPLOAD, setting default value of: True JSSImporter: No value supplied for skip_scope, setting default value of: False JSSImporter: No value supplied for skip_scripts, setting default value of: False JSSImporter: python-jss version: 2.1. JSSImporter: JSSImporter version: 1.1.0. JSSImporter: Jamf Pro version: '10.17.1-t1574185757' JSSImporter: Category ID '17' verified on server JSSImporter: Category, type 'category', name 'Web Browsers', created. JSSImporter: Category, type 'policy_category', name 'Testing', already exists on the Jamf Pro server, moving on... JSSImporter: Checking if DP already mounted... JSSImporter: Package object does not already exist on the Jamf Pro server. JSSImporter: Copying /Users/superpanda/Library/AutoPkg/Cache/local.jss.Firefox-testing/Firefox-75.0.pkg to all distribution points. JSSImporter: Copying to https://[sanitized]:8443 JSSImporter: Copied '/Users/superpanda/Library/AutoPkg/Cache/local.jss.Firefox-testing/Firefox-75.0.pkg' JSSImporter: Package ID '245' verified on server JSSImporter: Package ID '245' verified on server JSSImporter: Package 'category' updated. JSSImporter: Package 'reboot_required' updated. JSSImporter: Package 'boot_volumerequired' updated. JSSImporter: Looking for ComputerGroup template file SmartGroupTemplate.xml... JSSImporter: Found file: /Users/superpanda/Library/AutoPkg/RecipeRepos/com.github.autopkg.jss-recipes/SmartGroupTemplate.xml Traceback (most recent call last): File "/Library/AutoPkg/JSSImporter/jss/jssobject.py", line 546, in save id = self.jss.post(self.url, data=self) File "/Library/AutoPkg/JSSImporter/jss/jamf_software_server.py", line 380, in post error_handler(PostError, response) File "/Library/AutoPkg/JSSImporter/jss/tools.py", line 95, in error_handler raise exception jss.exceptions.PostError: Response Code: 409 Response: Conflict. Error: Smart Group (Firefox-update-smart) depends on another Smart Group (Testing) which does not exist yet https://[sanitized]:8443/JSSResource/computergroups/id/0.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Library/AutoPkg/autopkglib/init.py", line 673, in process self.env = processor.process() File "/Library/AutoPkg/autopkglib/init.py", line 480, in process self.main() File "/Library/AutoPkg/autopkglib/JSSImporter.py", line 1249, in main self.groups = self.handle_groups(self.env.get("groups")) File "/Library/AutoPkg/autopkglib/JSSImporter.py", line 602, in handle_groups computer_group = self.add_or_update_smart_group(group) File "/Library/AutoPkg/autopkglib/JSSImporter.py", line 1049, in add_or_update_smart_group update_env="jss_group_updated", added_env="jss_group_added") File "/Library/AutoPkg/autopkglib/JSSImporter.py", line 876, in update_or_create_new recipe_object.save() File "/Library/AutoPkg/JSSImporter/jss/jssobject.py", line 548, in save raise PostError(err) jss.exceptions.PostError: Response Code: 409 Response: Conflict. Error: Smart Group (Firefox-update-smart) depends on another Smart Group (Testing) which does not exist yet https://[sanitized]:8443/JSSResource/computergroups/id/0. File "/Library/AutoPkg/autopkglib/init.py", line 673, in process self.env = processor.process() Response Code: 409 Response: Conflict. Error: Smart Group (Firefox-update-smart) depends on another Smart Group (Testing) which does not exist yet https://[sanitized]:8443/JSSResource/computergroups/id/0. Failed. Receipt written to /Users/superpanda/Library/AutoPkg/Cache/local.jss.Firefox-testing/receipts/Firefox-testing-receipt-20200421-184240.plist

The following recipes failed: Firefox-testing.jss Error in local.jss.Firefox-testing: Processor: JSSImporter: Error: Response Code: 409 Response: Conflict. Error: Smart Group (Firefox-update-smart) depends on another Smart Group (Testing) which does not exist yet https://[sanitized]:8443/JSSResource/computergroups/id/0.

Nothing downloaded, packaged or imported. superpanda@ML-C02XC4RCJG5L ~ %

shawnhonsberger commented 4 years ago

Thanks, @imasupersadpanda. Does your API user have the correct rights? https://github.com/jssimporter/JSSImporter/wiki/Installation-and-Setup#creating-an-api-user

imasupersadpanda commented 4 years ago

Yep, that account has Create/Read/Write perms for the following:

Categories Computer Extension Attributes Packages Policies Scripts Smart Computer Groups Static Computer Groups

Read perms are granted to this user for File Distribution Points and Cloud Distribution Points.

shawnhonsberger commented 4 years ago

@imasupersadpanda It should be Create, Read, and Update privileges.

shawnhonsberger commented 4 years ago

@imasupersadpanda are you on the MacAdmins Slack? https://www.macadmins.org. There is a #jss-importer channel that might be a bit faster to get this figured out. Since this isn't an AutoPkgr issue, I think I will close this issue so that the conversation can continue there. Sound good to you?

imasupersadpanda commented 4 years ago

Yep, I wrote that down incorrectly. The privs are indeed, Create, Read, and, Update

Sure, thanks for your help.

shawnhonsberger commented 4 years ago

Thanks! See you there!