Skip to content

Commit 60e6bd9

Browse files
Merge pull request #17 from weswhet/dynamic_app_inventory_install_report
Dynamic Managed Install Dir
2 parents 9d2e693 + 09f810b commit 60e6bd9

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

postflight.d/sal-postflight

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,18 @@ def get_managed_install_report():
138138
ManagedInstalls report for last Munki run as a plist
139139
dict, or an empty dict.
140140
"""
141+
# Checks munki preferences to see where the install directory is set to.
142+
managed_install_dir = munkicommon.pref('ManagedInstallDir')
143+
144+
# set the paths based on munki's configuration.
145+
managed_install_report = os.path.join(
146+
managed_install_dir, 'ManagedInstallReport.plist')
147+
148+
munkicommon.display_debug2(
149+
"Looking for munki's ManagedInstallReport.plist at {} ...".format(
150+
managed_install_report))
141151
try:
142-
munki_report = FoundationPlist.readPlist(
143-
'/Library/Managed Installs/ManagedInstallReport.plist')
152+
munki_report = FoundationPlist.readPlist(managed_install_report)
144153
except FoundationPlist.FoundationPlistException:
145154
munki_report = {}
146155

@@ -457,9 +466,11 @@ def send_hashed(ServerURL, hashed_data):
457466
hashurl = os.path.join(
458467
ServerURL, 'inventory/hash', hashed_data['serial'], '')
459468
inventorysubmiturl = os.path.join(ServerURL, 'inventory/submit', '')
460-
461-
inventoryplist = '/Library/Managed Installs/ApplicationInventory.plist'
462-
469+
managed_install_dir = munkicommon.pref('ManagedInstallDir')
470+
inventoryplist = os.path.join(
471+
managed_install_dir, 'ApplicationInventory.plist')
472+
munkicommon.display_debug2(
473+
'ApplicationInventory.plist Path: {}'.format(inventoryplist))
463474
inventory, inventory_hash = utils.get_file_and_hash(inventoryplist)
464475
if inventory:
465476
serverhash = None
@@ -512,8 +523,10 @@ def run_external_scripts(runtype):
512523
munkicommon.display_debug2(
513524
"Couldn't run %s") % os.path.join(root, script)
514525
else:
515-
munkicommon.display_debug2(
516-
"%s is not executable or has bad permissions") % os.path.join(root, script)
526+
script_path = os.path.join(root, script)
527+
munkicommon.display_debug1(
528+
"{0} is not executable or has bad permissions..".format(
529+
script_path))
517530

518531

519532
def send_catalogs(ServerURL, catalog_data):

0 commit comments

Comments
 (0)