Fix for postgres.

see #1
This commit is contained in:
Antoine Nguyen
2015-10-26 08:20:30 +01:00
parent bd86aa6544
commit e9f825f70b
2 changed files with 3 additions and 2 deletions

View File

@@ -45,6 +45,7 @@ class PostgreSQL(Database):
"""Exec a postgresql query."""
cmd = "psql"
if dbname and dbuser:
self._setup_pgpass(dbname, dbuser, dbpassword)
cmd += " -h {} -d {} -U {} -w".format(self.dbhost, dbname, dbuser)
utils.exec_cmd(
"""{} -c "{}" """.format(cmd, query), sudo_user=self.dbuser)