mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #38313 from dragon788/2016.3-chocolatey-fix
2016.3 chocolatey fix
This commit is contained in:
commit
235682b1e6
2 changed files with 4 additions and 3 deletions
|
@ -255,6 +255,7 @@ def list_(narrow=None,
|
|||
cmd.extend(['-source', source])
|
||||
if local_only:
|
||||
cmd.extend(['-localonly'])
|
||||
cmd.extend(['-limitoutput'])
|
||||
|
||||
result = __salt__['cmd.run_all'](cmd, python_shell=False)
|
||||
|
||||
|
@ -264,7 +265,7 @@ def list_(narrow=None,
|
|||
raise CommandExecutionError(err)
|
||||
|
||||
ret = {}
|
||||
pkg_re = re.compile(r'(\S+)\s+(\S+)')
|
||||
pkg_re = re.compile(r'(\S+)\|(\S+)')
|
||||
for line in result['stdout'].split('\n'):
|
||||
if line.startswith("No packages"):
|
||||
return ret
|
||||
|
|
|
@ -86,7 +86,7 @@ def installed(name, version=None, source=None, force=False, pre_versions=False,
|
|||
'comment': ''}
|
||||
|
||||
# Determine if the package is installed
|
||||
if name not in __salt__['cmd.run']('choco list --local-only'):
|
||||
if name not in __salt__['cmd.run']('choco list --local-only --limit-output'):
|
||||
ret['changes'] = {'name': '{0} will be installed'.format(name)}
|
||||
elif force:
|
||||
ret['changes'] = {'name': '{0} is already installed but will reinstall'
|
||||
|
@ -166,7 +166,7 @@ def uninstalled(name, version=None, uninstall_args=None, override_args=False):
|
|||
'comment': ''}
|
||||
|
||||
# Determine if package is installed
|
||||
if name in __salt__['cmd.run']('choco list --local-only'):
|
||||
if name in __salt__['cmd.run']('choco list --local-only --limit-output'):
|
||||
ret['changes'] = {'name': '{0} will be removed'.format(name)}
|
||||
else:
|
||||
ret['comment'] = 'The package {0} is not installed'.format(name)
|
||||
|
|
Loading…
Add table
Reference in a new issue