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

mount.mount not working if fstype is no used #54437

Closed
monofumado opened this issue Sep 9, 2019 · 1 comment
Closed

mount.mount not working if fstype is no used #54437

monofumado opened this issue Sep 9, 2019 · 1 comment
Labels
Bug broken, incorrect, or confusing behavior Confirmed Salt engineer has confirmed bug/feature - often including a MCVE Duplicate Duplicate of another issue or PR - will be closed

Comments

@monofumado
Copy link

monofumado commented Sep 9, 2019

Description of Issue

When the function mount.mount is called without specifying an fstype it will always return an error in the form of:
mount: : can't find in /etc/fstab.

Steps to Reproduce Issue

just call the function mount without specifying the fstype:
salt 'minion' mount.mount /mnt /dev/sda2

Versions Report

Salt Version:
Salt: 2019.2.0

Dependency Versions:
cffi: 1.11.5
cherrypy: Not Installed
dateutil: 2.8.0
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
ioflo: Not Installed
Jinja2: 2.10
libgit2: Not Installed
libnacl: Not Installed
M2Crypto: 0.30.1
Mako: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.6.1
mysql-python: Not Installed
pycparser: 2.19
pycrypto: 2.6.1
pycryptodome: Not Installed
pygit2: Not Installed
Python: 3.5.3 (default, Sep 27 2018, 17:25:39)
python-gnupg: Not Installed
PyYAML: 3.13
PyZMQ: 18.0.2
RAET: Not Installed
smmap: Not Installed
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.3.1

System Versions:
dist: debian 9.9
locale: UTF-8
machine: x86_64
release: 4.9.0-9-amd64
system: Linux
version: debian 9.9

Checking the code both in git and in the version downloaded via pip3 I see the error in the indentation in the version downloaded but not in git
Version downloaded mount.py (line 1207)

     args = ''
     if opts is not None:
         lopts = ','.join(opts)
         args = '-o {0}'.format(lopts)
 
     # use of fstype on AIX differs from typical Linux use of -t functionality
     # AIX uses -v vfsname, -t fstype mounts all with fstype in /etc/filesystems
     if 'AIX' in __grains__['os']:
         if fstype:
             args += ' -v {0}'.format(fstype)
     else:
         args += ' -t {0}'.format(fstype)
     cmd = 'mount {0} {1} {2} '.format(args, device, name)

Version in git mount.py (line 1210):

   args = ''
   if opts is not None:
       lopts = ','.join(opts)
       args = '-o {0}'.format(lopts)
     
   if fstype:
       # use of fstype on AIX differs from typical Linux use of -t
       # functionality AIX uses -v vfsname, -t fstype mounts all with
       # fstype in /etc/filesystems
       if 'AIX' in __grains__['os']:
           args += ' -v {0}'.format(fstype)
       else:
           args += ' -t {0}'.format(fstype)
 
   cmd = 'mount {0} {1} {2} '.format(args, device, name)

As you can see the if's are quite different, but the one in the version downloaded is not working because the indentation is wrong and it enters the -t option even if fstype is empty

@DmitryKuzmenko
Copy link
Contributor

@monofumado you're right. This bug is fixed by #51905 and is already in 2019.2.1 branch which will be released soon.

@DmitryKuzmenko DmitryKuzmenko added Bug broken, incorrect, or confusing behavior Confirmed Salt engineer has confirmed bug/feature - often including a MCVE Duplicate Duplicate of another issue or PR - will be closed labels Sep 10, 2019
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 Confirmed Salt engineer has confirmed bug/feature - often including a MCVE Duplicate Duplicate of another issue or PR - will be closed
Projects
None yet
Development

No branches or pull requests

2 participants