Added hiera support #149

Closed
wants to merge 1 commit into
from

1 participant

@tomcsi

No description provided.

@hunner hunner commented on an outdated diff Apr 25, 2013
manifests/init.pp
@@ -21,4 +21,12 @@
ensure => $package_ensure,
}
+ if !empty(hiera('mysql_databases', {})) {
+ $mysql_databases = hiera_hash('mysql_databases')
+ if !empty($mysql_databases) {
+ include mysql::server
+ create_resources('mysql::db', $mysql_databases)
+ }
+ }
+
@hunner
Puppet member
hunner added a line comment Apr 25, 2013

Mixing hiera() queries into the middle of tech modules is actually a kind of anti-pattern. Since the class exposes the mysql::db defined resource type as an interface, the controlling profile needing to instantiate specific databases should be responsible for performing the hiera query. See http://www.craigdunn.org/2012/05/239/ for a reference description (though Hiera is only -> profiles).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@hunner hunner commented on the diff Apr 25, 2013
manifests/db.pp
@@ -49,11 +49,13 @@
require => Class['mysql::server'],
}
- database_user { "${user}@${host}":
- ensure => present,
- password_hash => mysql_password($password),
- provider => 'mysql',
- require => Database[$name],
+ if !defined(Database_user["${user}@${host}"]) {
+ database_user { "${user}@${host}":
+ ensure => present,
+ password_hash => mysql_password($password),
+ provider => 'mysql',
+ require => Database[$name],
+ }
@hunner
Puppet member
hunner added a line comment Apr 25, 2013

This looks like a positive change to deal with multiple mysql::db instances with the same users designated. Could you rebase this commit onto master and submit a new PR from a topic branch? Thanks!

@tomcsi
tomcsi added a line comment Apr 26, 2013

Huuh, I don't understand what I doing. Only this commit is OK?

@matthewbarr
matthewbarr added a line comment Jun 10, 2013

Yes, that's what he's saying.

@tomcsi
tomcsi added a line comment Jun 12, 2013

I added pull request again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Tamás Pásztor Add hiera support. 6000371
@tomcsi tomcsi closed this Jun 12, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment