-
Notifications
You must be signed in to change notification settings - Fork 795
Ensure that Puppet runs are idempotent #987
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I tried adding acceptance tests for this, but it's really tricky to get right because of the fact that the tests all run on the same host. |
Actually, it can easily be reproduced with |
|
Currently this module requires two executions of `puppet apply` to properly configure MySQL. On an Ubuntu 16.04 instance, I am seeing the second Puppet run produce the following changes: ``` Notice: Compiled catalog for ubuntu-16.04-x64 in environment production in 1.93 seconds Info: Applying configuration version '1504824440' Info: Computing checksum on file /etc/mysql/conf.d/mysql.cnf Info: /Stage[main]/Mysql::Server::Config/File[/etc/mysql/conf.d/mysql.cnf]: Filebucketed /etc/mysql/conf.d/mysql.cnf to puppet with sum c992f7b57d778f607e8d83792936e92b Notice: /Stage[main]/Mysql::Server::Config/File[/etc/mysql/conf.d/mysql.cnf]/ensure: removed Notice: /Stage[main]/Mysql::Server::Config/File[mysql-config-file]/ensure: defined content as '{md5}59e52aeed142f9004c9e74ff5e4f1d84' Info: Class[Mysql::Server::Config]: Scheduling refresh of Class[Mysql::Server::Service] Info: Class[Mysql::Server::Service]: Scheduling refresh of Service[mysqld] Info: Class[Mysql::Server::Service]: Scheduling refresh of Exec[wait_for_mysql_socket_to_open] Notice: /Stage[main]/Mysql::Server::Service/Service[mysqld]: Triggered 'refresh' from 1 events Notice: /Stage[main]/Mysql::Server::Service/Exec[wait_for_mysql_socket_to_open]: Triggered 'refresh' from 1 events Notice: Applied catalog in 2.49 seconds ``` The problem is that `Class['mysql::server::config']` is included before `Class['mysql::server::install']`. This means that `/etc/mysql/my.cnf` is configured first, but then subsequently overridden by the default configuration that is installed by the `mysql-server` package. This isn't picked up by the existing acceptance tests because they explicitly set `config_file` to `'#{@tmpdir}/my.cnf`.
Same for us with Percona Server on Ubuntu 1[468].04. See https://tickets.puppetlabs.com/browse/MODULES-8701. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently this module requires two executions of
puppet apply
to properly configure MySQL. On an Ubuntu 16.04 instance, I am seeing the second Puppet run produce the following changes:The problem is that
Class['mysql::server::config']
is included beforeClass['mysql::server::install']
. This means that/etc/mysql/my.cnf
is configured first, but then subsequently overridden by the default configuration that is installed by themysql-server
package. This isn't picked up by the existing acceptance tests because they explicitly setconfig_file
to'#{@tmpdir}/my.cnf
.