From f0f186ef9a278c919cfba331a05f2f1b3fa6a572 Mon Sep 17 00:00:00 2001 From: "wu.chunyang" Date: Tue, 26 Nov 2024 14:42:09 +0800 Subject: [PATCH] Fix replication detach error TypeError: tuple indices must be integers or slices, not str this is caused by the new version of the sqlachemy library. Change-Id: I76166f901f961a18ad4297d04e1a75a59b059e23 --- .../notes/fix-replication-detach-a21f29c89d089f9b.yaml | 5 +++++ trove/guestagent/datastore/mysql_common/service.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/fix-replication-detach-a21f29c89d089f9b.yaml diff --git a/releasenotes/notes/fix-replication-detach-a21f29c89d089f9b.yaml b/releasenotes/notes/fix-replication-detach-a21f29c89d089f9b.yaml new file mode 100644 index 0000000000..a9c0d99ad7 --- /dev/null +++ b/releasenotes/notes/fix-replication-detach-a21f29c89d089f9b.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - | + Fix a bug where replications failed to detach from the source instance + because of the upgrade of the sqlachemy library. diff --git a/trove/guestagent/datastore/mysql_common/service.py b/trove/guestagent/datastore/mysql_common/service.py index 7198f6c3f4..d875f61b27 100644 --- a/trove/guestagent/datastore/mysql_common/service.py +++ b/trove/guestagent/datastore/mysql_common/service.py @@ -815,7 +815,7 @@ class BaseMySqlApp(service.BaseDbApp): replication_user = None with mysql_util.SqlClient(self.get_engine()) as client: result = client.execute(text('SHOW SLAVE STATUS')) - replication_user = result.first()['Master_User'] + replication_user = result.first()._mapping['Master_User'] client.execute(text('STOP SLAVE')) client.execute(text('RESET SLAVE ALL')) self.wait_for_slave_status('OFF', client, 180)