deployments fail with recent puppetlabs-mysql due to use of deprecated function

Bug #1878153 reported by Damien Ciabrini
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tripleo
Fix Released
High
Damien Ciabrini

Bug Description

When deploying a stack with the head version of puppetlabs-mysql, the configuration of the mysql service fails with:

          msg: 'Container(s) with bad ExitCode: [''container-puppet-mysql''], check logs in /var/log/containers/stdouts/'

and looking in container-puppet-mysql we have

          2020-05-11T10:07:23.273909986+00:00 stderr F <13>May 11 10:07:23 puppet-user: Error: Evaluation Error: Unknown function: 'mysql_password'. (file: /etc/puppet/modules/tripleo/manifests/profile/pacemaker/database/mysql_bundle.pp, line: 513, column: 26) on node standalone.localdomain

This is due to fonction mysql_password being a deprecated function that has been replaced recently [1] in puppetlabs-mysql, in favor of a namespaced equivalent.

[1] https://github.com/puppetlabs/puppetlabs-mysql/commit/5a706276741e05088ae596141f28b03e1030a948

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to puppet-tripleo (master)

Fix proposed to branch: master
Review: https://review.opendev.org/727087

Changed in tripleo:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to puppet-tripleo (master)

Related fix proposed to branch: master
Review: https://review.opendev.org/727438

Revision history for this message
Damien Ciabrini (dciabrin) wrote :

After some investigation with Yatin, the problem seems a bit more complicated.

The commit from the bug description effectively stop providing function mysql_password via the old Ruby function API, and now just expose it via the modern Ruby function API [1].

In the case of tripleo, puppet autoloader only consider such functions if they come from modules explicitly listed as tripleo dependencies in metadata.json. And puppetlabs/mysql is not explicitely liste as a dependency. So autoloading would break.

Adding puppetlabs/mysql as a dependency seems to fix the issue that we saw. I can run container-puppet-mysql succesfully now.

As a side note, mysql_password has also become deprecated and replaced with the namespaced equivalent mysql::password. So using that variant will also help preventing future breakages.

[1] https://puppet.com/docs/puppet/5.5/functions_basics.html

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to puppet-tripleo (master)

Reviewed: https://review.opendev.org/727438
Committed: https://git.openstack.org/cgit/openstack/puppet-tripleo/commit/?id=ea6e31cf87aacc80fa6cafc444e8654bc486bc02
Submitter: Zuul
Branch: master

commit ea6e31cf87aacc80fa6cafc444e8654bc486bc02
Author: Damien Ciabrini <email address hidden>
Date: Tue May 12 22:26:53 2020 +0200

    Fix puppetlabs/mysql dependency in metadata.json

    Recent version of puppetlabs/mysql [1] have removed the
    legacy (old API) function mysql_password and now expose
    it via the modern Ruby functions API [2].

    with the modern functions API, "if a module has a list
    of dependencies in its metadata.json file, it loads custom
    functions only from those specific dependencies." [3]

    Since puppet-tripleo explicitly calls mysql_password,
    we now have to fix metadata.json to explicit the
    dependency on puppetlabs/mysql.

    Related-Bug: #1878153

    [1] https://github.com/puppetlabs/puppetlabs-mysql/commit/39b7bdef1ae162b5d00be95459eafe31820cfd61
    [2] https://puppet.com/docs/puppet/5.5/functions_basics.html
    [3] https://puppet.com/docs/puppet/5.5/lang_write_functions_in_puppet.html#calling-a-function

    Change-Id: I5a89d0bf25c7973a69ee31d3dee6dc8151a9b1e2

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to puppet-tripleo (master)

Reviewed: https://review.opendev.org/727087
Committed: https://git.openstack.org/cgit/openstack/puppet-tripleo/commit/?id=b382becab136d2e8fe359a745eb08e3bb7cd55d9
Submitter: Zuul
Branch: master

commit b382becab136d2e8fe359a745eb08e3bb7cd55d9
Author: Damien Ciabrini <email address hidden>
Date: Tue May 12 09:32:49 2020 +0200

    Stop using deprecated function mysql_password

    Function mysql_password is deprecated and has been removed
    in recent puppetlabs-mysql [1]. It has been replaced with
    the equivalent, namespaced function mysql::password. Use it
    instead.

    [1] https://github.com/puppetlabs/puppetlabs-mysql/commit/5a706276741e05088ae596141f28b03e1030a948

    Change-Id: I405a986f78f865d89b54dffea17e84d75c068ed7
    Closes-Bug: #1878153

Changed in tripleo:
status: In Progress → Fix Released
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.