Move deps & external hooks into a standalone class
Previously the anchors and dependencies that allow external hooks were all in the main ::heat class. However, if you wanted to include just ::heat::db::mysql, then it would fail, since it assumed the main heat class was included. This moves all of those resources and relationships into a new class, ::heat::deps. All of the classes will now include this class so that the anchors and deps are always evaluated even if only a portion of the classes are used, and even if ::heat isn't pulled in. Change-Id: I4297df160a7afae2b66c1ac76e37de313fa4fb09 Closes-Bug: #1507934
This commit is contained in:
parent
3b9cdd01bc
commit
dca9fe942b
@ -59,6 +59,7 @@ class heat::api (
|
||||
) {
|
||||
|
||||
include ::heat
|
||||
include ::heat::deps
|
||||
include ::heat::params
|
||||
include ::heat::policy
|
||||
|
||||
|
@ -62,6 +62,7 @@ class heat::api_cfn (
|
||||
) {
|
||||
|
||||
include ::heat
|
||||
include ::heat::deps
|
||||
include ::heat::params
|
||||
include ::heat::policy
|
||||
|
||||
|
@ -61,6 +61,7 @@ class heat::api_cloudwatch (
|
||||
) {
|
||||
|
||||
include ::heat
|
||||
include ::heat::deps
|
||||
include ::heat::params
|
||||
include ::heat::policy
|
||||
|
||||
|
@ -11,6 +11,7 @@ class heat::client (
|
||||
$ensure = 'present'
|
||||
) {
|
||||
|
||||
include ::heat::deps
|
||||
include ::heat::params
|
||||
|
||||
package { 'python-heatclient':
|
||||
|
@ -24,6 +24,8 @@ class heat::config (
|
||||
$heat_config = {},
|
||||
) {
|
||||
|
||||
include ::heat::deps
|
||||
|
||||
validate_hash($heat_config)
|
||||
|
||||
create_resources('heat_config', $heat_config)
|
||||
|
@ -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)
|
||||
|
@ -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.')
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -3,6 +3,7 @@
|
||||
#
|
||||
class heat::db::sync {
|
||||
|
||||
include ::heat::deps
|
||||
include ::heat::params
|
||||
|
||||
exec { 'heat-dbsync':
|
||||
|
30
manifests/deps.pp
Normal file
30
manifests/deps.pp
Normal 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']
|
||||
}
|
@ -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
|
||||
|
@ -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']
|
||||
}
|
||||
|
@ -168,6 +168,8 @@ class heat::keystone::auth (
|
||||
$admin_address = undef,
|
||||
) {
|
||||
|
||||
include ::heat::deps
|
||||
|
||||
validate_string($password)
|
||||
|
||||
if $version {
|
||||
|
@ -137,6 +137,8 @@ class heat::keystone::auth_cfn (
|
||||
$admin_address = undef,
|
||||
) {
|
||||
|
||||
include ::heat::deps
|
||||
|
||||
validate_string($password)
|
||||
|
||||
if $version {
|
||||
|
@ -49,6 +49,7 @@ class heat::keystone::domain (
|
||||
$keystone_tenant = undef,
|
||||
) {
|
||||
|
||||
include ::heat::deps
|
||||
include ::heat::params
|
||||
|
||||
if $auth_url {
|
||||
|
@ -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)
|
||||
|
@ -23,6 +23,8 @@ class heat::policy (
|
||||
$policy_path = '/etc/heat/policy.json',
|
||||
) {
|
||||
|
||||
include ::heat::deps
|
||||
|
||||
validate_hash($policies)
|
||||
|
||||
Openstacklib::Policy::Base {
|
||||
|
17
spec/classes/heat_deps_spec.rb
Normal file
17
spec/classes/heat_deps_spec.rb
Normal 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
|
Loading…
Reference in New Issue
Block a user