-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cleanup router metadata #224
Conversation
b8969e3
to
7754bd3
Compare
Depends on #226 |
495b3ad
to
a4455c3
Compare
68a2866
to
0d11539
Compare
self.charm._mysql.delete_user(user.username) | ||
logger.info(f"Deleted router user {user.username}") | ||
except MySQLDeleteUserError: | ||
logger.error(f"Failed to delete user {user.username}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we should defer/retry if the deletion fails.
up to @paulomach
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd agree - if there's a error dropping a user it maybe the case to retry - I've also commented on the lib method to make it harder to fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this be a separate PR?
we're not doing this for other user deletion (e.g. deleting users for relation)
self.charm._mysql.delete_users_for_relation(relation_id) |
I'd prefer to not block canonical/mysql-router-k8s-operator#51
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opened #228
if len(users) > 1: | ||
logger.error( | ||
f"More than one router user for departing unit {event.departing_unit.name}" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isnt it possible to have more than 1 user returned (if there are multiple applications related to the mysqlrouter application)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.charm._mysql.delete_user(user.username) | ||
logger.info(f"Deleted router user {user.username}") | ||
except MySQLDeleteUserError: | ||
logger.error(f"Failed to delete user {user.username}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd agree - if there's a error dropping a user it maybe the case to retry - I've also commented on the lib method to make it harder to fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Depends on #220 (change base branch after #220 is merged)
Issue
Router metadata not removed when router leaves relation
Solution
Remove metadata when router leaves relation