Do not expose db passwords when pinging
This commit is contained in:
parent
9dabf01051
commit
b9d5233510
|
@ -9,7 +9,7 @@ def test():
|
||||||
return run_command(['ls', '/volumes'])
|
return run_command(['ls', '/volumes'])
|
||||||
|
|
||||||
|
|
||||||
def ping_mysql(host, port, username, password) -> int:
|
def ping_mysql(host, port, username) -> int:
|
||||||
"""Check if the mysql is up and can be reached"""
|
"""Check if the mysql is up and can be reached"""
|
||||||
return run([
|
return run([
|
||||||
'mysqladmin',
|
'mysqladmin',
|
||||||
|
@ -20,11 +20,10 @@ def ping_mysql(host, port, username, password) -> int:
|
||||||
port,
|
port,
|
||||||
'--user',
|
'--user',
|
||||||
username,
|
username,
|
||||||
f'--password={password}',
|
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
def ping_mariadb(host, port, username, password) -> int:
|
def ping_mariadb(host, port, username): #, password) -> int:
|
||||||
"""Check if the mariadb is up and can be reached"""
|
"""Check if the mariadb is up and can be reached"""
|
||||||
return run([
|
return run([
|
||||||
'mysqladmin',
|
'mysqladmin',
|
||||||
|
@ -35,7 +34,6 @@ def ping_mariadb(host, port, username, password) -> int:
|
||||||
port,
|
port,
|
||||||
'--user',
|
'--user',
|
||||||
username,
|
username,
|
||||||
f'--password={password}',
|
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -22,11 +22,12 @@ class MariadbContainer(Container):
|
||||||
def ping(self) -> bool:
|
def ping(self) -> bool:
|
||||||
"""Check the availability of the service"""
|
"""Check the availability of the service"""
|
||||||
creds = self.get_credentials()
|
creds = self.get_credentials()
|
||||||
return commands.ping_mysql(
|
|
||||||
|
with utils.environment('MYSQL_PWD', creds['password']):
|
||||||
|
return commands.ping_mariadb(
|
||||||
creds['host'],
|
creds['host'],
|
||||||
creds['port'],
|
creds['port'],
|
||||||
creds['username'],
|
creds['username'],
|
||||||
creds['password'],
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def dump_command(self) -> list:
|
def dump_command(self) -> list:
|
||||||
|
@ -67,11 +68,12 @@ class MysqlContainer(Container):
|
||||||
def ping(self) -> bool:
|
def ping(self) -> bool:
|
||||||
"""Check the availability of the service"""
|
"""Check the availability of the service"""
|
||||||
creds = self.get_credentials()
|
creds = self.get_credentials()
|
||||||
|
|
||||||
|
with utils.environment('MYSQL_PWD', creds['password']):
|
||||||
return commands.ping_mysql(
|
return commands.ping_mysql(
|
||||||
creds['host'],
|
creds['host'],
|
||||||
creds['port'],
|
creds['port'],
|
||||||
creds['username'],
|
creds['username'],
|
||||||
creds['password'],
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def dump_command(self) -> list:
|
def dump_command(self) -> list:
|
||||||
|
|
Loading…
Reference in New Issue