Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

@martinadolfi

Description

@martinadolfi

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Execution-ModuleP4Priority 4PlatformRelates to OS, containers, platform-based utilities like FS, system based appsbugbroken, incorrect, or confusing behaviorhelp-wantedCommunity help is needed to resolve thisseverity-medium3rd level, incorrect or bad functionality, confusing and lacks a work around

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions