sensson / puppet-powerdns

A Puppet module to install and configure the PowerDNS 4.x authorative server and recursor
12 stars 45 forks source link

collate/charset for db creation #126

Closed jsfrerot closed 2 years ago

jsfrerot commented 2 years ago

with mariadb 10.6.1, the utf8 charset is an alias for utf8mb3 (https://mariadb.com/kb/en/supported-character-sets-and-collations/#changes). When managing the DB with powerdns module, it tries to change it at every run using the default values comming from mysql module.

Notice: /Stage[main]/Powerdns::Backends::Mysql/Mysql::Db[powerdns]/Mysql_database[powerdns]/charset: charset changed 'utf8mb3' to 'utf8' (corrective)
Notice: /Stage[main]/Powerdns::Backends::Mysql/Mysql::Db[powerdns]/Mysql_database[powerdns]/collate: collate changed 'utf8mb3_general_ci' to 'utf8_general_ci' (corrective)
Info: /Stage[main]/Powerdns::Backends::Mysql/Mysql::Db[powerdns]/Mysql_database[powerdns]: Scheduling refresh of Exec[powerdns-import]
Info: /Stage[main]/Powerdns::Backends::Mysql/Mysql::Db[powerdns]/Mysql_database[powerdns]: Scheduling refresh of Exec[powerdns-import]
Notice: /Stage[main]/Powerdns::Backends::Mysql/Mysql::Db[powerdns]/Exec[powerdns-import]/returns: ERROR 1050 (42S01) at line 1: Table 'domains' already exists
Error: /Stage[main]/Powerdns::Backends::Mysql/Mysql::Db[powerdns]/Exec[powerdns-import]: Failed to call refresh: 'cat /usr/share/doc/pdns-backend-mysql/schema.mysql.sql | mysql powerdns' returned 1 instead of one of [0]
Error: /Stage[main]/Powerdns::Backends::Mysql/Mysql::Db[powerdns]/Exec[powerdns-import]: 'cat /usr/share/doc/pdns-backend-mysql/schema.mysql.sql | mysql powerdns' returned 1 instead of one of [0]
Info: Mysql::Db[powerdns]: Unscheduling all events on Mysql::Db[powerdns]

Would it be possible to allow passing the charset/collate parameters to prevent puppet from trying to import the DB at every puppet run ?

file: backends/mysql.pp

    mysql::db { $::powerdns::db_name:
      user     => $::powerdns::db_username,
      password => $::powerdns::db_password,
      host     => $::powerdns::db_host,
      grant    => [ 'ALL' ],
      sql      => $::powerdns::mysql_schema_file,
      require  => Package[$::powerdns::params::mysql_backend_package_name],
    }
ju5t commented 2 years ago

This should be fixed in the MySQL module. As such, I do not see an immediate need to add it to this package.

jsfrerot commented 2 years ago

The mysql modules allows it. The problem lies in the pdns module in file backends/mysql.pp. Which doesn't allow the charset/collate parameters to be passed to the mysql module.

ju5t commented 2 years ago

That's not what I meant. The MySQL module should use the new default as standard. Not us.

I don't really see why we should support alternatives in this module.

If you need it, I would suggest to manage MySQL yourself and opt out of what this module does.