Better conversion of 'update_for" items from strings to lists of strings if needed.

git-svn-id: http://munki.googlecode.com/svn/trunk@1189 a4e17f2e-e282-11dd-95e1-755cbddbdd66
This commit is contained in:
Greg Neagle
2011-05-20 22:10:49 +00:00
parent 8c518912b8
commit 1de09d5117
+8 -3
View File
@@ -86,6 +86,13 @@ def makeCatalogDB(catalogitems):
# filter all items from the catalogitems that have a non-empty
# 'update_for' list
updaters = [item for item in catalogitems if item.get('update_for')]
# now fix possible admin errors where 'update_for' is a string instead
# of a list of strings
for update in updaters:
if isinstance(update['update_for'], basestring):
# convert to list of strings
update['update_for'] = [update['update_for']]
# build table of autoremove items with a list comprehension --
# filter all items from the catalogitems that have a non-empty
@@ -1270,9 +1277,7 @@ def lookForUpdates(manifestitem, cataloglist):
for catalogitem in updaters
if (name in catalogitem.get('update_for', []) or
nameWithVersion in
catalogitem.get('update_for', []) or
name == catalogitem.get('update_for') or
nameWithVersion == catalogitem.get('update_for'))]
catalogitem.get('update_for', []))]
if update_items:
update_list.extend(update_items)