salt icon indicating copy to clipboard operation
salt copied to clipboard

[BUG] partition.mklabel doesn't work in version 3001.6

Open monofumado opened this issue 5 years ago • 4 comments

Description partition.mklabel doesn't work in 3001.6 throwing an exception, because some changes made in cmdmod.py

$ salt minion1 partition.mklabel /dev/nvme0n1 msdos     
minion1:
    The minion function caused an exception: Traceback (most recent call last):
      File "/usr/lib/python3/dist-packages/salt/minion.py", line 1870, in _thread_return
        opts, data, func, args, kwargs
      File "/usr/lib/python3/dist-packages/salt/executors/direct_call.py", line 12, in execute
        return func(*args, **kwargs)
      File "/usr/lib/python3/dist-packages/salt/modules/parted_partition.py", line 492, in mklabel
        out = __salt__["cmd.run"](cmd, python_shell=False).splitlines()
      File "/usr/lib/python3/dist-packages/salt/modules/cmdmod.py", line 1202, in run
        **kwargs
      File "/usr/lib/python3/dist-packages/salt/modules/cmdmod.py", line 403, in _run
        _log_cmd(cmd),
      File "/usr/lib/python3/dist-packages/salt/modules/cmdmod.py", line 88, in _log_cmd
        return cmd.split()[0].strip()
    AttributeError: 'tuple' object has no attribute 'split'
ERROR: Minions returned with non-zero exit code

Steps to Reproduce the behavior Just a normal call to the module: salt minion1 partition.mklabel /dev/nvme0n1 msdos

Expected behavior The call made to cmd.run in the module should return something

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
Salt Version:
               Salt: 3001.6
     
    Dependency Versions:
               cffi: Not Installed
           cherrypy: Not Installed
           dateutil: 2.6.1
          docker-py: Not Installed
              gitdb: 2.0.3
          gitpython: 2.1.8
             Jinja2: 2.10
            libgit2: Not Installed
           M2Crypto: 0.35.2
               Mako: Not Installed
       msgpack-pure: Not Installed
     msgpack-python: 0.5.6
       mysql-python: Not Installed
          pycparser: Not Installed
           pycrypto: 2.6.1
       pycryptodome: 3.4.7
             pygit2: Not Installed
             Python: 3.6.9 (default, Jul 17 2020, 12:50:27)
       python-gnupg: 0.4.1
             PyYAML: 3.12
              PyZMQ: 17.1.2
              smmap: 2.0.3
            timelib: Not Installed
            Tornado: 4.5.3
                ZMQ: 4.2.5
     
    System Versions:
               dist: ubuntu 18.04 Bionic Beaver
             locale: ANSI_X3.4-1968
            machine: x86_64
            release: 5.3.0-59-generic
             system: Linux
            version: Ubuntu 18.04 Bionic Beaver```
</details>

monofumado avatar Mar 05 '21 15:03 monofumado

I started to see this behavior as well since I upgraded from 3001.1 to 3001.6.

edggoncalves avatar Mar 05 '21 15:03 edggoncalves

Yep, upgraded from 3000.3 to 3000.8 and we're seeing this issue. I'm assuming it's related to the recent CVE releases, especially since they touched cmdmod.

robertpenberthy avatar Mar 09 '21 18:03 robertpenberthy

Same problem here with 3002.5, migth be fixed with https://github.com/saltstack/salt/commit/24d04343b36ffbd4cf63441db13b43363ea57548

sylvainfaivre avatar Mar 12 '21 13:03 sylvainfaivre

Duplicate of #59793 and resolved by #60689

dwoz avatar Aug 07 '21 01:08 dwoz