Skip to content

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

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

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

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

martinadolfi opened this issue Sep 16, 2015 · 2 comments
Labels
Bug broken, incorrect, or confusing behavior Execution-Module help-wanted Community help is needed to resolve this P4 Priority 4 Platform Relates to OS, containers, platform-based utilities like FS, system based apps severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around
Milestone

Comments

@martinadolfi
Copy link

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 jfindlay added Execution-Module Bug broken, incorrect, or confusing behavior severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around help-wanted Community help is needed to resolve this P4 Priority 4 Platform Relates to OS, containers, platform-based utilities like FS, system based apps labels Sep 16, 2015
@jfindlay jfindlay added this to the Approved milestone Sep 16, 2015
@jfindlay
Copy link
Contributor

@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
Fix issue #27160 - escape whitespaces in fstab entry in module mount when persist=True
@rallytime
Copy link
Contributor

Fixed with #39593 and #45232.

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 help-wanted Community help is needed to resolve this P4 Priority 4 Platform Relates to OS, containers, platform-based utilities like FS, system based apps severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around
Projects
None yet
Development

No branches or pull requests

3 participants