Missing value if a package uploaded to JSS
Closed this issue · 6 comments
At the moment you don't see/get a message when a (new) package has been uploaded to your jss repo. You also can't detect an upload in the optional report plist (--report-plist
).
Because of a missing value, you can't detect an upload with a script and send a mail if a new version from software XYZ was uploaded.
It would be great if you can review my changes below or implement something similar. This could also be interesting for many others?
(JSSImporter.py)
630c630
< "Extension_Attributes", "Policy", "Icon", "Version"],
---
> "Extension_Attributes", "Policy", "Icon", "Version", "Package_Uploaded"],
640c640,641
< "Version": ""
---
> "Version": "",
> "Package_Uploaded": ""
684a686,689
> jss_package_uploaded = self.get_report_string(changes["jss_repo_updated"])
> if jss_package_uploaded:
> data["Package_Uploaded"] = "True"
>
After these changes you get following when you run AutoPkg (CLI):
The following changes were made to the JSS:
Name Package Categories Groups Scripts Extension Attributes Policy Icon Version Package Uploaded
---- ------- ---------- ------ ------- -------------------- ------ ---- ------- ----------------
Google Chrome Google Chrome-63.0.3239.132.pkg Software: Google Chrome nicht installiert Google Chrome 63.0.3239.132 True
Google Chrome Google Chrome-63.0.3239.132.pkg AutoInstall: Google Chrome AutoInstall: Google Chrome AutoInstall Google Chrome 63.0.3239.132
Google Chrome Google Chrome-63.0.3239.132.pkg Software: Google Chrome nicht aktuell Update Google Chrome 63.0.3239.132
Google Chrome Software: Google Chrome installiert Google Chrome entfernen 63.0.3239.132
and report plist:
....
<key>summary_results</key>
<dict>
<key>jss_importer_summary_result</key>
<dict>
<key>data_rows</key>
<array>
<dict>
<key>Categories</key>
<string></string>
<key>Extension_Attributes</key>
<string></string>
<key>Groups</key>
<string>Software: Google Chrome nicht installiert</string>
<key>Icon</key>
<string></string>
<key>Name</key>
<string>Google Chrome</string>
<key>Package</key>
<string>Google Chrome-63.0.3239.132.pkg</string>
<key>Package_Uploaded</key>
<string>True</string>
<key>Policy</key>
<string>Google Chrome</string>
<key>Scripts</key>
<string></string>
<key>Version</key>
<string>63.0.3239.132</string>
</dict>
....
"Now" your script can detect an upload with the key "<key>Package_Uploaded</key>
".
Sounds great to me @Nerthil. Can you send me a PR for this?
Aww yeah-nice work!
Thx for merging. Yes that's really useful. We use this to automate our packaging process with the continuous integration solution from GitLab :)
But, I tested my changes with the pre-release (1.0.1) and it currently doesn't work as aspected (anymore). I would make a new merge request when I found the problem.
Ah-yeah, look back in the commit log. I think we had a bug in the reporting where it was using incorrect names for things...
Probably git blame would help too.
Found it (Commit 318ad02). But I'm not sure, why it was changed from added to updated? The commit message says that it is never populated, but it is set when a package was added?! Or am I wrong?
493c493
< if self.env["jss_changed_objects"]["jss_package_added"]:
> if self.env["jss_changed_objects"]["jss_package_updated"]:
Checked it again. And yes, my changes are still working correctly. I thought it was my fault, but because of the "jss_package_updated" changes the JSSImporter uploads the packages on every run.