Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Showing
18 changed files
with
72 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,6 +59,7 @@ | |
) { | ||
|
||
include ::heat | ||
include ::heat::deps | ||
include ::heat::params | ||
include ::heat::policy | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,6 +62,7 @@ | |
) { | ||
|
||
include ::heat | ||
include ::heat::deps | ||
include ::heat::params | ||
include ::heat::policy | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,6 +61,7 @@ | |
) { | ||
|
||
include ::heat | ||
include ::heat::deps | ||
include ::heat::params | ||
include ::heat::policy | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
$ensure = 'present' | ||
) { | ||
|
||
include ::heat::deps | ||
include ::heat::params | ||
|
||
package { 'python-heatclient': | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
# | ||
class heat::db::sync { | ||
|
||
include ::heat::deps | ||
include ::heat::params | ||
|
||
exec { 'heat-dbsync': | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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'] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -168,6 +168,8 @@ | |
$admin_address = undef, | ||
) { | ||
|
||
include ::heat::deps | ||
|
||
validate_string($password) | ||
|
||
if $version { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -137,6 +137,8 @@ | |
$admin_address = undef, | ||
) { | ||
|
||
include ::heat::deps | ||
|
||
validate_string($password) | ||
|
||
if $version { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,6 +49,7 @@ | |
$keystone_tenant = undef, | ||
) { | ||
|
||
include ::heat::deps | ||
include ::heat::params | ||
|
||
if $auth_url { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |