Add deps to all that is needed

1) Add deps to all that is needed.
2) Update releated spec tests.

Change-Id: If7dffdabbb4ea57763f41b7a2a6adf9d274b29bc
This commit is contained in:
ZhongShengping
2016-11-30 11:26:11 +08:00
parent c0927a751e
commit 15b6783438
11 changed files with 40 additions and 7 deletions

View File

@@ -24,6 +24,8 @@ class cloudkitty::config (
$cloudkitty_config = {},
) {
include ::cloudkitty::deps
validate_hash($cloudkitty_config)
create_resources('cloudkitty_config', $cloudkitty_config)

View File

@@ -49,6 +49,8 @@ class cloudkitty::db (
$database_max_overflow = $::os_service_default,
) {
include ::cloudkitty::deps
validate_re($database_connection,
'^(sqlite|mysql(\+pymysql)?|postgresql):\/\/(\S+:\S+@\S+\/\S+)?')

View File

@@ -53,6 +53,8 @@ class cloudkitty::db::mysql(
$allowed_hosts = undef
) {
include ::cloudkitty::deps
validate_string($password)
::openstacklib::db::mysql { 'cloudkitty':
@@ -65,5 +67,8 @@ class cloudkitty::db::mysql(
allowed_hosts => $allowed_hosts,
}
::Openstacklib::Db::Mysql['cloudkitty'] ~> Exec<| title == 'cloudkitty-manage db_sync' |>
Anchor['cloudkitty::db::begin']
~> Class['cloudkitty::db::mysql']
~> Anchor['cloudkitty::db::end']
}

View File

@@ -40,7 +40,7 @@ class cloudkitty::db::postgresql(
$privileges = 'ALL',
) {
Class['cloudkitty::db::postgresql'] -> Service<| title == 'cloudkitty' |>
include ::cloudkitty::deps
::openstacklib::db::postgresql { 'cloudkitty':
password_hash => postgresql_password($user, $password),
@@ -50,6 +50,8 @@ class cloudkitty::db::postgresql(
privileges => $privileges,
}
::Openstacklib::Db::Postgresql['cloudkitty'] ~> Exec<| title == 'cloudkitty-manage db_sync' |>
Anchor['cloudkitty::db::begin']
~> Class['cloudkitty::db::postgresql']
~> Anchor['cloudkitty::db::end']
}

View File

@@ -26,6 +26,11 @@ class cloudkitty::deps {
~> Service<| tag == 'cloudkitty-service' |>
~> anchor { 'cloudkitty::service::end': }
# policy config should occur in the config block also.
Anchor['cloudkitty::config::begin']
-> Openstacklib::Policy::Base<||>
~> Anchor['cloudkitty::config::end']
# Installation or config changes will always restart services.
Anchor['cloudkitty::install::end'] ~> Anchor['cloudkitty::service::begin']
Anchor['cloudkitty::config::end'] ~> Anchor['cloudkitty::service::begin']

View File

@@ -69,10 +69,12 @@ class cloudkitty::keystone::auth (
$internal_url = 'http://127.0.0.1:8889',
) {
include ::cloudkitty::deps
if $configure_user_role {
Keystone_user_role["${auth_name}@${tenant}"] ~> Service <| name == 'cloudkitty-server' |>
Keystone_user_role["${auth_name}@${tenant}"] ~> Anchor['cloudkitty::service::end']
}
Keystone_endpoint["${region}/${service_name}::${service_type}"] ~> Service <| name == 'cloudkitty-server' |>
Keystone_endpoint["${region}/${service_name}::${service_type}"] ~> Anchor['cloudkitty::service::end']
keystone::resource::service_identity { 'cloudkitty':
configure_user => $configure_user,

View File

@@ -222,6 +222,8 @@ class cloudkitty::keystone::authtoken(
$token_cache_time = $::os_service_default,
) {
include ::cloudkitty::deps
keystone::resource::authtoken { 'cloudkitty_config':
username => $username,
password => $password,

View File

@@ -113,6 +113,8 @@ class cloudkitty::logging(
$log_date_format = $::os_service_default,
) {
include ::cloudkitty::deps
oslo::log { 'cloudkitty_config':
use_stderr => $use_stderr,
use_syslog => $use_syslog,

View File

@@ -28,6 +28,8 @@ class cloudkitty::policy (
$policy_path = '/etc/cloudkitty/policy.json',
) {
include ::cloudkitty::deps
validate_hash($policies)
Openstacklib::Policy::Base {

View File

@@ -10,7 +10,11 @@ describe 'cloudkitty::db::sync' do
:path => [ '/bin', '/usr/bin', ],
:refreshonly => 'true',
:user => 'cloudkitty',
:logoutput => 'on_failure'
:logoutput => 'on_failure',
:subscribe => ['Anchor[cloudkitty::install::end]',
'Anchor[cloudkitty::config::end]',
'Anchor[cloudkitty::dbsync::begin]'],
:notify => 'Anchor[cloudkitty::dbsync::end]',
)
end

View File

@@ -10,7 +10,12 @@ describe 'cloudkitty::storage' do
:path => '/usr/bin',
:refreshonly => 'true',
:user => 'cloudkitty',
:logoutput => 'on_failure'
:logoutput => 'on_failure',
:subscribe => ['Anchor[cloudkitty::install::end]',
'Anchor[cloudkitty::config::end]',
'Anchor[cloudkitty::dbsync::begin]',
'Anchor[cloudkitty::storageinit::begin]'],
:notify => 'Anchor[cloudkitty::storageinit::end]',
)
end