Merge pull request #41186 from jmarinaro/fix-chocolatey-package-collision

Fix package name collisions in chocolatey state
This commit is contained in:
Mike Place 2017-05-12 12:01:30 -05:00 committed by GitHub
commit d433cf850d

View File

@ -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)