Allow customization of db sync command line
Add parameter to designate::db::sync class to allow end users to add command line parameters to the db sync command. Change-Id: Iae224e97d91ee24e0aae1b79330f0906ff516508 Partial-bug: #1472740
This commit is contained in:
@@ -1,12 +1,22 @@
|
||||
#
|
||||
# Class to execute designate powerdns dbsync
|
||||
#
|
||||
class designate::db::powerdns::sync {
|
||||
# ==Parameters
|
||||
#
|
||||
# [*extra_params*]
|
||||
# (optional) String of extra command line parameters to append
|
||||
# to the designate-manage powerdns sync command. These will be
|
||||
# inserted in the command line between 'designate-manage' and
|
||||
# 'powerdns sync'.
|
||||
# Defaults to undef
|
||||
class designate::db::powerdns::sync(
|
||||
$extra_params = undef,
|
||||
) {
|
||||
|
||||
include ::designate::params
|
||||
|
||||
exec { 'designate-powerdns-dbsync':
|
||||
command => $::designate::params::powerdns_dbsync_command,
|
||||
command => "designate-manage ${extra_params} powerdns sync",
|
||||
path => '/usr/bin',
|
||||
user => 'root',
|
||||
refreshonly => true,
|
||||
|
@@ -1,12 +1,23 @@
|
||||
#
|
||||
# Class to execute designate dbsync
|
||||
#
|
||||
class designate::db::sync {
|
||||
# ==Parameters
|
||||
#
|
||||
# [*extra_params*]
|
||||
# (optional) String of extra command line parameters to append
|
||||
# to the designate-manage database sync command. These will be
|
||||
# inserted in the command line between 'designate-manage' and
|
||||
# 'database sync'.
|
||||
# Defaults to undef
|
||||
#
|
||||
class designate::db::sync(
|
||||
$extra_params = undef,
|
||||
) {
|
||||
|
||||
include ::designate::params
|
||||
|
||||
exec { 'designate-dbsync':
|
||||
command => $::designate::params::dbsync_command,
|
||||
command => "designate-manage ${extra_params} database sync",
|
||||
path => '/usr/bin',
|
||||
user => 'root',
|
||||
refreshonly => true,
|
||||
|
@@ -1,8 +1,6 @@
|
||||
# Params
|
||||
#
|
||||
class designate::params {
|
||||
$dbsync_command = 'designate-manage database sync'
|
||||
$powerdns_dbsync_command = 'designate-manage powerdns sync'
|
||||
$state_path = '/var/lib/designate'
|
||||
# bind path
|
||||
$designatepath = "${state_path}/bind9"
|
||||
|
@@ -11,7 +11,7 @@ describe 'designate::db::powerdns::sync' do
|
||||
|
||||
it 'runs designate-powerdns-dbsync' do
|
||||
is_expected.to contain_exec('designate-powerdns-dbsync').with(
|
||||
:command => 'designate-manage powerdns sync',
|
||||
:command => 'designate-manage powerdns sync',
|
||||
:path => '/usr/bin',
|
||||
:user => 'root',
|
||||
:refreshonly => 'true',
|
||||
@@ -21,4 +21,24 @@ describe 'designate::db::powerdns::sync' do
|
||||
)
|
||||
end
|
||||
|
||||
describe 'overriding extra_params' do
|
||||
let :params do
|
||||
{
|
||||
:extra_params => '--config-file /etc/designate/designate.conf'
|
||||
}
|
||||
end
|
||||
|
||||
it {is_expected.to contain_exec('designate-powerdns-dbsync').with(
|
||||
:command => 'designate-manage --config-file /etc/designate/designate.conf powerdns sync',
|
||||
:path => '/usr/bin',
|
||||
:user => 'root',
|
||||
:refreshonly => 'true',
|
||||
:logoutput => 'on_failure',
|
||||
:subscribe => 'Anchor[designate::config::end]',
|
||||
:notify => 'Anchor[designate::service::begin]',
|
||||
)
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
@@ -11,7 +11,7 @@ describe 'designate::db::sync' do
|
||||
|
||||
it 'runs designate-dbsync' do
|
||||
is_expected.to contain_exec('designate-dbsync').with(
|
||||
:command => 'designate-manage database sync',
|
||||
:command => 'designate-manage database sync',
|
||||
:path => '/usr/bin',
|
||||
:user => 'root',
|
||||
:refreshonly => 'true',
|
||||
@@ -21,4 +21,24 @@ describe 'designate::db::sync' do
|
||||
)
|
||||
end
|
||||
|
||||
describe 'overriding extra_params' do
|
||||
let :params do
|
||||
{
|
||||
:extra_params => '--config-file /etc/designate/designate.conf'
|
||||
}
|
||||
end
|
||||
|
||||
it {is_expected.to contain_exec('designate-dbsync').with(
|
||||
:command => 'designate-manage --config-file /etc/designate/designate.conf database sync',
|
||||
:path => '/usr/bin',
|
||||
:user => 'root',
|
||||
:refreshonly => 'true',
|
||||
:logoutput => 'on_failure',
|
||||
:subscribe => 'Anchor[designate::config::end]',
|
||||
:notify => 'Anchor[designate::service::begin]',
|
||||
)
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
Reference in New Issue
Block a user