saltstack-formulas / mysql-formula

Install the MySQL client and/or server
http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html
Other
85 stars 366 forks source link

[BUG] Either don't check for my.cnf rights or remove it if symbolic link #237

Open mioux opened 4 years ago

mioux commented 4 years ago

Your setup

Formula commit hash / release tag

No idea, someone have statically cloned the repo in our internal git repo without modifications

Versions reports (master & minion)

Master :

Salt Version:
        Salt: 2019.2.0

Dependency Versions:
        cffi: Not Installed
    cherrypy: Not Installed
    dateutil: 2.5.3
    docker-py: Not Installed
        gitdb: Not Installed
    gitpython: Not Installed
        ioflo: Not Installed
        Jinja2: 2.9.4
        libgit2: Not Installed
        libnacl: Not Installed
    M2Crypto: Not Installed
        Mako: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.4.8
mysql-python: Not Installed
    pycparser: Not Installed
    pycrypto: 2.6.1
pycryptodome: Not Installed
        pygit2: Not Installed
        Python: 3.5.3 (default, Sep 27 2018, 17:25:39)
python-gnupg: Not Installed
        PyYAML: 3.12
        PyZMQ: 16.0.2
        RAET: Not Installed
        smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.4.3
            ZMQ: 4.2.1

System Versions:
        dist: debian 9.11
        locale: UTF-8
        machine: x86_64
        release: 4.9.0-11-amd64
        system: Linux
        version: debian 9.11

Minion :

Salt Version:
        Salt: 2019.2.3

Dependency Versions:
        cffi: 1.14.0
    cherrypy: Not Installed
    dateutil: 2.5.3
    docker-py: Not Installed
        gitdb: Not Installed
    gitpython: Not Installed
        ioflo: Not Installed
        Jinja2: 2.9.4
        libgit2: Not Installed
        libnacl: Not Installed
    M2Crypto: Not Installed
        Mako: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.4.8
mysql-python: 1.3.7
    pycparser: 2.19
    pycrypto: 2.6.1
pycryptodome: Not Installed
        pygit2: Not Installed
        Python: 3.5.3 (default, Sep 27 2018, 17:25:39)
python-gnupg: Not Installed
        PyYAML: 3.12
        PyZMQ: 16.0.2
        RAET: Not Installed
        smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.4.3
            ZMQ: 4.2.1

System Versions:
        dist: debian 9.11
        locale: UTF-8
        machine: x86_64
        release: 4.9.0-11-amd64
        system: Linux
        version: debian 9.11

Pillar / config used

Not concerned


Bug details

Describe the bug

When applying mysql state, if the file /etc/mysql/my.cnf is a symbolic link (like the one created by update-alternatives), the file has 0777 rights When applying the state, salt checks for the rights, tries to set it to 0640, which don't fail, but don't change rights on the link, but on destination file. It restarts the server as the file has been modified Next state.apply do the same and then, you restart your server after each state.apply

Steps to reproduce the bug

Just use update-alternatives on debian to create a double symbolic link (I don't have tried with a single link) /etc/mysql/my.cnf => /etc/alternatives/my.cnf => /etc/mysql/mariadb.cnf

Expected behaviour

Server don't restart.

Attempts to fix the bug

Workaround : remove the link and set a static file instead (copy the final file as /etc/mysql/my.cnf)

myii commented 4 years ago

Thanks for report, @mioux. Let's ask other contributors to this formula if they've encountered this. If so, we can write some tests to reproduce the error, in order to fix it properly. @noelmcloughlin @daks Are either of you using this formula, so that you can comment on this issue?

mioux commented 4 years ago

FYI, I've just checked for the version we're using, its the latest commit : 8dffbaf (14 february)