mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 09:23:56 +00:00
Merge pull request #41186 from jmarinaro/fix-chocolatey-package-collision
Fix package name collisions in chocolatey state
This commit is contained in:
commit
d433cf850d
@ -86,7 +86,8 @@ 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 --limit-output'):
|
||||
packages = __salt__['cmd.run']('choco list --local-only --limit-output')
|
||||
if name.lower() not in [package.split('|')[0].lower() for package in packages.splitlines()]:
|
||||
ret['changes'] = {'name': '{0} will be installed'.format(name)}
|
||||
elif force:
|
||||
ret['changes'] = {'name': '{0} is already installed but will reinstall'
|
||||
@ -166,7 +167,8 @@ 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 --limit-output'):
|
||||
packages = __salt__['cmd.run']('choco list --local-only --limit-output')
|
||||
if name.lower() in [package.split('|')[0].lower() for package in packages.splitlines()]:
|
||||
ret['changes'] = {'name': '{0} will be removed'.format(name)}
|
||||
else:
|
||||
ret['comment'] = 'The package {0} is not installed'.format(name)
|
||||
|
Loading…
Reference in New Issue
Block a user