Merge "Move deps & external hooks into a standalone class"

This commit is contained in:
Jenkins 2015-10-23 12:11:06 +00:00 committed by Gerrit Code Review
commit 416b57d850
18 changed files with 72 additions and 25 deletions

View File

@ -59,6 +59,7 @@ class heat::api (
) {
include ::heat
include ::heat::deps
include ::heat::params
include ::heat::policy

View File

@ -62,6 +62,7 @@ class heat::api_cfn (
) {
include ::heat
include ::heat::deps
include ::heat::params
include ::heat::policy

View File

@ -61,6 +61,7 @@ class heat::api_cloudwatch (
) {
include ::heat
include ::heat::deps
include ::heat::params
include ::heat::policy

View File

@ -11,6 +11,7 @@ class heat::client (
$ensure = 'present'
) {
include ::heat::deps
include ::heat::params
package { 'python-heatclient':

View File

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

View File

@ -48,6 +48,8 @@ class heat::db (
$sync_db = true,
) {
include ::heat::deps
# NOTE(spredzy): In order to keep backward compatibility we rely on the pick function
# to use heat::<myparam> if heat::db::<myparam> isn't specified.
$database_connection_real = pick($::heat::database_connection, $database_connection)

View File

@ -50,6 +50,8 @@ class heat::db::mysql(
$mysql_module = undef
) {
include ::heat::deps
if $mysql_module {
warning('The mysql_module parameter is deprecated. The latest 2.x mysql module will be used.')
}

View File

@ -32,6 +32,8 @@ class heat::db::postgresql(
$privileges = 'ALL',
) {
include ::heat::deps
::openstacklib::db::postgresql { 'heat':
password_hash => postgresql_password($user, $password),
dbname => $dbname,

View File

@ -3,6 +3,7 @@
#
class heat::db::sync {
include ::heat::deps
include ::heat::params
exec { 'heat-dbsync':

30
manifests/deps.pp Normal file
View File

@ -0,0 +1,30 @@
# == Class: heat::deps
#
# Heat anchors and dependency management
#
class heat::deps {
# Setup anchors for install, config and service phases of the module. These
# anchors allow external modules to hook the begin and end of any of these
# phases. Package or service management can also be replaced by ensuring the
# package is absent or turning off service management and having the
# replacement depend on the appropriate anchors. When applicable, end tags
# should be notified so that subscribers can determine if installation,
# config or service state changed and act on that if needed.
anchor { 'heat::install::begin': }
-> Package<| tag == 'heat-package'|>
~> anchor { 'heat::install::end': }
-> anchor { 'heat::config::begin': }
-> Heat_config<||>
~> anchor { 'heat::config::end': }
-> anchor { 'heat::db::begin': }
-> anchor { 'heat::db::end': }
~> anchor { 'heat::dbsync::begin': }
-> anchor { 'heat::dbsync::end': }
~> anchor { 'heat::service::begin': }
~> Service<| tag == 'heat-service' |>
~> anchor { 'heat::service::end': }
# Installation or config changes will always restart services.
Anchor['heat::install::end'] ~> Anchor['heat::service::begin']
Anchor['heat::config::end'] ~> Anchor['heat::service::begin']
}

View File

@ -93,6 +93,8 @@ class heat::engine (
$trusts_delegated_roles = ['heat_stack_owner'],
) {
include ::heat::deps
# Validate Heat Engine AES key
# must be either 16, 24, or 32 bytes long
# https://bugs.launchpad.net/heat/+bug/1415887

View File

@ -299,6 +299,7 @@ class heat(
include ::heat::logging
include ::heat::db
include ::heat::deps
include ::heat::params
if $kombu_ssl_ca_certs and !$rabbit_use_ssl {
@ -544,29 +545,4 @@ class heat(
} else {
heat_config { 'DEFAULT/enable_stack_abandon': ensure => absent; }
}
# Setup anchors for install, config and service phases of the module. These
# anchors allow external modules to hook the begin and end of any of these
# phases. Package or service management can also be replaced by ensuring the
# package is absent or turning off service management and having the
# replacement depend on the appropriate anchors. When applicable, end tags
# should be notified so that subscribers can determine if installation,
# config or service state changed and act on that if needed.
anchor { 'heat::install::begin': }
-> Package<| tag == 'heat-package'|>
~> anchor { 'heat::install::end': }
-> anchor { 'heat::config::begin': }
-> Heat_config<||>
~> anchor { 'heat::config::end': }
-> anchor { 'heat::db::begin': }
-> anchor { 'heat::db::end': }
~> anchor { 'heat::dbsync::begin': }
-> anchor { 'heat::dbsync::end': }
~> anchor { 'heat::service::begin': }
~> Service<| tag == 'heat-service' |>
~> anchor { 'heat::service::end': }
# Installation or config changes will always restart services.
Anchor['heat::install::end'] ~> Anchor['heat::service::begin']
Anchor['heat::config::end'] ~> Anchor['heat::service::begin']
}

View File

@ -168,6 +168,8 @@ class heat::keystone::auth (
$admin_address = undef,
) {
include ::heat::deps
validate_string($password)
if $version {

View File

@ -137,6 +137,8 @@ class heat::keystone::auth_cfn (
$admin_address = undef,
) {
include ::heat::deps
validate_string($password)
if $version {

View File

@ -49,6 +49,7 @@ class heat::keystone::domain (
$keystone_tenant = undef,
) {
include ::heat::deps
include ::heat::params
if $auth_url {

View File

@ -110,6 +110,8 @@ class heat::logging(
$log_date_format = undef,
) {
include ::heat::deps
# NOTE(spredzy): In order to keep backward compatibility we rely on the pick function
# to use heat::<myparam> first then heat::logging::<myparam>.
$use_syslog_real = pick($::heat::use_syslog,$use_syslog)

View File

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

View File

@ -0,0 +1,17 @@
require 'spec_helper'
describe 'heat::deps' do
it 'set up the anchors' do
is_expected.to contain_anchor('heat::install::begin')
is_expected.to contain_anchor('heat::install::end')
is_expected.to contain_anchor('heat::config::begin')
is_expected.to contain_anchor('heat::config::end')
is_expected.to contain_anchor('heat::db::begin')
is_expected.to contain_anchor('heat::db::end')
is_expected.to contain_anchor('heat::dbsync::begin')
is_expected.to contain_anchor('heat::dbsync::end')
is_expected.to contain_anchor('heat::service::begin')
is_expected.to contain_anchor('heat::service::end')
end
end