makandra / geordi

Collection of command line tools used in our daily work with Ruby, Rails and Linux.
https://makandra.com/
MIT License
103 stars 17 forks source link

Use local user for 'drop-databases' command #199

Closed brunosedler closed 11 months ago

brunosedler commented 1 year ago

These changes would make the drop-databases - command just access the postgresql and mysql shells as local user without any password validation. The changes further assume, that the local user has the required permissions to drop the selected databases. These assumptions are correct for our current setup.

codener commented 11 months ago

Without the --sudo option, I'm getting

# Checking for Postgres databases psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: database "codener" does not exist No postgres databases found that were not allowlisted.

Does this mean I have a nonstandard setup? Anyways, the error should be detected, i.e. the script should not continue with "no databases found". If possible, please suggest to use the --sudo option.

Also, renaming for "fair language" broke reference to previous allowlists/blocklists, which forces all users to create their lists again. As this also means the old lists with the "bad names" remain at their old locations, we should add migration code that renames the old lists.

Please also: