[Tracking] Need to fix create_nagios_user() function to use charm-helpers and fix relevant function in charm-helpers

Bug #1925377 reported by Alex Kavanagh
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Charm Helpers
New
Undecided
Unassigned
OpenStack Percona Cluster Charm
New
Undecided
Unassigned

Bug Description

The 21.04 release of the charms has a hotfix applied to the create_nagios_user() function to ensure that the nagios user in the mysql database can have its password updated. This really ought to be in the charmhelpers/contrib/database/mysql.py library file, but unfortunately *that* is broken.

i.e. in charmhelpers the:

def set_mysql_password(self, username, password, current_password=None):

function doesn't allow the password to be updated for any other user than 'root' as it requires access to the mysql.user table, which is only writable by root.

Things to fix:

1. The set_mysql_password(self, username, password, current_password=None) needs to be able to change the password for the named user in username.
2. The percona-cluster create_nagios_user() function needs to use that modified/fixed function in charm-helpers.
3. Verify it using the bionic-nagios and bionic-nagios-ha bundles in the percona-cluster charm.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to charm-percona-cluster (master)

Reviewed: https://review.opendev.org/c/openstack/charm-percona-cluster/+/786947
Committed: https://opendev.org/openstack/charm-percona-cluster/commit/432c3f0be45780bb2938ea39fab0c8a6ef9057ba
Submitter: "Zuul (22348)"
Branch: master

commit 432c3f0be45780bb2938ea39fab0c8a6ef9057ba
Author: Alex Kavanagh <email address hidden>
Date: Mon Apr 19 20:27:55 2021 +0100

    Ensure that nagios user gets created with a password

    The associated bug is due to a change introduced in commit d55dcde
    which was to ensure that the correct password update is used for
    different versions of mysql (pre and post 5.7.5). However, this change
    has broken the nagios user creation due to not setting the password.

    This patch creates the nagios user and passord at the same time. The
    updating of the password is only done if the account already exists.

    The change also corrects the nagios password store in leader-settings to
    the 'mysql-nagios.passwd' key instead of 'nagios-password'. This was an
    unfortuante error when the nagios change password was introduced. The
    charm detects if the 'nagios-password' key is used on charm-upgrade and
    moves it to 'mysql-nagios.passwd'. This enables the key to work with
    the standard MySQLHelper functions.

    Finally, the ALTER command (on percona) doesn't update non-InnoDB tables
    and thus needs to be run for each unit when the nagios password is
    changed via the action. The changes in percona_utils.py enable this to
    happen.

    Whilst the change looks large it ONLY affects the nagios password parts
    of the charm.

    The related bug is a tracking bug to serve as a reminder to fix this in
    charm-helpers and this charm (i.e. make the charm-helpers code work to
    change a password for any user other than root, and then enable this
    charm to use that code).

    Change-Id: Ibc751bef7b4654ebffdf843c556b193373e6e80c
    Related-Bug: #1925377
    Closes-Bug: #1925042

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.