-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Prompts for password for user postgres #3330
Comments
I'm suddenly getting this as well, starting last night, on my Drupal VM automated builds, e.g.: https://travis-ci.org/geerlingguy/drupal-vm/jobs/333562827
|
From https://www.drupal.org/node/2146131, I've also found:
Seems a bit heavy-handed, but I might have to do a hack like this for now, since it's breaking my precious builds! |
I can reproduce this with Drush 9.2.1. |
@iVegas, that does look like the reason. |
Maybe it is the issue with the temporary As a workaround https://www.drupal.org/project/drush/issues/438828#comment-5020060 |
I'm using docker4drupal compose env. |
Also noticed this, moving from 8.x to 9.x when my env. moved from PHP 7.0 to 7.1. |
And yes, as mention above. Adding a .pgpass to your home directory work. I use a slightly different one: Do not forget to alter the .pgpass permissions after you created. It do/might not work without this (did not for me): |
This is affecting us too. While a .pgpass file works (because psql will look for it if a password isn't supplied any other way), this is a hassle to keep in sync with the one in the settings file. Drush 9 doesn't exhibit this behaviour with MySQL (where it'll supply the password from config still), so I can't imagine this was an intentional change as implied. Rather, it looks like it might be a typo in the createPasswordFile() method, where it only writes a password file if there already is one, which seems reversed. This patch reverses that logic and makes it work again, but I'm not sure it's the right way. Judging by other commits in this file, like #3099, it might've been working in its current form:
I'll look into this more next week, and if it seems correct I'll make a more official PR then. |
…necting to PostgreSQL with 'psql'
…necting to PostgreSQL with 'psql'
I've since confirmed that this regressed in 2d98048 under the auspices of a refactor, and have submitted PR #3480 to fix it. Can others affected by this please try the patch from the PR to see if it solves your issue (and doesn't break anything else...). If your Drush is installed with composer, you can add the patch in composer.json's extra section and re-run composer install:
|
The patch works. Thank you, @nbertram, for your thorough investigation. Anyone who has trouble applying the patch, please read https://docs.acquia.com/article/fixing-failing-composer-patches-updating-gnu-patch. |
Tested patch works perfectly. Thansk @nbertram |
Fixed in #3480. |
Can I just point out that this is only half fixed, as I discovered while opening #4023. See line 161 https://github.com/drush-ops/drush/pull/4023/files#diff-b45a8244b8e5a42fb3f08899b3ef1765R161 If using structure tables key pg_dump will still password prompt or fail as I have discovered the hard way :) |
Problem/Motivation
Using drush with postgres repeatedly prompts for database password. It seems #63 has become an issue again.
I believe the culprit is Drush 9.0.0, because it only just became an issue for me when
drupal-composer
updated to Drush 9.0.0 a couple days ago.To reproduce this problem:
Proposed resolution
Not sure if the fix in #695 could address this again, but basically that fix was to set the PGPASSWORD environment variable to the
settings.php
database password.The text was updated successfully, but these errors were encountered: