mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #42078 from damon-atkins/fix_convert_flt_str_version_on_cmd_line
pkg.install and pkg.remove fix version number input.
This commit is contained in:
commit
4780d7830a
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', '')
|
||||
# Using the 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_num, six.string_types) and version_num is not None:
|
||||
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:
|
||||
# Using the 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_num, six.string_types) and version_num is not None:
|
||||
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