Page MenuHomePhabricator

Need to run postgresql::user twice to set the password
Closed, ResolvedPublic

Description

postgresql::user creates the user on the first run, but does not set the password. The sentry role includes

postgresql::user { $db_user:
    ensure     => present,
    user       => 'sentry',
    password   => 'sentry',
    pgversion  => '9.4',
}

After running this a single time, the user is created but the application cannot log in:

$ sudo sudo -u postgres psql -c '\du'
                             List of roles
 Role name |                   Attributes                   | Member of 
-----------+------------------------------------------------+-----------
 postgres  | Superuser, Create role, Create DB, Replication | {}
 sentry    |                                                | {}

$ sudo sudo -u sentry psql -h localhost sentry sentry
Password for user sentry: 
psql: FATAL:  password authentication failed for user "sentry"

Related Objects

StatusAssignedTask
OpenTgr
ResolvedTgr
ResolvedGilles
Resolvedgreg
OpenNone
StalledTgr
OpenNone
OpenNone
OpenTgr
OpenTgr
ResolvedTgr
Resolvedcsteipp
ResolvedTgr
DeclinedTgr
DeclinedTgr
StalledTgr
ResolvedTgr
StalledTgr
ResolvedTgr
ResolvedTgr
ResolvedTgr
ResolvedAklapper
ResolvedTgr
ResolvedTgr
StalledTgr
DeclinedNone
ResolvedTgr
Resolvedjcrespo

Event Timeline

Tgr created this task.Sep 11 2015, 2:23 AM
Tgr raised the priority of this task from to Needs Triage.
Tgr updated the task description. (Show Details)
Tgr added projects: Puppet, acl*sre-team.
Tgr added a subscriber: Tgr.
Restricted Application added subscribers: Matanya, Aklapper. · View Herald TranscriptSep 11 2015, 2:23 AM

Change 237565 had a related patch set uploaded (by Gergő Tisza):
Ensure correct order in postgresql::user

https://gerrit.wikimedia.org/r/237565

jcrespo claimed this task.Sep 11 2015, 3:53 PM
jcrespo triaged this task as Low priority.

Low because it is not breaking anything right now until a new deployment. I have written a suggestion of fix avoid the double application.

Change 237565 merged by Alexandros Kosiaris:
Ensure correct order in postgresql::user

https://gerrit.wikimedia.org/r/237565

Tgr closed this task as Resolved.Sep 16 2015, 8:57 AM