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

postgres_user.present fails but reports success #8717

Closed
olliewalsh opened this issue Nov 21, 2013 · 6 comments
Closed

postgres_user.present fails but reports success #8717

olliewalsh opened this issue Nov 21, 2013 · 6 comments
Assignees
Labels
Bug broken, incorrect, or confusing behavior fixed-pls-verify fix is linked, bug author to confirm fix Platform Relates to OS, containers, platform-based utilities like FS, system based apps Regression The issue is a bug that breaks functionality known to work in previous releases. severity-low 4th level, cosemtic problems, work around exists State-Module

Comments

@olliewalsh
Copy link
Contributor

This reports success:

auser:
  postgres_user.present:
    - superuser: true
    - createdb: true
    - password: apassword
    - user: postgres

When adding the user has failed with:
ERROR: conflicting or redundant options

@basepi
Copy link
Contributor

basepi commented Nov 21, 2013

Thanks for the report. We'll look into this.

@ghost ghost assigned cachedout Dec 2, 2013
@cachedout
Copy link
Contributor

I cannot replicate this issue. With a new Postgres installation on Ubuntu with the SLS that you've posted, I get the following output from a state.sls run:

[INFO    ] Executing command '/usr/bin/psql --no-align --no-readline --dbname postgres -c \'CREATE USER "auser" WITH PASSWORD \'"\'"\'apassword\'"\'"\' CREATEDB SUPERUSER\'' as user 'postgres' in directory '/var/lib/postgresql'
[INFO    ] {'auser': 'Present'}
local:
----------
    State: - postgres_user
    Name:      auser
    Function:  present
        Result:    True
        Comment:   The user auser has been created
        Changes:   
                   ----------
                   auser:
                       Present

Summary
------------
Succeeded: 1
Failed:    0
------------
Total:     1

And then using psql:

postgres=# \du
                             List of roles
 Role name |                   Attributes                   | Member of 
-----------+------------------------------------------------+-----------
 auser     | Superuser, Create DB, Replication              | {}
 postgres  | Superuser, Create role, Create DB, Replication | {}

Could you please post a salt --versions-report and provide any additional details that you think might assist in reproducing this issue? Thanks!

@olliewalsh
Copy link
Contributor Author

Ah, I missed an option. It fails silently when createuser is set too:

auser:
  postgres_user.present:
    - superuser: true
    - createdb: true
    - createuser: true
    - password: apassword
    - user: postgres

@cachedout
Copy link
Contributor

Ah, that makes a lot more sense. That's an easy fix.

cachedout pushed a commit to cachedout/salt that referenced this issue Dec 3, 2013
If you're a superuser, you already have permissions to create a user. Postgres will complain about conflicting options if you attempt to pass both. Refs saltstack#8717.
thatch45 added a commit that referenced this issue Dec 3, 2013
Avoid conflicting options.
@cachedout
Copy link
Contributor

This should be all fixed. @olliewalsh, could you please take a peek when you get a chance and see if this resolves the issue for you? If it does, please close the issue so we know that's it's all fixed. Thanks!

cachedout pushed a commit that referenced this issue Dec 6, 2013
If you're a superuser, you already have permissions to create a user. Postgres will complain about conflicting options if you attempt to pass both. Refs #8717.
@cachedout
Copy link
Contributor

I'm fairly confident this has been fixed in the recent work on the Postgres module. Since we've had no reply, I'm setting to closed for now. This module is under fairly heavy unit testing now, as well, so hopefully future regressions can be avoided. If this issue is still biting anybody, please feel free to re-open and we'll address it.

@jfindlay jfindlay added the Platform Relates to OS, containers, platform-based utilities like FS, system based apps label May 26, 2015
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 fixed-pls-verify fix is linked, bug author to confirm fix Platform Relates to OS, containers, platform-based utilities like FS, system based apps Regression The issue is a bug that breaks functionality known to work in previous releases. severity-low 4th level, cosemtic problems, work around exists State-Module
Projects
None yet
Development

No branches or pull requests

4 participants