Merge pull request #39534 from rallytime/fix-pkg-function-specs

Fix breakage in aptpkg and dpkg execution modules
This commit is contained in:
Erik Johnson 2017-02-21 14:31:14 -06:00 committed by GitHub
commit dc8f578447
2 changed files with 21 additions and 3 deletions

View File

@ -2464,7 +2464,7 @@ def owner(*paths):
return ret return ret
def info_installed(failhard=True, *names): def info_installed(*names, **kwargs):
''' '''
Return the information of the named package(s) installed on the system. Return the information of the named package(s) installed on the system.
@ -2477,6 +2477,8 @@ def info_installed(failhard=True, *names):
Whether to throw an exception if none of the packages are installed. Whether to throw an exception if none of the packages are installed.
Defaults to True. Defaults to True.
.. versionadded:: 2016.11.3
CLI example: CLI example:
.. code-block:: bash .. code-block:: bash
@ -2485,6 +2487,11 @@ def info_installed(failhard=True, *names):
salt '*' pkg.info_installed <package1> <package2> <package3> ... salt '*' pkg.info_installed <package1> <package2> <package3> ...
salt '*' pkg.info_installed <package1> failhard=false salt '*' pkg.info_installed <package1> failhard=false
''' '''
kwargs = salt.utils.clean_kwargs(**kwargs)
failhard = kwargs.pop('failhard', True)
if kwargs:
salt.utils.invalid_kwargs(kwargs)
ret = dict() ret = dict()
for pkg_name, pkg_nfo in __salt__['lowpkg.info'](*names, failhard=failhard).items(): for pkg_name, pkg_nfo in __salt__['lowpkg.info'](*names, failhard=failhard).items():
t_nfo = dict() t_nfo = dict()

View File

@ -248,7 +248,7 @@ def file_dict(*packages):
return {'errors': errors, 'packages': ret} return {'errors': errors, 'packages': ret}
def _get_pkg_info(failhard=True, *packages): def _get_pkg_info(*packages, **kwargs):
''' '''
Return list of package information. If 'packages' parameter is empty, Return list of package information. If 'packages' parameter is empty,
then data about all installed packages will be returned. then data about all installed packages will be returned.
@ -257,6 +257,10 @@ def _get_pkg_info(failhard=True, *packages):
:param failhard: Throw an exception if no packages found. :param failhard: Throw an exception if no packages found.
:return: :return:
''' '''
kwargs = salt.utils.clean_kwargs(**kwargs)
failhard = kwargs.pop('failhard', True)
if kwargs:
salt.utils.invalid_kwargs(kwargs)
if __grains__['os'] == 'Ubuntu' and __grains__['osrelease_info'] < (12, 4): if __grains__['os'] == 'Ubuntu' and __grains__['osrelease_info'] < (12, 4):
bin_var = '${binary}' bin_var = '${binary}'
@ -373,7 +377,7 @@ def _get_pkg_ds_avail():
return ret return ret
def info(failhard=True, *packages): def info(*packages, **kwargs):
''' '''
Returns a detailed summary of package information for provided package names. Returns a detailed summary of package information for provided package names.
If no packages are specified, all packages will be returned. If no packages are specified, all packages will be returned.
@ -387,6 +391,8 @@ def info(failhard=True, *packages):
Whether to throw an exception if none of the packages are installed. Whether to throw an exception if none of the packages are installed.
Defaults to True. Defaults to True.
.. versionadded:: 2016.11.3
CLI example: CLI example:
.. code-block:: bash .. code-block:: bash
@ -399,6 +405,11 @@ def info(failhard=True, *packages):
# However, this file is operated by dselect which has to be installed. # However, this file is operated by dselect which has to be installed.
dselect_pkg_avail = _get_pkg_ds_avail() dselect_pkg_avail = _get_pkg_ds_avail()
kwargs = salt.utils.clean_kwargs(**kwargs)
failhard = kwargs.pop('failhard', True)
if kwargs:
salt.utils.invalid_kwargs(kwargs)
ret = dict() ret = dict()
for pkg in _get_pkg_info(*packages, failhard=failhard): for pkg in _get_pkg_info(*packages, failhard=failhard):
# Merge extra information from the dselect, if available # Merge extra information from the dselect, if available