Deprecate designate::dns, stop managing config files in lib
The designate::dns class was really just configuring things according to a bind9 backend. As such, move it's resources to the bind9 backend manifest and deprecate this class. Additionnally, we stop managing configuration files resources inside /var/lib/designate. According to upstream documentation [1] and from discussing this with upstream developers, this is not an intended way of configuring designate. This also avoids having to manage permissions (and selinux) between designate and bind. [1]: http://docs.openstack.org/developer/designate/getting-started.html Change-Id: Ia62a3d1a72622f3eb1ceeabaf4cef36090a7a8d3
This commit is contained in:
@@ -21,25 +21,26 @@
|
||||
# Defaults to '953'
|
||||
#
|
||||
class designate::backend::bind9 (
|
||||
$rndc_host = '127.0.0.1',
|
||||
$rndc_port = '953',
|
||||
$rndc_config_file = '/etc/rndc.conf',
|
||||
$rndc_key_file = '/etc/rndc.key'
|
||||
) {
|
||||
$rndc_host = '127.0.0.1',
|
||||
$rndc_port = '953',
|
||||
$rndc_config_file = '/etc/rndc.conf',
|
||||
$rndc_key_file = '/etc/rndc.key'
|
||||
) inherits designate::params {
|
||||
include ::designate
|
||||
include ::dns
|
||||
|
||||
designate_config {
|
||||
'backend:bind9/rndc_host' : value => $rndc_host;
|
||||
'backend:bind9/rndc_port' : value => $rndc_port;
|
||||
'backend:bind9/rndc_config_file' : value => $rndc_config_file;
|
||||
'backend:bind9/rndc_key_file' : value => $rndc_key_file;
|
||||
'backend:bind9/rndc_host' : value => $rndc_host;
|
||||
'backend:bind9/rndc_port' : value => $rndc_port;
|
||||
'backend:bind9/rndc_config_file' : value => $rndc_config_file;
|
||||
'backend:bind9/rndc_key_file' : value => $rndc_key_file;
|
||||
}
|
||||
|
||||
file_line {'dns allow-new-zones':
|
||||
file_line { 'dns allow-new-zones':
|
||||
ensure => present,
|
||||
path => $::dns::params::optionspath,
|
||||
path => $::dns::optionspath,
|
||||
line => 'allow-new-zones yes;',
|
||||
require => Class['::designate'],
|
||||
notify => Service[$::dns::namedservicename]
|
||||
}
|
||||
}
|
||||
|
@@ -1,9 +1,12 @@
|
||||
# == Class designate::dns
|
||||
#
|
||||
# Configure dns for designate service
|
||||
# This class is deprecated, use designate::backend::bind9
|
||||
#
|
||||
# == Parameters
|
||||
#
|
||||
# DEPRECATED PARAMETERS
|
||||
#
|
||||
# [*designatepath*]
|
||||
# (optional) Directory for maintaining designate's state
|
||||
# Defaults to $designate::params::designatepath
|
||||
@@ -13,36 +16,10 @@
|
||||
# Defaults to $designate::params::designatefile
|
||||
#
|
||||
class designate::dns (
|
||||
$designatepath = $::designate::params::designatepath,
|
||||
$designatefile = $::designate::params::designatefile,
|
||||
) inherits designate::params {
|
||||
|
||||
include ::dns::params
|
||||
file { $designatepath:
|
||||
ensure => directory,
|
||||
owner => $::dns::params::user,
|
||||
group => $::dns::params::group,
|
||||
mode => '0770',
|
||||
}
|
||||
|
||||
exec { 'create-designatefile':
|
||||
command => "/bin/touch ${designatefile}",
|
||||
creates => $designatefile,
|
||||
require => File[$designatepath],
|
||||
}
|
||||
|
||||
file { $designatefile:
|
||||
owner => $::dns::params::user,
|
||||
group => $::dns::params::group,
|
||||
mode => '0660',
|
||||
require => Exec['create-designatefile'],
|
||||
}
|
||||
|
||||
file_line {'dns designate path':
|
||||
path => $::dns::params::namedconf_path,
|
||||
line => "include \"${designatefile}\";",
|
||||
match => '^include \"(.*)$',
|
||||
require => Class['::designate'],
|
||||
}
|
||||
|
||||
# DEPRECRATED PARAMETERS
|
||||
$designatepath = undef,
|
||||
$designatefile = undef,
|
||||
) {
|
||||
warning('The class designate::dns is depecrated. Use designate::backend::bind9 instead.')
|
||||
include ::designate::backend::bind9
|
||||
}
|
||||
|
@@ -2,9 +2,6 @@
|
||||
#
|
||||
class designate::params {
|
||||
$state_path = '/var/lib/designate'
|
||||
# bind path
|
||||
$designatepath = "${state_path}/bind9"
|
||||
$designatefile = "${state_path}/bind9/zones.config"
|
||||
# Log dir
|
||||
$log_dir = '/var/log/designate'
|
||||
$client_package_name = 'python-designateclient'
|
||||
|
@@ -57,7 +57,6 @@ describe 'basic designate' do
|
||||
class { '::designate::db':
|
||||
database_connection => 'mysql+pymysql://designate:a_big_secret@127.0.0.1/designate?charset=utf8',
|
||||
}
|
||||
include ::designate::dns
|
||||
EOS
|
||||
|
||||
# Run it once, idempotency does not work
|
||||
|
@@ -1,45 +0,0 @@
|
||||
#
|
||||
# Unit tests for designate::dns
|
||||
#
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'designate::dns' do
|
||||
|
||||
shared_examples 'designate-dns' do
|
||||
|
||||
it 'configures designate configuration folder' do
|
||||
is_expected.to contain_file(params[:designatepath]).with(:ensure => 'directory')
|
||||
end
|
||||
|
||||
it 'configures designate configuration file' do
|
||||
is_expected.to contain_file(params[:designatefile])
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
:supported_os => OSDefaults.get_supported_os
|
||||
}).each do |os,facts|
|
||||
context "on #{os}" do
|
||||
let (:facts) do
|
||||
facts.merge!(OSDefaults.get_facts())
|
||||
end
|
||||
|
||||
let(:params) do
|
||||
case facts[:osfamily]
|
||||
when 'Debian'
|
||||
{
|
||||
:designatepath => '/var/cache/bind/bind9',
|
||||
:designatefile => '/var/cache/bind/bind9/zones.config'
|
||||
}
|
||||
when 'RedHat'
|
||||
{
|
||||
:designatepath => '/var/named/bind9',
|
||||
:designatefile => '/var/named/bind9/zones.config'
|
||||
}
|
||||
end
|
||||
end
|
||||
it_behaves_like 'designate-dns'
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user