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

salt.states.mount persistence error using spaces in route #27160

Closed
martinadolfi opened this issue Sep 16, 2015 · 2 comments

Comments

Projects
None yet
3 participants
@martinadolfi
Copy link

commented Sep 16, 2015

When you use the state mount.mounted using persist: True and you have spaces in the name of the device, it saves the name with spaces in /etc/fstab but this file won't understand spaces.
For example:

/mnt/documents:
  mount.mounted:
    - device: //server/DATA/Factura\ Electronica/Factura\ Nacion
    - fstype: cifs
    - mkmnt: True
    - opts: credentials=/etc/credentials/srvprocess_user,iocharset=utf8,sec=ntlm
    - dump: 0
    - pass_num: 0
    - persist: True
    - mkmnt: True
    - require:
      - file: /etc/credentials/srvprocess_user
      - pkg: cifs-utils
      - file: /mnt/documents-dir

This example will mount the desired network share, but also add to fstab this line:

//server/DATA/Factura\ Electronica/Factura\ Nacion          /mnt/documents  cifs    credentials=/etc/credentials/srvprocess_user,iocharset=utf8,sec=ntlm 0 0

This will result in not mounting the share again when the system is restarted, because fstab needs another interpretation for whitespaces, is should be like this>

//srvgoogle3/DATA/Factura\040Electronica/Factura\040Nacion          /mnt/documents  cifs    credentials=/etc/credentials/srvprocess_user,iocharset=utf8,sec=ntlm 0 0

Maybe the best fix is to replace '\ ' with '\040' when writing this strings to fstab.

@jfindlay

This comment has been minimized.

Copy link
Contributor

commented Sep 16, 2015

@martinadolfi, thanks for the report. You are welcome to submit a patch with your proposed change to the 2015.5 branch.

cachedout pushed a commit that referenced this issue Feb 24, 2017

Mike Place
Merge pull request #39593 from zwo-bot/fix-issue-#27160
Fix issue #27160 - escape whitespaces in fstab entry in module mount when persist=True
@rallytime

This comment has been minimized.

Copy link
Contributor

commented Jan 2, 2018

Fixed with #39593 and #45232.

@rallytime rallytime closed this Jan 2, 2018

rallytime pushed a commit that referenced this issue Jan 2, 2018

rallytime added a commit that referenced this issue Jan 2, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.