puppetlabs-mysql icon indicating copy to clipboard operation
puppetlabs-mysql copied to clipboard

Upgrade 16.0.0 -> 16.2.0 on Debian 11 fails because of double declared File ressource

Open lbdemv opened this issue 10 months ago • 8 comments
trafficstars

Describe the Bug

After upgrading from module 16.0.0 the already installed server fails during the puppet agent run with the following Duplicate declaration Error:

~# puppet agent -t --noop --environment renovate_puppetlabs_mysql_16_x
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Duplicate declaration: File[/var/log/mysql] is already declared at (file: /etc/puppetlabs/code/environments/renovate_puppetlabs_mysql_16_x/.modules/mysql/manifests/server/managed_dirs.pp, line: 37); cannot redeclare (file: /etc/puppetlabs/code/environments/renovate_puppetlabs_mysql_16_x/.modules/mysql/manifests/server/installdb.pp, line: 34) (file: /etc/puppetlabs/code/environments/renovate_puppetlabs_mysql_16_x/.modules/mysql/manifests/server/installdb.pp, line: 34, column: 5) on node XXX

Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

The change introduced in https://github.com/puppetlabs/puppetlabs-mysql/pull/1653/commits/074067abaa57f132d900b41e484cd8e9e3c4d662 in the file manifests/server/installdb.pp to create the folder /var/log/mysql seem to break with the (debian specific) automatically managed dir permissions in the manifests/server/managed_dirs.pp file.

Expected Behavior

A clean puppet run with no changes, since the module had only a minor update 16.0.0 -> 16.2.0

The folder (creation and permissions) should be handled by the managed_dirs.pp manifest.

Steps to Reproduce

Steps to reproduce the behavior:

  1. Install debian 11 server
  2. Setup a mariadb server with the module in version 16.0.0
  3. Upgrade the module version to 16.2.0
  4. Initiate a Puppet agent run

Environment

  • Version 16.2.0
  • Platform Debian GNU/Linux 11 (bullseye)

Additional Context

lbdemv avatar Jan 10 '25 13:01 lbdemv

This is probably relevant to #1599 and #1653

lbdemv avatar Jan 10 '25 13:01 lbdemv

@shubhamshinde360 could you maybe review your changes in the mentioned commit, since the update to a version including this commit, effectively breaks the module functionality on Debian 11

lbdemv avatar Feb 13 '25 13:02 lbdemv

Any comment on this issue?

@malikparvez you approved the PR that introduced this issues ( #1653 ). Maybe you have a suggestion on how to continue? Or revert the breaking change?

lbdemv avatar Mar 06 '25 10:03 lbdemv

I ran into the same issue. My current workaround is setting the log-bin param to /var/lib/mysql/mariadb-bin/mariadb-bin.log

Marmelatze avatar Apr 14 '25 08:04 Marmelatze

@bastelfreak you were requested at the original PR #1653 , could you take a look at this issue?

lbdemv avatar May 06 '25 12:05 lbdemv

No, I won't provide free labour to Perforce until they figure out if we're actually allowed to use their software:

https://github.com/voxpupuli/community-triage/issues/29

bastelfreak avatar May 06 '25 12:05 bastelfreak

This affects us too, as we set log-bin to a file under /var/log/mysql/. We don't want to change this.

As the location of the error log is configurable, perhaps an improved solution over hardcoding a directory resource in installdb.pp would be a treatment of $options['mysqld']['log-error'] in managed_dirs.pp similar to that for log-bin?

That way any duplication could be detected and handled as well as a directory created if needed.

sagepe avatar May 16 '25 10:05 sagepe

We ran into the same issue, however for us the proposed changed doesn't work. We have /var/log/mysql symlinked to /database/log, would it not be better to have ensure on "present" instead of "directory"?

rtuk avatar Jun 16 '25 08:06 rtuk

I haven't seen it mentioned, but it's also not a great idea to hardcode 'mysql' as the log directory, since this module ostensibly supports MariaDB too. At least RHEL defaults to /var/log/mariadb/ , so with this change we now have /var/log/mariadb as the real log directory and /var/log/mysql as a new directory just to confuse the unwary.

timmooney avatar Aug 11 '25 21:08 timmooney

16.3.0 is out and this issue is still present :(

mburlic avatar Sep 25 '25 13:09 mburlic