Skip to content

Commit

Permalink
zypper: fix for checking result is None (ansible#3143)
Browse files Browse the repository at this point in the history
  • Loading branch information
alxgu authored and mattclay committed Dec 8, 2016
1 parent 1948bcb commit 88e940a
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions lib/ansible/modules/extras/packaging/os/zypper.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,15 +267,16 @@ def get_cmd(m, subcommand):
def set_diff(m, retvals, result):
# TODO: if there is only one package, set before/after to version numbers
packages = {'installed': [], 'removed': [], 'upgraded': []}
for p in result:
group = result[p]['group']
if group == 'to-upgrade':
versions = ' (' + result[p]['oldversion'] + ' => ' + result[p]['version'] + ')'
packages['upgraded'].append(p + versions)
elif group == 'to-install':
packages['installed'].append(p)
elif group == 'to-remove':
packages['removed'].append(p)
if result:
for p in result:
group = result[p]['group']
if group == 'to-upgrade':
versions = ' (' + result[p]['oldversion'] + ' => ' + result[p]['version'] + ')'
packages['upgraded'].append(p + versions)
elif group == 'to-install':
packages['installed'].append(p)
elif group == 'to-remove':
packages['removed'].append(p)

output = ''
for state in packages:
Expand Down

0 comments on commit 88e940a

Please sign in to comment.