zypper: fix for checking result is None (#3143)

This commit is contained in:
Alex 2016-10-17 13:22:32 +02:00 committed by Matt Clay
parent 1948bcb9e7
commit 88e940a3e1

View file

@ -267,15 +267,16 @@ def get_cmd(m, subcommand):
def set_diff(m, retvals, result): def set_diff(m, retvals, result):
# TODO: if there is only one package, set before/after to version numbers # TODO: if there is only one package, set before/after to version numbers
packages = {'installed': [], 'removed': [], 'upgraded': []} packages = {'installed': [], 'removed': [], 'upgraded': []}
for p in result: if result:
group = result[p]['group'] for p in result:
if group == 'to-upgrade': group = result[p]['group']
versions = ' (' + result[p]['oldversion'] + ' => ' + result[p]['version'] + ')' if group == 'to-upgrade':
packages['upgraded'].append(p + versions) versions = ' (' + result[p]['oldversion'] + ' => ' + result[p]['version'] + ')'
elif group == 'to-install': packages['upgraded'].append(p + versions)
packages['installed'].append(p) elif group == 'to-install':
elif group == 'to-remove': packages['installed'].append(p)
packages['removed'].append(p) elif group == 'to-remove':
packages['removed'].append(p)
output = '' output = ''
for state in packages: for state in packages: