Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] modules.salt_version appears broken in Sulfur #64306

Closed
2 of 9 tasks
ggiesen opened this issue May 18, 2023 · 0 comments · Fixed by #64554
Closed
2 of 9 tasks

[BUG] modules.salt_version appears broken in Sulfur #64306

ggiesen opened this issue May 18, 2023 · 0 comments · Fixed by #64554
Assignees
Labels
Bug broken, incorrect, or confusing behavior Execution-Module

Comments

@ggiesen
Copy link
Contributor

ggiesen commented May 18, 2023

Description
The salt_version module appears to be broken. Per this page: https://docs.saltproject.io/en/latest/topics/releases/version_numbers.html#version-numbers, Salt 3006.1 should have the codename Sulfur. However:

salt --versions-report
Salt Version:
              Salt: 3006.1
...

salt salt01 grains.get saltversion
salt01:
    3006.1

salt salt01 grains.get saltversioninfo
salt01:
    - 3006
    - 1
salt salt01 salt_version.get_release_number 'Sulfur'
salt01:
    No version assigned.

salt salt01 salt_version.equal 'Sulfur'
salt01:
    False

salt salt01 salt_version.less_than 'Sulfur'
salt01:
    True

Also, the docs at https://docs.saltproject.io/en/latest/ref/modules/all/salt.modules.salt_version.html claim you should also be able to pass a version number, but this results in a traceback:

salt salt01 salt_version.less_than '3006'
salt01:
    The minion function caused an exception: Traceback (most recent call last):
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/minion.py", line 1935, in _thread_return
        return_data = minion_instance._execute_job_function(
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/minion.py", line 1894, in _execute_job_function
        return_data = self.executors[fname](opts, data, func, args, kwargs)
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 149, in __call__
        return self.loader.run(run_func, *args, **kwargs)
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1232, in run
        return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1247, in _run_as
        return _func_or_method(*args, **kwargs)
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/executors/direct_call.py", line 10, in execute
        return func(*args, **kwargs)
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 149, in __call__
        return self.loader.run(run_func, *args, **kwargs)
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1232, in run
        return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1247, in _run_as
        return _func_or_method(*args, **kwargs)
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/salt_version.py", line 145, in less_than
        if _check_release_cmp(name) == -1:
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/salt_version.py", line 161, in _check_release_cmp
        map_version = get_release_number(name)
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/salt_version.py", line 69, in get_release_number
        name = name.lower()
    AttributeError: 'int' object has no attribute 'lower'

salt salt01 salt_version.less_than '3006.0'
salt01:
    The minion function caused an exception: Traceback (most recent call last):
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/minion.py", line 1935, in _thread_return
        return_data = minion_instance._execute_job_function(
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/minion.py", line 1894, in _execute_job_function
        return_data = self.executors[fname](opts, data, func, args, kwargs)
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 149, in __call__
        return self.loader.run(run_func, *args, **kwargs)
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1232, in run
        return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1247, in _run_as
        return _func_or_method(*args, **kwargs)
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/executors/direct_call.py", line 10, in execute
        return func(*args, **kwargs)
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 149, in __call__
        return self.loader.run(run_func, *args, **kwargs)
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1232, in run
        return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1247, in _run_as
        return _func_or_method(*args, **kwargs)
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/salt_version.py", line 145, in less_than
        if _check_release_cmp(name) == -1:
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/salt_version.py", line 161, in _check_release_cmp
        map_version = get_release_number(name)
      File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/salt_version.py", line 69, in get_release_number
        name = name.lower()
    AttributeError: 'float' object has no attribute 'lower'

Setup
(Please provide relevant configs and/or SLS files (be sure to remove sensitive info. There is no general set-up of Salt.)

Please be as specific as possible and give set-up details.

  • on-prem machine
  • VM (Virtualbox, KVM, etc. please specify)
  • VM running on a cloud service, please be explicit and add details
  • container (Kubernetes, Docker, containerd, etc. please specify)
  • or a combination, please be explicit
  • jails if it is FreeBSD
  • classic packaging
  • onedir packaging
  • used bootstrap to install

Steps to Reproduce the behavior

salt salt01 salt_version.get_release_number 'Sulfur'
salt01:
    No version assigned.

salt salt01 salt_version.equal 'Sulfur'
salt01:
    False

salt salt01 salt_version.less_than 'Sulfur'
salt01:
    True

Expected behavior

salt salt01 salt_version.get_release_number 'Sulfur'
salt01:
    3006

salt salt01 salt_version.equal 'Sulfur'
salt01:
    True

salt salt01 salt_version.less_than 'Sulfur'
salt01:
    False
salt salt01 salt_version.less_than '3006'
salt01:
    False

salt salt01 salt_version.less_than '3006.0'
salt01:
    False

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
salt --versions-report
Salt Version:
              Salt: 3006.1

Python Version:
            Python: 3.10.11 (main, May  5 2023, 02:31:54) [GCC 11.2.0]

Dependency Versions:
              cffi: 1.14.6
          cherrypy: unknown
          dateutil: 2.8.1
         docker-py: Not Installed
             gitdb: Not Installed
         gitpython: Not Installed
            Jinja2: 3.1.2
           libgit2: 1.5.0
      looseversion: 1.0.2
          M2Crypto: Not Installed
              Mako: Not Installed
           msgpack: 1.0.2
      msgpack-pure: Not Installed
      mysql-python: Not Installed
         packaging: 22.0
         pycparser: 2.21
          pycrypto: Not Installed
      pycryptodome: 3.9.8
            pygit2: 1.11.1
      python-gnupg: 0.4.8
            PyYAML: 5.4.1
             PyZMQ: 23.2.0
            relenv: 0.12.3
             smmap: Not Installed
           timelib: 0.2.4
           Tornado: 4.5.3
               ZMQ: 4.3.4

Salt Extensions:
 saltext.bitwarden: 0.0.1b14

System Versions:
              dist: almalinux 8.7 Stone Smilodon
            locale: utf-8
           machine: x86_64
           release: 4.18.0-425.19.2.el8_7.x86_64
            system: Linux
           version: AlmaLinux 8.7 Stone Smilodon

Additional context
Add any other context about the problem here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior Execution-Module
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants