Rename list_updates to list_upgrades

In preparation for #3210, rename list_updates to list_upgrades. Also,
link list_updates to list_upgrade so that people used to running "zypper
list-updates" from the command line will still see the available
upgrades.

Hide list_updates from sphinx docs.
This commit is contained in:
Erik Johnson 2013-01-12 22:01:01 -06:00
parent a07ece5a2a
commit cd5e1ef66c
2 changed files with 13 additions and 5 deletions

View File

@ -3,4 +3,5 @@ salt.modules.zypper
===================
.. automodule:: salt.modules.zypper
:members:
:members:
:exclude-members: list_updates

View File

@ -34,9 +34,13 @@ def _list_removed(old, new):
return pkgs
def list_updates():
def list_upgrades():
'''
List packages with updates. Returns a dict of pkg/version pairs.
List all available package upgrades on this system
CLI Example::
salt '*' pkg.list_upgrades
'''
ret = {}
out = __salt__['cmd.run_stdout']('zypper list-updates').splitlines()
@ -47,13 +51,16 @@ def list_updates():
continue
try:
status, repo, name, cur, avail, arch = \
[x.strip() for x in line.split('|')]
[x.strip() for x in line.split('|')]
except ValueError, IndexError:
continue
if status == 'v':
ret[name] = avail
return ret
# Provide a list_updates function for those used to using zypper list-updates
list_updates = list_upgrades
def available_version(*names):
'''
@ -72,7 +79,7 @@ def available_version(*names):
if len(names) == 0:
return ''
ret = {}
updates = list_updates()
updates = list_upgrades()
for name in names:
ret[name] = updates.get(name, '')