mirror of
https://github.com/munki/munki.git
synced 2026-03-03 05:20:22 -06:00
Suppress 'Rejected item' warnings when processing optional_installs
This commit is contained in:
@@ -157,12 +157,14 @@ def process_optional_install(manifestitem, cataloglist, installinfo):
|
||||
manifestitemname)
|
||||
return
|
||||
|
||||
item_pl = catalogs.get_item_detail(manifestitem, cataloglist)
|
||||
item_pl = catalogs.get_item_detail(manifestitem, cataloglist,
|
||||
suppress_warnings=True)
|
||||
if not item_pl:
|
||||
# could not find an item valid for the current OS and hardware
|
||||
# try again to see if there is an item for a higher OS
|
||||
item_pl = catalogs.get_item_detail(
|
||||
manifestitem, cataloglist, skip_min_os_check=True)
|
||||
manifestitem, cataloglist, skip_min_os_check=True,
|
||||
suppress_warnings=True)
|
||||
if item_pl:
|
||||
# found an item that requires a higher OS version
|
||||
display.display_debug1(
|
||||
@@ -204,7 +206,8 @@ def process_optional_install(manifestitem, cataloglist, installinfo):
|
||||
'Checking for versions of %s that require a higher OS version',
|
||||
manifestitem)
|
||||
another_item_pl = catalogs.get_item_detail(
|
||||
manifestitem, cataloglist, skip_min_os_check=True)
|
||||
manifestitem, cataloglist, skip_min_os_check=True,
|
||||
suppress_warnings=True)
|
||||
if another_item_pl != item_pl:
|
||||
# we found a different item. Replace the one we found
|
||||
# previously with this one.
|
||||
|
||||
@@ -414,7 +414,8 @@ def analyze_installed_pkgs():
|
||||
return pkgdata
|
||||
|
||||
|
||||
def get_item_detail(name, cataloglist, vers='', skip_min_os_check=False):
|
||||
def get_item_detail(name, cataloglist, vers='',
|
||||
skip_min_os_check=False, suppress_warnings=False):
|
||||
"""Searches the catalogs in list for an item matching the given name that
|
||||
can be installed on the current hardware/OS (optionally skipping the
|
||||
minimum OS check so we can return an item that requires a higher OS)
|
||||
@@ -557,8 +558,13 @@ def get_item_detail(name, cataloglist, vers='', skip_min_os_check=False):
|
||||
else:
|
||||
vers = 'latest'
|
||||
|
||||
display.display_debug1(
|
||||
'Looking for detail for: %s, version %s...', name, vers)
|
||||
if skip_min_os_check:
|
||||
display.display_debug1(
|
||||
'Looking for detail for: %s, version %s, '
|
||||
'ignoring minimum_os_version...', name, vers),
|
||||
else:
|
||||
display.display_debug1(
|
||||
'Looking for detail for: %s, version %s...', name, vers)
|
||||
|
||||
for catalogname in cataloglist:
|
||||
# is name in the catalog?
|
||||
@@ -597,7 +603,10 @@ def get_item_detail(name, cataloglist, vers='', skip_min_os_check=False):
|
||||
# if we got this far, we didn't find it.
|
||||
display.display_debug1('Not found')
|
||||
for reason in rejected_items:
|
||||
display.display_warning(reason)
|
||||
if suppress_warnings:
|
||||
display.display_debug1(reason)
|
||||
else:
|
||||
display.display_warning(reason)
|
||||
return None
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user