munki / munki

Managed software installation for macOS —

Home Page:https://www.munki.org/munki/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Improve logging for "could not find unique packages to remove for item_name" warnings

SoxIn4 opened this issue · comments

When I hit this warning for the first time, it was not obvious to me where the problem was. In this case we had two different item names that both had the same pkgId in their receipts arrays.

It could be more helpful to print the shared pkgID and/or the names of the items that contain the shared ID.

Looks like if you'd bumped the logging level or run sudo managedsoftwareupdate -v (or more -vs) you'd have gotten some debug info: https://github.com/munki/munki/blob/main/code/client/munkilib/updatecheck/analyze.py#L981-L982 which shows all the items a given pkg is in. Might this be sufficient?

I just saw that while looking into how this could be implemented. Knowing what the problem was, it seems that should have been sufficient. I did run with 5 v's, but I must have missed it or didn't understand it at the time. In any case, my suggestion for clarification was going to be something like the below after line 998. I didn't realize until just now that it's basically the same message, so probably not needed and only helpful the first time this is encountered. The only advantage is it would be right after the warning.
display.display_debug1('%s also referenced in receipts of %s', (pkg, pkgdata['pkg_references'][pkg]))

You can't do that there because you are out of the for loop where the pkgs are being processed; pkg at that point is the last pkg in the list of packages, and may not be problematic.

Addressed here: 45b7ac6

love it! I'm sure that would have pointed me in the right direction more clearly.

Also means these get captured in /Library/Managed\ Installs/Logs/warnings.log.