mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
General cleanup in pkg state, reducing duplicate code. Fixing the requires_salt_modules decorator, sys.doc was returning too much information for the event to handle. This change specifically calls sys.doc with the module name.
This commit is contained in:
parent
16fb6ae635
commit
11cb86e6eb
2 changed files with 6 additions and 11 deletions
|
@ -1523,17 +1523,12 @@ def installed(
|
|||
# _find_install_targets() found no targets or encountered an error
|
||||
|
||||
# check that the hold function is available
|
||||
if 'pkg.hold' in __salt__:
|
||||
if 'hold' in kwargs:
|
||||
if 'pkg.hold' in __salt__ and 'hold' in kwargs:
|
||||
try:
|
||||
if kwargs['hold']:
|
||||
hold_ret = __salt__['pkg.hold'](
|
||||
name=name, pkgs=pkgs, sources=sources
|
||||
)
|
||||
else:
|
||||
hold_ret = __salt__['pkg.unhold'](
|
||||
name=name, pkgs=pkgs, sources=sources
|
||||
)
|
||||
action = 'pkg.hold' if kwargs['hold'] else 'pkg.unhold'
|
||||
hold_ret = __salt__[action](
|
||||
name=name, pkgs=pkgs, sources=sources
|
||||
)
|
||||
except (CommandExecutionError, SaltInvocationError) as exc:
|
||||
return {'name': name,
|
||||
'changes': {},
|
||||
|
|
|
@ -1093,7 +1093,7 @@ def requires_salt_modules(*names):
|
|||
)
|
||||
|
||||
for name in names:
|
||||
if name not in cls.run_function('sys.doc'):
|
||||
if name not in cls.run_function('sys.doc', [name]):
|
||||
cls.skipTest(
|
||||
'Salt module {0!r} is not available'.format(name)
|
||||
)
|
||||
|
|
Loading…
Add table
Reference in a new issue