mysql-router remove-relation does not clear charm settings and does not overwrite after add-relation.

Bug #2004089 reported by Pedro Victor Lourenço Fragola
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MySQL Router Charm
Fix Committed
Medium
Nicolas Bock

Bug Description

[Issue description]

Due to LP#2004088 the mysqlrouter.conf file had invalid settings, so the workaround was to remove the mysql-router relation with the unit and add it again.
The folder => /var/lib/mysql/<app-name>-mysql-router/ is not removed and old configuration files remain in the directory with this, when adding the unit again, the charm cannot overwrite the configuration:

configparser.DuplicateSectionError: While reading from '/var/lib/mysql/placement-mysql-router/mysqlrouter.conf' [line 66]: section 'metadata_cache:[\\w$' already exists

full log => https://pastebin.canonical.com/p/27SbxfcqM8/

Old files need to be overwritten or removed.

Revision history for this message
Felipe Reyes (freyes) wrote :

the mysql-router charm would need to implement the 'stop' hook, during that stage stop the mysql-router service and remove configuration files generated by the bootstrap process of mysql-router program.

Changed in charm-mysql-router:
status: New → Triaged
importance: Undecided → Medium
tags: added: good-first-bug
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to charm-mysql-router (stable/jammy)

Fix proposed to branch: stable/jammy
Review: https://review.opendev.org/c/openstack/charm-mysql-router/+/902535

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to charm-mysql-router (stable/21.10)

Fix proposed to branch: stable/21.10
Review: https://review.opendev.org/c/openstack/charm-mysql-router/+/902591

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on charm-mysql-router (stable/21.10)

Change abandoned by "Nicolas Bock <email address hidden>" on branch: stable/21.10
Review: https://review.opendev.org/c/openstack/charm-mysql-router/+/902591

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to charm-mysql-router (stable/focal)

Fix proposed to branch: stable/focal
Review: https://review.opendev.org/c/openstack/charm-mysql-router/+/902592

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on charm-mysql-router (stable/focal)

Change abandoned by "Nicolas Bock <email address hidden>" on branch: stable/focal
Review: https://review.opendev.org/c/openstack/charm-mysql-router/+/902592

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to charm-mysql-router (stable/focal)

Fix proposed to branch: stable/focal
Review: https://review.opendev.org/c/openstack/charm-mysql-router/+/902593

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on charm-mysql-router (stable/focal)

Change abandoned by "Alex Kavanagh <email address hidden>" on branch: stable/focal
Review: https://review.opendev.org/c/openstack/charm-mysql-router/+/902593
Reason: stable/focal is end-of-life and doesn't get published anywhere; really must clean out these old branches. Sorry for the confusion.

Changed in charm-mysql-router:
assignee: nobody → Nicolas Bock (nicolasbock)
status: Triaged → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to charm-mysql-router (stable/jammy)

Reviewed: https://review.opendev.org/c/openstack/charm-mysql-router/+/902535
Committed: https://opendev.org/openstack/charm-mysql-router/commit/08a33d6759c4012c7ec470fdd2dcd7852b036394
Submitter: "Zuul (22348)"
Branch: stable/jammy

commit 08a33d6759c4012c7ec470fdd2dcd7852b036394
Author: Nicolas Bock <email address hidden>
Date: Tue Aug 1 07:46:53 2023 -0600

    Add cleanup of configuration files on `stop`

    When this subordinate is removed from a unit it leaves its configuration
    files behind. This can become an issue if the subordinate is added back
    to the unit as pointed out in #2004088.

    This change adds a cleanup step to the `stop` hook so that those
    configuration files are removed on the removal of the subordinate charm.

    Closes-Bug: #2004088
    Closes-Bug: #2004089
    Change-Id: Icfca352f29e089aeccd1434d33a573ca1682339a
    Signed-off-by: Nicolas Bock <email address hidden>
    (cherry picked from commit 17595788edd80580624b03a664dd5cdb05bba47f)

tags: added: in-stable-jammy
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.