Change db classes in puppet-glare module

- removing spaces from exec title in db:sync
- adding additional folders into path parametr

Change-Id: I085f08a4ca2a9e13e3b0bc75f383bb1f9e8f393a
This commit is contained in:
Peter Zhurba 2016-09-15 13:16:08 +03:00
parent 564c1f7930
commit 54d8acc9dc
4 changed files with 30 additions and 10 deletions

View File

@ -65,5 +65,5 @@ class glare::db::mysql(
allowed_hosts => $allowed_hosts,
}
::Openstacklib::Db::Mysql['glare'] ~> Exec<| title == 'glare-manage db_sync' |>
::Openstacklib::Db::Mysql['glare'] ~> Exec<| title == 'glare-db-sync' |>
}

View File

@ -50,6 +50,6 @@ class glare::db::postgresql(
privileges => $privileges,
}
::Openstacklib::Db::Postgresql['glare'] ~> Exec<| title == 'glare-manage db_sync' |>
::Openstacklib::Db::Postgresql['glare'] ~> Exec<| title == 'glare-db-sync' |>
}

View File

@ -1,23 +1,23 @@
#
# Class to execute glare-manage db_sync
# Class to execute glare-db-manage
#
# == Parameters
#
# [*extra_params*]
# (optional) String of extra command line parameters to append
# to the glare-dbsync command.
# Defaults to undef
# to the glare-db-manage command.
# Defaults to '--config-file /etc/glare.conf'
#
class glare::db::sync(
$extra_params = undef,
$extra_params = '',
) {
exec { 'glare-db-sync':
command => "glare-manage db_sync ${extra_params}",
path => '/usr/bin',
command => "glare-db-manage ${extra_params} upgrade",
user => 'glare',
path => [ '/bin/', '/usr/bin/' , '/usr/local/bin' ],
refreshonly => true,
subscribe => [Package['glare'], Glare_config['database/connection']],
}
Exec['glare-manage db_sync'] ~> Service<| title == 'glare' |>
Exec['glare-db-sync'] ~> Service<| title == 'glare' |>
}

View File

@ -0,0 +1,20 @@
require 'spec_helper'
describe 'glare::db::sync' do
context 'exec has proper name' do
it { is_expected.to contain_exec('glare-db-sync') }
end
context 'class sync default command' do
it { is_expected.to contain_exec('glare-db-sync').with_command(
'glare-db-manage upgrade') }
end
context 'class sync work with parameters' do
let :params do
{ :extra_params => '-yyy' }
end
it { is_expected.to contain_exec('glare-db-sync').with_command('glare-db-manage -yyy upgrade') }
end
end