2

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

Tombart
  • 30,520
  • 16
  • 123
  • 136
Kouen
  • 75
  • 1
  • 9

1 Answers1

3

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.

Felix Frank
  • 8,125
  • 1
  • 23
  • 30
  • sorry for the delayed answer, and how would i pass parameters like removing mysql accounts in this type of implementation???. Thanks in advance for helping me out – Kouen Apr 04 '15 at 00:23
  • @Kouen the preferred way to do this is to combine `include` with appropriate [Hiera data](https://docs.puppetlabs.com/hiera/1/puppet.html#automatic-parameter-lookup). If this is not an option, you can of course replace an `include` statement with a `class { 'name': }` declaration, but please be aware that there are some [caveats](https://docs.puppetlabs.com/puppet/latest/reference/lang_classes.html#include-like-vs-resource-like). – Felix Frank Apr 07 '15 at 08:57
  • Thanks @Felix-frank for the data. Salutations – Kouen Jan 08 '16 at 22:20