mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #42534 from jmarinaro/2017.7
Fixes AttributeError thrown by chocolatey state
This commit is contained in:
commit
62ae12bcd9
1 changed files with 8 additions and 4 deletions
|
@ -92,7 +92,7 @@ def installed(name, version=None, source=None, force=False, pre_versions=False,
|
|||
|
||||
# Determine action
|
||||
# Package not installed
|
||||
if name not in [package.split('|')[0].lower() for package in pre_install.splitlines()]:
|
||||
if name.lower() not in [package.lower() for package in pre_install.keys()]:
|
||||
if version:
|
||||
ret['changes'] = {name: 'Version {0} will be installed'
|
||||
''.format(version)}
|
||||
|
@ -193,9 +193,13 @@ def uninstalled(name, version=None, uninstall_args=None, override_args=False):
|
|||
pre_uninstall = __salt__['chocolatey.list'](local_only=True)
|
||||
|
||||
# Determine if package is installed
|
||||
if name in [package.split('|')[0].lower() for package in pre_uninstall.splitlines()]:
|
||||
ret['changes'] = {name: '{0} version {1} will be removed'
|
||||
''.format(name, pre_uninstall[name][0])}
|
||||
if name.lower() in [package.lower() for package in pre_uninstall.keys()]:
|
||||
try:
|
||||
ret['changes'] = {name: '{0} version {1} will be removed'
|
||||
''.format(name, pre_uninstall[name][0])}
|
||||
except KeyError:
|
||||
ret['changes'] = {name: '{0} will be removed'
|
||||
''.format(name)}
|
||||
else:
|
||||
ret['comment'] = 'The package {0} is not installed'.format(name)
|
||||
return ret
|
||||
|
|
Loading…
Add table
Reference in a new issue