mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
Added the ability to aptpkg.upgrade to use the upgrade opition with apt-get instead of the dist-upgrade method. Introducing a new argument to the upgrade function, dist-upgrade, which is True by default but can be set to False to use upgrade.
This commit is contained in:
parent
2b8d232130
commit
714f03101c
@ -546,7 +546,7 @@ def purge(name=None, pkgs=None, **kwargs):
|
||||
return _uninstall(action='purge', name=name, pkgs=pkgs, **kwargs)
|
||||
|
||||
|
||||
def upgrade(refresh=True, **kwargs):
|
||||
def upgrade(refresh=True, dist_upgrade=True, **kwargs):
|
||||
'''
|
||||
Upgrades all packages via ``apt-get dist-upgrade``
|
||||
|
||||
@ -555,6 +555,12 @@ def upgrade(refresh=True, **kwargs):
|
||||
{'<package>': {'old': '<old-version>',
|
||||
'new': '<new-version>'}}
|
||||
|
||||
dist_upgrade
|
||||
Whether to perform the upgrade using dist-upgrade vs upgrade. Default
|
||||
is to use dist-upgrade.
|
||||
|
||||
.. versionadded:: Helium
|
||||
|
||||
CLI Example:
|
||||
|
||||
.. code-block:: bash
|
||||
@ -565,8 +571,12 @@ def upgrade(refresh=True, **kwargs):
|
||||
refresh_db()
|
||||
|
||||
old = list_pkgs()
|
||||
cmd = ['apt-get', '-q', '-y', '-o', 'DPkg::Options::=--force-confold',
|
||||
'-o', 'DPkg::Options::=--force-confdef', 'dist-upgrade']
|
||||
if dist_upgrade:
|
||||
cmd = ['apt-get', '-q', '-y', '-o', 'DPkg::Options::=--force-confold',
|
||||
'-o', 'DPkg::Options::=--force-confdef', 'dist-upgrade']
|
||||
else:
|
||||
cmd = ['apt-get', '-q', '-y', '-o', 'DPkg::Options::=--force-confold',
|
||||
'-o', 'DPkg::Options::=--force-confdef', 'upgrade']
|
||||
__salt__['cmd.run'](cmd, python_shell=False, output_loglevel='trace')
|
||||
__context__.pop('pkg.list_pkgs', None)
|
||||
new = list_pkgs()
|
||||
|
Loading…
Reference in New Issue
Block a user