grahampugh / jamf-upload

Scripts for uploading packages to Jamf Cloud
Apache License 2.0
147 stars 37 forks source link

Package upload fails if pkg_name is different from upload package's name #162

Closed rickokid closed 2 months ago

rickokid commented 2 months ago

Previously uploading a package and changing the name of it during the upload process by specifying pkg_name worked fine. Since the change to the packages api endpoint though the metadata uploads fine but the actual package upload fails if the package being uploaded has a different name to the fileName field pushed by the metadata.

(output is INVALID_FILE_NAME: The filename does not correspond to the filename linked to the package ID.)

Not specifying the pkg_name (and optionally specifying the pkg_display_name to provide a different name to the package) works, which basically makes the pkg_name input variable obsolete as using it breaks the package upload. Should it be deprecated?

The workaround is to either specify an alternate package name using pkg_display_name, or use a FileMover processor to rename the package before the PackageUploader processor.

grahampugh commented 2 months ago

The pkg_name key should normally be supplied by a previous processor, so should match the packages current name - not manually applied with an expectation of renaming it. I suspect that it's stopped working as you wanted it to because previously we would upload the package first, whereas now now we have to create the package metadata object first.

So I think you have been doing something that wasn't expected to work (but apparently did). So the methods you describe as workarounds are actually what I would expect you to have always done. pkg_display_name was added for those people who want the GUI name to be different to the file name for some reason.

PS I would recommend PkgCopier rather than FileMover as this creates the pkg_path and pkg_name values.

rickokid commented 2 months ago

Ok cool, thanks! And thanks for the tip on PkgCopier.