mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
pkg.install and pkg.remove on the command line take number version numbers,
store them within a float. However version is a string, to support versions numbers like 1.3.4 The following for example would not work as version would be a float, and a float does not match a string a dict with key of strings. c:\salt\salt-call -l debug pkg.install name=softwarename version=3.1
This commit is contained in:
parent
7160697123
commit
cf55c3361c
1 changed files with 12 additions and 2 deletions
|
@ -1020,10 +1020,15 @@ def install(name=None, refresh=False, pkgs=None, **kwargs):
|
|||
ret[pkg_name] = 'Unable to locate package {0}'.format(pkg_name)
|
||||
continue
|
||||
|
||||
# Get the version number passed or the latest available
|
||||
# Get the version number passed or the latest available (must be a string)
|
||||
version_num = ''
|
||||
if options:
|
||||
version_num = options.get('version', False)
|
||||
version_num = options.get('version', '')
|
||||
# The user user salt cmdline with version=5.3 might be interpreted
|
||||
# as a float it must be converted to a string in order for
|
||||
# string matching to work.
|
||||
if not isinstance(version, six.string_types):
|
||||
version_num = str(version_num)
|
||||
|
||||
if not version_num:
|
||||
version_num = _get_latest_pkg_version(pkginfo)
|
||||
|
@ -1355,6 +1360,11 @@ def remove(name=None, pkgs=None, version=None, **kwargs):
|
|||
continue
|
||||
|
||||
if version_num is not None:
|
||||
# The user user salt cmdline with version=5.3 might be interpreted
|
||||
# as a float it must be converted to a string in order for
|
||||
# string matching to work.
|
||||
if not isinstance(version, six.string_types):
|
||||
version_num = str(version_num)
|
||||
if version_num not in pkginfo and 'latest' in pkginfo:
|
||||
version_num = 'latest'
|
||||
elif 'latest' in pkginfo:
|
||||
|
|
Loading…
Add table
Reference in a new issue