Skip to content
Snippets Groups Projects
Commit 7ef05368 authored by Nicolas KAROLAK's avatar Nicolas KAROLAK
Browse files

encode password for psql connstring

parent c55f9192
No related branches found
No related tags found
No related merge requests found
......@@ -10,6 +10,7 @@ import socket
import subprocess
import sys
import time
import urllib
import uuid
try:
......@@ -181,7 +182,7 @@ def check_psql(db_conn: dict, query: str) -> tuple:
if "password" in db_conn:
uri = "postgresql://{}:{}@{}:{}/{}".format(
db_conn["user"],
db_conn["password"],
urllib.parse.quote_plus(db_conn["password"]),
db_conn["host"],
db_conn["port"],
db_conn["dbname"],
......@@ -190,7 +191,7 @@ def check_psql(db_conn: dict, query: str) -> tuple:
uri = "postgresql:///{}".format(db_conn["dbname"])
# format command
command = ["su -l postgres -c \"psql '{}' -c '{}'\"".format(uri, query)]
command = ["su -l postgres -c \"psql {} -c '{}'\"".format(uri, query)]
# execute
try:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment