diff --git a/lib/charms/mysql/v0/backups.py b/lib/charms/mysql/v0/backups.py index b4a458b19..5bd391aba 100644 --- a/lib/charms/mysql/v0/backups.py +++ b/lib/charms/mysql/v0/backups.py @@ -839,8 +839,8 @@ def update_binlogs_collector_config(self) -> bool: else f"{s3_parameters['bucket']}/{s3_parameters['path']}/binlogs" ) - with io.StringIO() as string_io: - yaml.dump( + + content = yaml.dump( { "endpoint": s3_parameters["endpoint"], "hosts": self.charm._mysql.get_cluster_members(), @@ -852,13 +852,12 @@ def update_binlogs_collector_config(self) -> bool: "secret_access_key": s3_parameters["secret-key"], "bucket_url": bucket_url, "default_region": s3_parameters["region"], - }, - }, - string_io, - ) - self.charm._mysql.write_content_to_file( + } + } + ) + self.charm._mysql.write_content_to_file( path=MYSQL_BINLOGS_COLLECTOR_CONFIG_FILE, - content=string_io.getvalue(), - ) + content=content, + ) return True