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

Env password is no longer used since #361 #362

Merged
merged 1 commit into from
Dec 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions dbbackup/db/postgresql.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,6 @@ class PgDumpConnector(BaseCommandDBConnector):
single_transaction = True
drop = True

def run_command(self, *args, **kwargs):
if self.settings.get('PASSWORD'):
env = kwargs.get('env', {})
env['PGPASSWORD'] = utils.get_escaped_command_arg(self.settings['PASSWORD'])
kwargs['env'] = env
return super(PgDumpConnector, self).run_command(*args, **kwargs)

def _create_dump(self):
cmd = '{} '.format(self.dump_cmd)
cmd = cmd + create_postgres_uri(self)
Expand Down
4 changes: 0 additions & 4 deletions dbbackup/tests/test_connectors/test_postgresql.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,6 @@ def test_run_command_with_password(self, mock_popen):
connector.settings['PASSWORD'] = 'foo'
connector.create_dump()
self.assertEqual(mock_popen.call_args[0][0][0], 'pg_dump')
self.assertIn('PGPASSWORD', mock_popen.call_args[1]['env'])
self.assertEqual('foo', mock_popen.call_args[1]['env']['PGPASSWORD'])

def test_run_command_with_password_and_other(self, mock_popen):
connector = PgDumpConnector(env={'foo': 'bar'})
Expand All @@ -260,5 +258,3 @@ def test_run_command_with_password_and_other(self, mock_popen):
self.assertEqual(mock_popen.call_args[0][0][0], 'pg_dump')
self.assertIn('foo', mock_popen.call_args[1]['env'])
self.assertEqual('bar', mock_popen.call_args[1]['env']['foo'])
self.assertIn('PGPASSWORD', mock_popen.call_args[1]['env'])
self.assertEqual('foo', mock_popen.call_args[1]['env']['PGPASSWORD'])