"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "salt/states/aptpkg.py" between
salt-3002.1.tar.gz and salt-3002.2.tar.gz

About: SaltStack is a systems management software for data center automation, cloud orchestration, server provisioning, configuration management and more. Community version.

aptpkg.py  (salt-3002.1):aptpkg.py  (salt-3002.2)
# -*- coding: utf-8 -*-
""" """
Package management operations specific to APT- and DEB-based systems Package management operations specific to APT- and DEB-based systems
==================================================================== ====================================================================
""" """
from __future__ import absolute_import, print_function, unicode_literals
# Import python libs
import logging import logging
# Import salt libs
import salt.utils.data import salt.utils.data
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
# Define the module's virtual name # Define the module's virtual name
__virtualname__ = "apt" __virtualname__ = "apt"
def __virtual__(): def __virtual__():
""" """
Only work on apt-based platforms with pkg.get_selections Only work on apt-based platforms with pkg.get_selections
skipping to change at line 37 skipping to change at line 33
def held(name): def held(name):
""" """
Set package in 'hold' state, meaning it will not be upgraded. Set package in 'hold' state, meaning it will not be upgraded.
name name
The name of the package, e.g., 'tmux' The name of the package, e.g., 'tmux'
""" """
ret = {"name": name, "changes": {}, "result": False, "comment": ""} ret = {"name": name, "changes": {}, "result": False, "comment": ""}
state = __salt__["pkg.get_selections"](pattern=name,) state = __salt__["pkg.get_selections"](pattern=name,)
if not state: if not state:
ret.update(comment="Package {0} does not have a state".format(name)) ret.update(comment="Package {} does not have a state".format(name))
elif not salt.utils.data.is_true(state.get("hold", False)): elif not salt.utils.data.is_true(state.get("hold", False)):
if not __opts__["test"]: if not __opts__["test"]:
result = __salt__["pkg.set_selections"](selection={"hold": [name]}) result = __salt__["pkg.set_selections"](selection={"hold": [name]})
ret.update( ret.update(
changes=result[name], changes=result[name],
result=True, result=True,
comment="Package {0} is now being held".format(name), comment="Package {} is now being held".format(name),
) )
else: else:
ret.update( ret.update(result=None, comment="Package {} is set to be held".forma
result=None, comment="Package {0} is set to be held".format(name t(name))
)
)
else: else:
ret.update(result=True, comment="Package {0} is already held".format(nam e)) ret.update(result=True, comment="Package {} is already held".format(name ))
return ret return ret
 End of changes. 8 change blocks. 
11 lines changed or deleted 5 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)