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.swap for swap file test=True results wrong #41583

seanjnkns opened this issue Jun 5, 2017 · 5 comments


None yet
5 participants
Copy link

commented Jun 5, 2017

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.


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

Create swapfile

    - 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"
    - 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:

          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

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


This comment has been minimized.

Copy link

commented Jun 6, 2017

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


This comment has been minimized.

Copy link

commented Oct 29, 2018

Still an issue in Salt 2017.7.8.


This comment has been minimized.

Copy link

commented Nov 2, 2018

And not fixed in salt 2018.3.2 (Oxygen) :)


This comment has been minimized.

Copy link

commented Nov 5, 2018

Please see PR #50358


This comment has been minimized.

Copy link

commented Nov 6, 2018

@garethgreenaway, @rallytime, thanks!

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

@seanjnkns seanjnkns closed this Dec 16, 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.