Kouen Kouen - 7 months ago 25
SQL Question

How would i use nested classes in Puppet for this example?

I am trying to install

mysqltuner
for puppet from the forge, already installed properly
mysql
module, but i donĀ“t understand quite well the classes behaviour.
the example is below:

class drupal::db {

class { '::mysql::server':

# how would i access to ::mysql::server::mysqltuner???
# how do i should nest to make it work???
# how can i access the subclass of server "mysqltuner"??? what connector should i use???, I know it like some kind of path to the subclass.
# Which is the magic connector????
# Class Tested It works
# ::mysql::server::mysqltuner No
# ::mysqltuner No
# mysqltuner No
class { '::mysql::server::mysqltuner':
ensure => present
}
}

class { '::mysql::client':
...
}
}


I have tried several ways but it didnt work.
i have to use my own cfg file and i need to load mysqltuner so it works with my file.
I really appreciate any answer in the topic.

Kind Regards.

Ramiro

Answer

You're overthinking this. mysql::server::mysqltuner is not a nested class. It's just a name that represents a significance to mysql::server.

Try

include ::mysql::server
include ::mysql::server::mysqltuner

The class { '::mysql::server': } syntax should generally be avoided if not needed.