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

State mongodb_user.present applies changes when modifying roles for an existing user while Test=true #53962

Closed
dbuenor opened this issue Jul 23, 2019 · 1 comment · Fixed by #53965
Labels
Bug broken, incorrect, or confusing behavior P4 Priority 4 severity-low 4th level, cosemtic problems, work around exists
Milestone

Comments

@dbuenor
Copy link

dbuenor commented Jul 23, 2019

Description of Issue

When you apply mongodb_user.present for an existing user modifying his roles and/or his password, it applies changes even when applying with Test=true. If it's a new user everything works as it should, but when updating an existing user not.

Setup

mongodb::user::creation::user::database:
  mongodb_user.present:
    - name: user
    - passwd: password
    - database: database
    - user: admin
    - password: adminpassword
    - authdb: admin
    - host: localhost
    - port: 27017
    - roles:
      - readAnyDatabase
      - readWriteAnyDatabase

Steps to Reproduce Issue

# salt-call  -l debug state.apply test=true
[INFO    ] Running state [user] at time 13:24:43.477722
[INFO    ] Executing state mongodb_user.present for [user]
[INFO    ] Creating user user
[INFO    ] User user is already present
[INFO    ] Completed state [user] at time 13:24:43.582054 (duration_in_ms=104.331)
-----
  Name: user - Function: mongodb_user.present - Result: Clean
Summary for local
--------------
Succeeded: 1
Failed:      0
--------------
Total states run:     1

When applying states using test=true, even if it shows that "nothing has happened", mongodb user has been modified at MongoDb server. Due to mongodb_user.present state code, it doesn't display any log message when mongodb user already exists.

Versions Report

master:

salt-master --versions-report
Salt Version:
           Salt: 2018.3.2

Dependency Versions:
           cffi: 1.6.0
       cherrypy: 5.6.0
       dateutil: 1.5
      docker-py: Not Installed
          gitdb: 0.6.4
      gitpython: 1.0.1
          ioflo: Not Installed
         Jinja2: 2.7.2
        libgit2: 0.26.3
        libnacl: 1.6.1
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.8
   mysql-python: Not Installed
      pycparser: 2.14
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: 0.26.4
         Python: 2.7.5 (default, Nov  6 2016, 00:28:07)
   python-gnupg: 0.3.8
         PyYAML: 3.11
          PyZMQ: 15.3.0
           RAET: Not Installed
          smmap: 0.9.0
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.1.4

System Versions:
           dist: centos 7.0.1406 Core
         locale: ANSI_X3.4-1968
        machine: x86_64
        release: 2.6.32-34-pve
         system: Linux
        version: CentOS Linux 7.0.1406 Core

minion:

salt-minion --versions-report
Salt Version:
           Salt: 2018.3.2

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: Not Installed
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.7.2
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.5.6
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.7.5 (default, Jul 13 2018, 13:06:57)
   python-gnupg: 0.4.3
         PyYAML: 3.11
          PyZMQ: 15.3.0
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.1.4

System Versions:
           dist: centos 7.4.1708 Core
         locale: ANSI_X3.4-1968
        machine: x86_64
        release: 4.15.18-12-pve
         system: Linux
        version: CentOS Linux 7.4.1708 Core
@dwoz
Copy link
Contributor

dwoz commented Jul 29, 2019

@dbuenor Thank you for reporting this and for the PR.

@dwoz dwoz added severity-low 4th level, cosemtic problems, work around exists P4 Priority 4 labels Jul 29, 2019
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 P4 Priority 4 severity-low 4th level, cosemtic problems, work around exists
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants