Skip to content

Commit

Permalink
Env password is no longer used since #361 (#362)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathan-s committed Dec 13, 2020
1 parent b8d4e2b commit e603f16
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 11 deletions.
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 @@ -250,8 +250,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 @@ -261,5 +259,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'])

0 comments on commit e603f16

Please sign in to comment.