Salt: mount.swap for swap file test=True results wrong

Created on 5 Jun 2017  路  5Comments  路  Source: saltstack/salt

Description of Issue/Question

mount.swap on a on-disk swap file will always report Result: None even when the swap file is mounted, w/ persist: True.

Setup

(Please provide relevant configs and/or SLS files (Be sure to remove sensitive info).)

Create swapfile

/swapfile:
  cmd.run:
    - name: |
        [ -f /swapfile ] || /usr/bin/dd if=/dev/zero of=/swapfile bs=1M count=4096
        /usr/bin/chmod 0600 /swapfile
        /usr/sbin/mkswap /swapfile
        /usr/sbin/swapon -a
    - unless: /usr/bin/file /swapfile 2>&1 | /usr/bin/grep -q "Linux/i386 swap"
  mount.swap:
    - persist: true

Steps to Reproduce Issue

(Include debug logs if possible and relevant.)
Run above state, the first time it'll create a 4 GB on-disk swap file at /swapfile, add to /etc/fstab, and swapon it. Subsequent runs show no issue with this state. Running w/ test=True however, you'll get this:

local:
----------
          ID: /swapfile
    Function: mount.swap
      Result: None
     Comment: Swap /swapfile is set to be added to the fstab and to be activated
     Started: 12:11:44.588313
    Duration: 6.851 ms
     Changes:   

Summary for local
------------
Succeeded: 2 (unchanged=1)
Failed:    0
------------
Total states run:     2
Total run time:  13.197 ms

Versions Report

(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)

Salt Version:
Salt: 2016.11.5

Dependency Versions:
cffi: 1.6.0
cherrypy: unknown
dateutil: 2.4.2
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
ioflo: Not Installed
Jinja2: 2.7.2
libgit2: Not Installed
libnacl: Not Installed
M2Crypto: 0.21.1
Mako: 0.8.1
msgpack-pure: Not Installed
msgpack-python: 0.4.8
mysql-python: 1.2.5
pycparser: 2.14
pycrypto: 2.6.1
pycryptodome: 3.4.3
pygit2: Not Installed
Python: 2.7.5 (default, Nov 6 2016, 00:28:07)
python-gnupg: Not Installed
PyYAML: 3.11
PyZMQ: 15.3.0
RAET: Not Installed
smmap: Not Installed
timelib: Not Installed
Tornado: 4.4.2
ZMQ: 4.1.4

System Versions:
dist: centos 7.3.1611 Core
machine: x86_64
release: 4.9.30-1.el7.centos.x86_64
system: Linux
version: CentOS Linux 7.3.1611 Core

Bug P3 fixed-pending-your-verification severity-medium

Most helpful comment

@garethgreenaway, @rallytime, thanks!

While waiting for the salt release with this fix, I added fixed mount.py as salt://_states/mount.py - looks good, no more disturbing messages =)

All 5 comments

@seanjnkns Thanks for the report and the initial PR, we look forward to a follow up PR.

Still an issue in Salt 2017.7.8.

And not fixed in salt 2018.3.2 (Oxygen) :)

Please see PR #50358

@garethgreenaway, @rallytime, thanks!

While waiting for the salt release with this fix, I added fixed mount.py as salt://_states/mount.py - looks good, no more disturbing messages =)

Was this page helpful?
0 / 5 - 0 ratings