From 49ab8921cad07f5cc5121435b86459e9453c65ed Mon Sep 17 00:00:00 2001 From: ZhongShengping Date: Fri, 16 Dec 2016 09:39:15 +0800 Subject: [PATCH] Add deps to all that is needed 1) Add deps to all that is needed. 2) Remove useless hooks 3) Update releated spec tests. Change-Id: Ic69d8af5f28f5ccb6d0439ef3189522b8ab40b92 --- manifests/db/mysql_cfapi.pp | 7 ++++++- manifests/db/postgresql_cfapi.pp | 6 +++++- manifests/db/sync_cfapi.pp | 12 +++++++----- manifests/db_cfapi.pp | 2 ++ manifests/logging_cfapi.pp | 2 ++ spec/classes/murano_db_sync_cfapi_spec.rb | 6 +++++- 6 files changed, 27 insertions(+), 8 deletions(-) diff --git a/manifests/db/mysql_cfapi.pp b/manifests/db/mysql_cfapi.pp index 9429246..4d5a588 100644 --- a/manifests/db/mysql_cfapi.pp +++ b/manifests/db/mysql_cfapi.pp @@ -42,6 +42,8 @@ class murano::db::mysql_cfapi( $collate = 'utf8_general_ci', ) { + include ::murano::deps + validate_string($password) ::openstacklib::db::mysql{ 'murano_cfapi': @@ -54,5 +56,8 @@ class murano::db::mysql_cfapi( allowed_hosts => $allowed_hosts, } - ::Openstacklib::Db::Mysql['murano_cfapi'] ~> Exec<| title == 'murano-cfapi-dbmanage' |> + Anchor['murano::db::begin'] + ~> Class['murano::db::mysql_cfapi'] + ~> Anchor['murano::db::end'] + } diff --git a/manifests/db/postgresql_cfapi.pp b/manifests/db/postgresql_cfapi.pp index b38fb4f..0ccfab8 100644 --- a/manifests/db/postgresql_cfapi.pp +++ b/manifests/db/postgresql_cfapi.pp @@ -32,6 +32,8 @@ class murano::db::postgresql_cfapi( $privileges = 'ALL', ) { + include ::murano::deps + validate_string($password) ::openstacklib::db::postgresql { 'murano_cfapi': @@ -42,6 +44,8 @@ class murano::db::postgresql_cfapi( privileges => $privileges, } - ::Openstacklib::Db::Postgresql['murano_cfapi'] ~> Exec<| title == 'murano-cfapi-dbmanage' |> + Anchor['murano::db::begin'] + ~> Class['murano::db::postgresql_cfapi'] + ~> Anchor['murano::db::end'] } diff --git a/manifests/db/sync_cfapi.pp b/manifests/db/sync_cfapi.pp index 3b11e8c..64c7b9c 100644 --- a/manifests/db/sync_cfapi.pp +++ b/manifests/db/sync_cfapi.pp @@ -3,13 +3,9 @@ # class murano::db::sync_cfapi { + include ::murano::deps include ::murano::params - Package <| title == 'murano-common' |> ~> Exec['murano-cfapi-dbmanage'] - Exec['murano-cfapi-dbmanage'] ~> Service <| tag == 'murano-service' |> - - Murano_cfapi_config <| title == 'database/connection' |> ~> Exec['murano-cfapi-dbmanage'] - exec { 'murano-cfapi-dbmanage': command => $::murano::params::cfapi_dbmanage_command, path => '/usr/bin', @@ -18,6 +14,12 @@ class murano::db::sync_cfapi { try_sleep => 5, tries => 10, logoutput => on_failure, + subscribe => [ + Anchor['murano::install::end'], + Anchor['murano::config::end'], + Anchor['murano::dbsync::begin'] + ], + notify => Anchor['murano::dbsync::end'], } } diff --git a/manifests/db_cfapi.pp b/manifests/db_cfapi.pp index 0d24265..1e8eaa0 100644 --- a/manifests/db_cfapi.pp +++ b/manifests/db_cfapi.pp @@ -49,6 +49,8 @@ class murano::db_cfapi ( $database_db_max_retries = $::os_service_default, ) { + include ::murano::deps + if !is_service_default($database_connection) { validate_re($database_connection, '^(mysql(\+pymysql)?|postgresql):\/\/(\S+:\S+@\S+\/\S+)?') diff --git a/manifests/logging_cfapi.pp b/manifests/logging_cfapi.pp index e7ea422..2ae36e4 100644 --- a/manifests/logging_cfapi.pp +++ b/manifests/logging_cfapi.pp @@ -104,6 +104,8 @@ class murano::logging_cfapi( $log_date_format = $::os_service_default, ) { + include ::murano::deps + oslo::log { 'murano_cfapi_config': debug => $debug, use_syslog => $use_syslog, diff --git a/spec/classes/murano_db_sync_cfapi_spec.rb b/spec/classes/murano_db_sync_cfapi_spec.rb index 6f779ac..60c203a 100644 --- a/spec/classes/murano_db_sync_cfapi_spec.rb +++ b/spec/classes/murano_db_sync_cfapi_spec.rb @@ -10,7 +10,11 @@ describe 'murano::db::sync_cfapi' do :path => '/usr/bin', :user => 'murano_cfapi', :refreshonly => 'true', - :logoutput => 'on_failure' + :logoutput => 'on_failure', + :subscribe => ['Anchor[murano::install::end]', + 'Anchor[murano::config::end]', + 'Anchor[murano::dbsync::begin]'], + :notify => 'Anchor[murano::dbsync::end]', ) end