From b02376354c9c19fb3b86327f1f4be7d54a5c88a0 Mon Sep 17 00:00:00 2001 From: Silthus Date: Mon, 8 Mar 2021 19:29:42 +0100 Subject: [PATCH] fix: ping db with password --- src/mydumper | 2 +- src/restic_compose_backup/commands.py | 6 +++++- src/restic_compose_backup/containers_db.py | 24 +++++++++++----------- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/mydumper b/src/mydumper index 1fabdf8..bedaa05 160000 --- a/src/mydumper +++ b/src/mydumper @@ -1 +1 @@ -Subproject commit 1fabdf87e3007e5934227b504ad673ba3697946c +Subproject commit bedaa052d3d187fac62a38b19659ef12242e2528 diff --git a/src/restic_compose_backup/commands.py b/src/restic_compose_backup/commands.py index cf209cb..c69d822 100644 --- a/src/restic_compose_backup/commands.py +++ b/src/restic_compose_backup/commands.py @@ -9,7 +9,7 @@ def test(): return run(['ls', '/volumes']) -def ping_mysql(host, port, username) -> int: +def ping_mysql(host, port, username, password) -> int: """Check if the mysql is up and can be reached""" return run([ 'mysqladmin', @@ -20,6 +20,8 @@ def ping_mysql(host, port, username) -> int: port, '--user', username, + '--password', + password ]) @@ -34,6 +36,8 @@ def ping_mariadb(host, port, username) -> int: port, '--user', username, + '--password', + password ]) diff --git a/src/restic_compose_backup/containers_db.py b/src/restic_compose_backup/containers_db.py index 015f489..b1aa6af 100644 --- a/src/restic_compose_backup/containers_db.py +++ b/src/restic_compose_backup/containers_db.py @@ -25,12 +25,12 @@ class MariadbContainer(Container): """Check the availability of the service""" creds = self.get_credentials() - with utils.environment('MYSQL_PASSWORD', creds['password']): - return commands.ping_mariadb( - creds['host'], - creds['port'], - creds['username'], - ) + return commands.ping_mariadb( + creds['host'], + creds['port'], + creds['username'], + creds['password'] + ) def dump_command(self) -> list: """list: create a dump command restic and use to send data through stdin""" @@ -100,12 +100,12 @@ class MysqlContainer(Container): """Check the availability of the service""" creds = self.get_credentials() - with utils.environment('MYSQL_PASSWORD', creds['password']): - return commands.ping_mysql( - creds['host'], - creds['port'], - creds['username'], - ) + return commands.ping_mysql( + creds['host'], + creds['port'], + creds['username'], + creds['password'] + ) def dump_command(self) -> list: """list: create a dump command restic and use to send data through stdin"""