diff --git a/.fixtures.yml b/.fixtures.yml index 74fc7da..60ed40e 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -5,13 +5,13 @@ fixtures: ref: "3.0.1" stdlib: repo: "puppetlabs/stdlib" - ref: "5.2.0" + ref: "9.3.0" mysql: repo: "puppetlabs/mysql" - ref: "10.9.0" + ref: "15.0.0" postgresql: repo: "puppetlabs/postgresql" - ref: "6.4.0" + ref: "9.1.0" concat: repo: "puppetlabs/concat" ref: "5.3.0" @@ -26,5 +26,7 @@ fixtures: repo: "puppetlabs/augeas_core" puppet_version: ">= 6.0.0" ref: "1.0.4" + repositories: + systemd: 'https://github.com/voxpupuli/puppet-systemd' symlinks: powerdns: "#{source_dir}" diff --git a/README.md b/README.md index 8e585b2..9e18bcb 100644 --- a/README.md +++ b/README.md @@ -375,6 +375,14 @@ We believe it also on other operating systems such as: * Scientific Linux * Arch Linux +The packages on EL are a bit stupid. The schemas have the exact PowerDNS version +hardcoded in the paths. The main class has three parameters where you can adjust +it: + +* `mysql_schema_file` +* `pgsql_schema_file` +* `sqlite_schema_file` + ## Development We strongly believe in the power of open source. This module is our way diff --git a/manifests/authoritative.pp b/manifests/authoritative.pp index 69719d4..639aa26 100644 --- a/manifests/authoritative.pp +++ b/manifests/authoritative.pp @@ -8,7 +8,7 @@ ensure => $package_ensure, } - ensure_packages($install_packages) + stdlib::ensure_packages($install_packages) # install the right backend case $::powerdns::backend { diff --git a/manifests/backends/postgresql.pp b/manifests/backends/postgresql.pp index 9671c8e..14a8fc9 100644 --- a/manifests/backends/postgresql.pp +++ b/manifests/backends/postgresql.pp @@ -81,9 +81,13 @@ } if $::powerdns::backend_create_tables { + $password_hash = $db_password ? { + Undef => undef, + default => postgresql_password($::powerdns::db_username, $_db_password), + } postgresql::server::db { $::powerdns::db_name: user => $::powerdns::db_username, - password => postgresql_password($::powerdns::db_username, $_db_password), + password => $password_hash, require => Package[$::powerdns::params::pgsql_backend_package_name], } diff --git a/manifests/params.pp b/manifests/params.pp index 5604d56..d856e0b 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -5,6 +5,18 @@ case $facts['os']['family'] { 'RedHat': { + case $facts['os']['release']['major'] { + '7': { + $mysql_schema_file = '/usr/share/doc/pdns-backend-mysql-4.1.14/schema.mysql.sql' + $pgsql_schema_file = '/usr/share/doc/pdns-backend-postgresql-4.1.14/schema.pgsql.sql' + $sqlite_schema_file = '/usr/share/doc/pdns-backend-sqlite-4.1.14/schema.sqlite.sql' + } + default: { + $mysql_schema_file = '/usr/share/doc/pdns-backend-mysql-4.8.1/schema.mysql.sql' + $pgsql_schema_file = '/usr/share/doc/pdns-backend-postgresql-4.8.1/schema.pgsql.sql' + $sqlite_schema_file = '/usr/share/doc/pdns-backend-sqlite-4.8.1/schema.sqlite.sql' + } + } $authoritative_package = 'pdns' $authoritative_service = 'pdns' $authoritative_config = '/etc/pdns/pdns.conf' @@ -14,9 +26,6 @@ $ldap_backend_package_name = 'pdns-backend-ldap' $pgsql_backend_package_name = 'pdns-backend-postgresql' $sqlite_backend_package_name = 'pdns-backend-sqlite' - $mysql_schema_file = '/usr/share/doc/pdns-backend-mysql-4.*.*/schema.mysql.sql' - $pgsql_schema_file = '/usr/share/doc/pdns-backend-postgresql-4.*.*/schema.pgsql.sql' - $sqlite_schema_file = '/usr/share/doc/pdns-backend-sqlite-4.*.*/schema.sqlite.sql' $sqlite_package_name = 'sqlite' $authoritative_configdir = '/etc/pdns' $recursor_package = 'pdns-recursor' diff --git a/manifests/repo.pp b/manifests/repo.pp index 6353eae..1d3653e 100644 --- a/manifests/repo.pp +++ b/manifests/repo.pp @@ -15,7 +15,7 @@ Yumrepo['powerdns-recursor'] -> Package <| title == $::powerdns::params::recursor_package |> if versioncmp($::operatingsystemmajrelease, '7') <= 0 { - ensure_packages('yum-plugin-priorities') + stdlib::ensure_packages('yum-plugin-priorities') Package['yum-plugin-priorities'] -> Yumrepo['powerdns'] diff --git a/metadata.json b/metadata.json index e258b3a..6af62bf 100644 --- a/metadata.json +++ b/metadata.json @@ -10,15 +10,15 @@ "dependencies": [ { "name": "puppetlabs/stdlib", - "version_requirement": ">=4.3.2 < 9.0.0" + "version_requirement": ">= 9.0.0 < 10.0.0" }, { "name": "puppetlabs/mysql", - "version_requirement": ">=3.4.0 < 15.0.0" + "version_requirement": ">= 15.0.0 < 16.0.0" }, { "name": "puppetlabs/postgresql", - "version_requirement": ">=6.4.0 < 10.0.0" + "version_requirement": ">= 9.1.0 < 10.0.0" }, { "name": "puppetlabs/apt", diff --git a/pdk.yaml b/pdk.yaml new file mode 100644 index 0000000..4bef4bd --- /dev/null +++ b/pdk.yaml @@ -0,0 +1,2 @@ +--- +ignore: [] diff --git a/spec/classes/powerdns_init_spec.rb b/spec/classes/powerdns_init_spec.rb index 1593f36..bd82453 100644 --- a/spec/classes/powerdns_init_spec.rb +++ b/spec/classes/powerdns_init_spec.rb @@ -1,5 +1,6 @@ override_facts = { - root_home: '/root' + root_home: '/root', + service_provider: 'systemd' } require 'spec_helper' @@ -11,17 +12,23 @@ facts.merge(override_facts) end - case facts[:osfamily] + case facts[:os]['family'] when 'RedHat' authoritative_package_name = 'pdns' authoritative_service_name = 'pdns' authoritative_config = '/etc/pdns/pdns.conf' - mysql_schema_file = '/usr/share/doc/pdns-backend-mysql-4.*.*/schema.mysql.sql' + if facts[:os]['release']['major'].to_i == 7 + mysql_schema_file = '/usr/share/doc/pdns-backend-mysql-4.1.14/schema.mysql.sql' + pgsql_schema_file = '/usr/share/doc/pdns-backend-postgresql-4.1.14/schema.pgsql.sql' + sqlite_schema_file = '/usr/share/doc/pdns-backend-sqlite-4.1.14/schema.sqlite.sql' + else + mysql_schema_file = '/usr/share/doc/pdns-backend-mysql-4.8.1/schema.mysql.sql' + pgsql_schema_file = '/usr/share/doc/pdns-backend-postgresql-4.8.1/schema.pgsql.sql' + sqlite_schema_file = '/usr/share/doc/pdns-backend-sqlite-4.8.1/schema.sqlite.sql' + end pgsql_backend_package_name = 'pdns-backend-postgresql' - pgsql_schema_file = '/usr/share/doc/pdns-backend-postgresql-4.*.*/schema.pgsql.sql' sqlite_backend_package_name = 'pdns-backend-sqlite' sqlite_binary_package_name = 'sqlite' - sqlite_schema_file = '/usr/share/doc/pdns-backend-sqlite-4.*.*/schema.sqlite.sql' recursor_package_name = 'pdns-recursor' recursor_service_name = 'pdns-recursor' when 'Debian'