postgresql icon indicating copy to clipboard operation
postgresql copied to clipboard

User creation fails when postgres user is not present

Open rathourarv opened this issue 4 years ago • 9 comments

:pancakes: Cookbook version

lastest( 7.1.8 )

:tophat: Platform details

centos 7, AWS

Steps To Reproduce

Steps to reproduce the behavior:

We are using RDS provided by AWS. We do not have Postgres user either in RDS instance or on the machine. While we are trying to create user using resource postgresql_user. Recipe fails with the error -

can't find user for postgres (ArgumentError)

Figured out that the code has hardcoded username at - https://github.com/sous-chefs/postgresql/blob/master/resources/user.rb#L40

:police_car: Expected behavior

I should be able to create user even I don't have Postgres user.

Proposed solution -

Shouldn't we use the username from the params? I can raise the PR as well If it sounds good to you guys.

rathourarv avatar Apr 03 '20 08:04 rathourarv

We would welcome a PR :+1:

JohnRoesler avatar Apr 03 '20 12:04 JohnRoesler

Hi @JohnRoesler,

Could you please help me with failing tests on ubuntu? It's passing locally. I am running using vagrant locally but the log says we are using Dokken on CI. the Error is Command timed out after 900s and it does not look like something to do with my change. Could you please help with how can I run this with Dokken?

Thanks

rathourarv avatar Apr 05 '20 07:04 rathourarv

Tried to converge locally with ident-ubuntu-1604 - looks like journalctl log has [email protected]: New main PID 2779 does not belong to service, and PID file is not owned by root. Refusing.

JohnRoesler avatar Apr 06 '20 03:04 JohnRoesler

I am running chef exec kitchen test ident-ubuntu-1804 and it's working for me. Could you please let me know the command that you are running?

rathourarv avatar Apr 06 '20 05:04 rathourarv

Ah - probably dokken/docker vs. chef (virtualbox?). Are you running on VMs locally?

I run KITCHEN_LOCAL_YAML=kitchen.dokken.yml kitchen converge ident-ubuntu-1604 and it's hanging on the same command, starting the systemd daemon for postgres /bin/systemctl --system start postgresql

JohnRoesler avatar Apr 06 '20 13:04 JohnRoesler

yeah, I am running VM's locally. I will try with docker. Thanks

rathourarv avatar Apr 06 '20 15:04 rathourarv

This issue is affecting me also. I am unclear on the status of the PR, but if there's remaining work to be done here I am happy to help! What is the status? Just need to fix failing tests under ubuntu..?

jgitlin-p21 avatar Mar 30 '21 01:03 jgitlin-p21

@jgitlin-p21 I think the original author of the first PR abandoned it. Feel free to make a new one which addresses this!

ramereth avatar Mar 30 '21 18:03 ramereth

I might do that @ramereth -- but I just discovered another issue with this cookbook which requires me to have a .pgpass file, thus I do need a postgres user (at least for now)

If I am able to make what I am trying to do work, then I will make a PR to contribute back!

jgitlin-p21 avatar Mar 30 '21 19:03 jgitlin-p21