Skip to content

[BUG] Cannot upload mobile_device_prestage #207

@neilmartin83

Description

@neilmartin83

Describe the bug
Error when trying to upload a mobile_device_prestage object using JamfObjectUploader

To Reproduce
Steps to reproduce the behavior. For example:
Run a recipe using JamfObjectUploader - e.g.

Description: Creates mobile device prestages
Comment: | 
  Requires the following keys to be set or overridden in a child recipe:
    * ORGANISATION_NAME
Identifier: JamfMSP-private-recipes.jamf.DJmobi-PreStage-MobileDevice
MinimumVersion: "2.3"

Input:
  NAME: "All - %ORGANISATION_NAME% - Shared"
  PRESTAGE_TEMPLATE_SHARED: _Template-PreStage-MobileDevice-Shared.json

Process:
  - Processor: com.github.grahampugh.jamf-upload.processors/JamfObjectUploader
    Arguments:
      object_name: "%NAME%"
      object_template: "%PRESTAGE_TEMPLATE_SHARED%"
      object_type: mobile_device_prestage
      replace_object: "True"

Expected behaviour
We get a PreStage object

Log output
If applicable, add a full, verbose AutoPkg output (with any secrets obfuscated) to help explain your problem.

JamfObjectUploader: ID: 2 NAME: None
Traceback (most recent call last):
  File "/Library/AutoPkg/autopkglib/__init__.py", line 840, in process
    self.env = processor.process()
  File "/Library/AutoPkg/autopkglib/__init__.py", line 626, in process
    self.main()
  File "/Users/Shared/GitHub/jamf-upload/JamfUploaderProcessors/JamfObjectUploader.py", line 114, in main
    self.execute()
  File "/Users/Shared/GitHub/jamf-upload/JamfUploaderProcessors/JamfUploaderLib/JamfObjectUploaderBase.py", line 146, in execute
    obj_id = self.get_api_obj_id_from_name(
  File "/Users/Shared/GitHub/jamf-upload/JamfUploaderProcessors/JamfUploaderLib/JamfUploaderBase.py", line 669, in get_api_obj_id_from_name
    if obj[filter_name] == object_name:
KeyError: 'name'
  File "/Library/AutoPkg/autopkglib/__init__.py", line 840, in process
    self.env = processor.process()
'name'
Failed.```

**Environment (please complete the following information):**
 - OS: [macOS 15]
 - AutoPkg version [2.7.3]
 - Are you using the processors in `grahampugh/jamf-upload` (bleeding edge) or `autopkg/grahampugh-recipes` (stable)? bleeding edge
- Are you running a different branch to `main`?

**Additional context**
Add any other context about the problem here.

Due to Prestages not being addressable by name (no URL endpoint for it) - only `id`.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions