From 49fea478ee6d2fe67f6c248b8da9b0ce910184f8 Mon Sep 17 00:00:00 2001 From: Yang Youseok Date: Mon, 5 Mar 2018 23:16:33 +0900 Subject: [PATCH] Fix false-negative failure report for mysqldump backup If mysqldump command has redirect part for stderr, catching error logic by stderr doest not work as expected. Remove redirect part to report BackupError normally for sqldump failure. Change-Id: I2c10ae7b6b6094af7819594e889385b0ed77fe4b Close-Bug: 1753498 --- trove/guestagent/strategies/backup/mysql_impl.py | 3 +-- trove/tests/unittests/backup/test_backupagent.py | 1 - trove/tests/unittests/guestagent/test_backups.py | 3 +-- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/trove/guestagent/strategies/backup/mysql_impl.py b/trove/guestagent/strategies/backup/mysql_impl.py index 8c51fc7a31..a4843de9bc 100644 --- a/trove/guestagent/strategies/backup/mysql_impl.py +++ b/trove/guestagent/strategies/backup/mysql_impl.py @@ -34,8 +34,7 @@ class MySQLDump(base.BackupRunner): @property def cmd(self): user_and_pass = ( - ' --password=%(password)s -u %(user)s ' - '2>/tmp/mysqldump.log' % + ' --password=%(password)s -u %(user)s' % {'password': MySqlApp.get_auth_password(), 'user': ADMIN_USER_NAME}) cmd = ('mysqldump' diff --git a/trove/tests/unittests/backup/test_backupagent.py b/trove/tests/unittests/backup/test_backupagent.py index 6f2526637d..27ad289ab1 100644 --- a/trove/tests/unittests/backup/test_backupagent.py +++ b/trove/tests/unittests/backup/test_backupagent.py @@ -213,7 +213,6 @@ class BackupAgentTest(trove_testtools.TestCase): ' --opt' ' --password=123' ' -u os_admin' - ' 2>/tmp/mysqldump.log' ' | gzip |' ' openssl enc -aes-256-cbc -salt ' '-pass pass:default_aes_cbc_key') diff --git a/trove/tests/unittests/guestagent/test_backups.py b/trove/tests/unittests/guestagent/test_backups.py index aae721f91d..7ad9ec4614 100644 --- a/trove/tests/unittests/guestagent/test_backups.py +++ b/trove/tests/unittests/guestagent/test_backups.py @@ -90,8 +90,7 @@ XTRA_BACKUP_INCR = ('sudo innobackupex --stream=xbstream' ' /var/lib/mysql/data' ' 2>/tmp/innobackupex.log') SQLDUMP_BACKUP_RAW = ("mysqldump --all-databases %(extra_opts)s " - "--opt --password=password -u os_admin" - " 2>/tmp/mysqldump.log") + "--opt --password=password -u os_admin") SQLDUMP_BACKUP = SQLDUMP_BACKUP_RAW % {'extra_opts': ''} SQLDUMP_BACKUP_EXTRA_OPTS = (SQLDUMP_BACKUP_RAW % {'extra_opts': '--events --routines --triggers'})