Open jelockwood opened 2 months ago
Please create this issue in the https://github.com/munkireport/inventory module's GitHub repo for proper tracking.
@tuxudo Created at https://github.com/munkireport/inventory/issues/11
@tuxudo I have been on holiday and now back and had a chance to use Pacifist to examine the client installer pkg generated by MunkiReport. It seems the problem with the preference file for the MunkiReport client having the wrong file path for the ApplicationInventory.plist is being caused by MunkiReport-PHP itself generating an installer with the wrong path.
The PostInstall script in the installer pkg contains the following line
/usr/bin/defaults write "${TARGET}"/Library/Preferences/MunkiReport ReportItems -dict-add inventory "/Library/Preferences/Managed Installs/ApplicationInventory.plist"
It should be
/usr/bin/defaults write "${TARGET}"/Library/Preferences/MunkiReport ReportItems -dict-add inventory "/Library/Managed Installs/ApplicationInventory.plist"
Therefore the issue appears to be a bug in MunkReport-PHP 5.8.0.4284 and not my client Mac or setup or the inventory module. I have a suspicion this bug may have existed a while and therefore possibly also in 5.7.
Since the bug is I believe now shown to be in MunkiReport-PHP itself and not the Inventory module I am re-opening this issue for MunkiReport-PHP itself.
Note: I have tried generating the client installer pkg on two different Macs, a Mac running macOS Monterey 12.7.6 and a Mac running macOS Sonoma 14.6.1. I also tried using first an AutoPkg recipe and then using the direct URL approach as per the wiki.
/bin/bash -c "$(curl 'https://example.com/index.php?/install')" bash -i ~/Desktop
All these result in the same bad entry in the PostInstall script in the installer pkg.
I am not able to reproduce this. However, this issue is not with MunkiReport core, but with the module.
Looking at line 76 of https://github.com/munkireport/munkireport-php/blob/5.x/app/views/install/install_script.php#L76, we can see the function that sets that line in the installer pkg. This function is called by the module's install.sh script. For the inventory module, this is either line 20 or 23 as seen here https://github.com/munkireport/inventory/blob/mr5-python3/scripts/install.sh#L20.
Line 20 is the default and specifies /Library/Managed Installs/ApplicationInventory.plist
and line 23 is only used if a custom munki directory is set.
As a test, edit the install.sh script on your MunkiReport server in the inventory module's folder. Verify that when removing line 20, the defaults write command to the incorrect file is removed is removed from the client pkg.
Please discontinue this issue here and use the one in the inventory module.
I already have Munki deployed and working to all our Macs. I push out settings via a managed profile i.e. an MDM server.
The Munki working directory location is the usual
/Library/Managed Installs/
and in that directory isApplicationInventory.plist
Unfortunately MunkiReport seems to be confused and its setup shows it is looking in
/Library/Preferences/Managed Installs/
does not exist and hence it does not find ApplicationInventory.plistThere is a
/Library/Preferences/ManagedInstalls.plist
but this is not the same thing.munkireport_runner -S
shows the following entryinventory = "/Library/Preferences/Managed Installs/ApplicationInventory.plist";
and the actual execution gives the corresponding error ofWARNING: Can't open /Library/Preferences/Managed Installs/ApplicationInventory.plist
As a result the Inventory choice in Listings is effectively empty as it only lists the computer, and App Versions Report shows no version information and clicking on an entry as per APPS_TO_TRACK in my .env goes to a table saying 'No data available in table', this includes the default Safari app.
I am using an Ubuntu 20 Server running Apache2 and PHP8 and MunkiReport-PHP 5.8.0.4284