Add hooks for external install & svc management
This adds defined anchor points for external modules to hook into the software install, config and service dependency chain. This allows external modules to manage software installation (virtualenv, containers, etc) and service management (pacemaker) without needing rely on resources that may change or be renamed. Change-Id: If27e91cee37d816bfc7b577a154c71a9e5a48324
This commit is contained in:
parent
8bfb89bcb8
commit
9412a6f45a
@ -32,12 +32,10 @@ class murano::api(
|
||||
$port = $::os_service_default,
|
||||
) {
|
||||
|
||||
include ::murano::deps
|
||||
include ::murano::params
|
||||
include ::murano::policy
|
||||
|
||||
Murano_config<||> ~> Service['murano-api']
|
||||
Class['murano::policy'] -> Service['murano-api']
|
||||
|
||||
if $manage_service {
|
||||
if $enabled {
|
||||
$service_ensure = 'running'
|
||||
@ -58,14 +56,10 @@ class murano::api(
|
||||
}
|
||||
|
||||
service { 'murano-api':
|
||||
ensure => $service_ensure,
|
||||
name => $::murano::params::api_service_name,
|
||||
enable => $enabled,
|
||||
require => Package['murano-api'],
|
||||
tag => 'murano-service',
|
||||
ensure => $service_ensure,
|
||||
name => $::murano::params::api_service_name,
|
||||
enable => $enabled,
|
||||
tag => 'murano-service',
|
||||
}
|
||||
|
||||
Package['murano-api'] ~> Service['murano-api']
|
||||
Murano_paste_ini_config<||> ~> Service['murano-api']
|
||||
|
||||
}
|
||||
|
@ -35,6 +35,8 @@ define murano::application (
|
||||
$public = true,
|
||||
) {
|
||||
|
||||
include ::murano::deps
|
||||
|
||||
$package_path="/var/cache/murano/meta/${package_name}.zip"
|
||||
|
||||
murano_application { $package_name:
|
||||
|
@ -41,12 +41,10 @@ class murano::cfapi(
|
||||
$auth_url = 'http://127.0.0.1:5000',
|
||||
) {
|
||||
|
||||
include ::murano::deps
|
||||
include ::murano::params
|
||||
include ::murano::policy
|
||||
|
||||
Murano_cfapi_config<||> ~> Service['murano-cfapi']
|
||||
Class['murano::policy'] -> Service['murano-cfapi']
|
||||
|
||||
if $manage_service {
|
||||
if $enabled {
|
||||
$service_ensure = 'running'
|
||||
@ -69,13 +67,10 @@ class murano::cfapi(
|
||||
}
|
||||
|
||||
service { 'murano-cfapi':
|
||||
ensure => $service_ensure,
|
||||
name => $::murano::params::cfapi_service_name,
|
||||
enable => $enabled,
|
||||
require => Package['murano-cfapi'],
|
||||
tag => 'murano-service',
|
||||
ensure => $service_ensure,
|
||||
name => $::murano::params::cfapi_service_name,
|
||||
enable => $enabled,
|
||||
tag => 'murano-service',
|
||||
}
|
||||
|
||||
Package['murano-cfapi'] ~> Service['murano-cfapi']
|
||||
Murano_cfapi_paste_ini_config<||> ~> Service['murano-cfapi']
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ class murano::client(
|
||||
$package_ensure = 'present',
|
||||
) {
|
||||
|
||||
include ::murano::deps
|
||||
include ::murano::params
|
||||
|
||||
package { 'python-muranoclient':
|
||||
|
@ -36,6 +36,8 @@ class murano::config (
|
||||
$murano_cfapi_paste_config = {}
|
||||
) {
|
||||
|
||||
include ::murano::deps
|
||||
|
||||
validate_hash($murano_config)
|
||||
validate_hash($murano_cfapi_config)
|
||||
validate_hash($murano_paste_config)
|
||||
|
@ -63,6 +63,7 @@ class murano::dashboard(
|
||||
$sync_db = true,
|
||||
) {
|
||||
|
||||
include ::murano::deps
|
||||
include ::murano::params
|
||||
|
||||
package { 'murano-dashboard':
|
||||
|
@ -49,6 +49,8 @@ class murano::db (
|
||||
$database_db_max_retries = $::os_service_default,
|
||||
) {
|
||||
|
||||
include ::murano::deps
|
||||
|
||||
# NOTE(aderyugin): In order to keep backward compatibility we rely on the pick function
|
||||
# to use murano::<myparam> if murano::db::<myparam> isn't specified.
|
||||
$database_connection_real = pick($::murano::database_connection, $database_connection)
|
||||
|
@ -42,6 +42,8 @@ class murano::db::mysql(
|
||||
$collate = 'utf8_general_ci',
|
||||
) {
|
||||
|
||||
include ::murano::deps
|
||||
|
||||
validate_string($password)
|
||||
|
||||
::openstacklib::db::mysql{ 'murano':
|
||||
@ -54,5 +56,8 @@ class murano::db::mysql(
|
||||
allowed_hosts => $allowed_hosts,
|
||||
}
|
||||
|
||||
::Openstacklib::Db::Mysql['murano'] ~> Exec<| title == 'murano-dbmanage' |>
|
||||
Anchor['murano::db::begin']
|
||||
~> Class['murano::db::mysql']
|
||||
~> Anchor['murano::db::end']
|
||||
|
||||
}
|
||||
|
@ -32,6 +32,8 @@ class murano::db::postgresql(
|
||||
$privileges = 'ALL',
|
||||
) {
|
||||
|
||||
include ::murano::deps
|
||||
|
||||
validate_string($password)
|
||||
|
||||
::openstacklib::db::postgresql { 'murano':
|
||||
@ -42,6 +44,8 @@ class murano::db::postgresql(
|
||||
privileges => $privileges,
|
||||
}
|
||||
|
||||
::Openstacklib::Db::Postgresql['murano'] ~> Exec<| title == 'murano-dbmanage' |>
|
||||
Anchor['murano::db::begin']
|
||||
~> Class['murano::db::postgresql']
|
||||
~> Anchor['murano::db::end']
|
||||
|
||||
}
|
||||
|
@ -3,13 +3,9 @@
|
||||
#
|
||||
class murano::db::sync {
|
||||
|
||||
include ::murano::deps
|
||||
include ::murano::params
|
||||
|
||||
Package <| title == 'murano-common' |> ~> Exec['murano-dbmanage']
|
||||
Exec['murano-dbmanage'] ~> Service <| tag == 'murano-service' |>
|
||||
|
||||
Murano_config <| title == 'database/connection' |> ~> Exec['murano-dbmanage']
|
||||
|
||||
exec { 'murano-dbmanage':
|
||||
command => $::murano::params::dbmanage_command,
|
||||
path => '/usr/bin',
|
||||
@ -18,6 +14,12 @@ class murano::db::sync {
|
||||
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'],
|
||||
}
|
||||
|
||||
}
|
||||
|
35
manifests/deps.pp
Normal file
35
manifests/deps.pp
Normal file
@ -0,0 +1,35 @@
|
||||
# == Class: murano::deps
|
||||
#
|
||||
# Murano anchors and dependency management
|
||||
#
|
||||
class murano::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 { 'murano::install::begin': }
|
||||
-> Package<| tag == 'murano-package'|>
|
||||
~> anchor { 'murano::install::end': }
|
||||
-> anchor { 'murano::config::begin': }
|
||||
-> Murano_config<||>
|
||||
~> anchor { 'murano::config::end': }
|
||||
-> anchor { 'murano::db::begin': }
|
||||
-> anchor { 'murano::db::end': }
|
||||
~> anchor { 'murano::dbsync::begin': }
|
||||
-> anchor { 'murano::dbsync::end': }
|
||||
~> anchor { 'murano::service::begin': }
|
||||
~> Service<| tag == 'murano-service' |>
|
||||
~> anchor { 'murano::service::end': }
|
||||
|
||||
# policy config should occur in the config block also.
|
||||
Anchor['murano::config::begin']
|
||||
-> Openstacklib::Policy::Base<||>
|
||||
~> Anchor['murano::config::end']
|
||||
|
||||
# Installation or config changes will always restart services.
|
||||
Anchor['murano::install::end'] ~> Anchor['murano::service::begin']
|
||||
Anchor['murano::config::end'] ~> Anchor['murano::service::begin']
|
||||
}
|
@ -27,12 +27,10 @@ class murano::engine(
|
||||
$workers = $::os_service_default,
|
||||
) {
|
||||
|
||||
include ::murano::deps
|
||||
include ::murano::params
|
||||
include ::murano::policy
|
||||
|
||||
Murano_config<||> ~> Service['murano-engine']
|
||||
Class['murano::policy'] -> Service['murano-engine']
|
||||
|
||||
if $manage_service {
|
||||
if $enabled {
|
||||
$service_ensure = 'running'
|
||||
@ -52,13 +50,10 @@ class murano::engine(
|
||||
}
|
||||
|
||||
service { 'murano-engine':
|
||||
ensure => $service_ensure,
|
||||
name => $::murano::params::engine_service_name,
|
||||
enable => $enabled,
|
||||
require => Package['murano-engine'],
|
||||
tag => 'murano-service',
|
||||
ensure => $service_ensure,
|
||||
name => $::murano::params::engine_service_name,
|
||||
enable => $enabled,
|
||||
tag => 'murano-service',
|
||||
}
|
||||
|
||||
Package['murano-engine'] ~> Service['murano-engine']
|
||||
|
||||
}
|
||||
|
@ -320,6 +320,7 @@ class murano(
|
||||
$rabbit_os_password = 'guest',
|
||||
) {
|
||||
|
||||
include ::murano::deps
|
||||
include ::murano::params
|
||||
include ::murano::logging
|
||||
include ::murano::policy
|
||||
|
@ -85,6 +85,8 @@ class murano::keystone::auth(
|
||||
$internal_url = 'http://127.0.0.1:8082',
|
||||
) {
|
||||
|
||||
include ::murano::deps
|
||||
|
||||
keystone::resource::service_identity { 'murano':
|
||||
configure_user => $configure_user,
|
||||
configure_user_role => $configure_user_role,
|
||||
|
@ -85,6 +85,7 @@ class murano::keystone::cfapi_auth(
|
||||
$internal_url = 'http://127.0.0.1:8083',
|
||||
) {
|
||||
|
||||
include ::murano::deps
|
||||
|
||||
keystone::resource::service_identity { 'murano-cfapi':
|
||||
configure_user => $configure_user,
|
||||
|
@ -104,6 +104,8 @@ class murano::logging(
|
||||
$log_date_format = $::os_service_default,
|
||||
) {
|
||||
|
||||
include ::murano::deps
|
||||
|
||||
# NOTE(aderyugin): In order to keep backward compatibility we rely on the pick function
|
||||
# to use murano::<myparam> if murano::logging::<myparam> isn't specified.
|
||||
$use_syslog_real = pick($::murano::use_syslog, $use_syslog)
|
||||
|
@ -17,6 +17,8 @@ class murano::policy (
|
||||
$policy_path = '/etc/murano/policy.json',
|
||||
) {
|
||||
|
||||
include ::murano::deps
|
||||
|
||||
validate_hash($policies)
|
||||
|
||||
Openstacklib::Policy::Base {
|
||||
|
@ -0,0 +1,10 @@
|
||||
---
|
||||
prelude: >
|
||||
Add hooks for external install & svc management.
|
||||
features:
|
||||
- This adds defined anchor points for external modules to
|
||||
hook into the software install, config and service dependency
|
||||
chain. This allows external modules to manage software
|
||||
installation (virtualenv, containers, etc) and service management
|
||||
(pacemaker) without needing rely on resources that may change or
|
||||
be renamed.
|
@ -12,6 +12,7 @@ describe 'murano::cfapi' do
|
||||
end
|
||||
|
||||
shared_examples_for 'with default parameters' do
|
||||
it { is_expected.to contain_class('murano::deps') }
|
||||
it { is_expected.to contain_class('murano::params') }
|
||||
it { is_expected.to contain_class('murano::policy') }
|
||||
|
||||
|
@ -12,7 +12,11 @@ describe 'murano::db::sync' do
|
||||
:refreshonly => 'true',
|
||||
:try_sleep => 5,
|
||||
:tries => 10,
|
||||
: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
|
||||
|
||||
|
@ -14,6 +14,7 @@ describe 'murano' do
|
||||
end
|
||||
|
||||
context 'with default parameters' do
|
||||
it { is_expected.to contain_class('murano::deps') }
|
||||
it { is_expected.to contain_class('murano::params') }
|
||||
it { is_expected.to contain_class('murano::policy') }
|
||||
it { is_expected.to contain_class('murano::db') }
|
||||
|
@ -15,7 +15,6 @@ shared_examples 'generic murano service' do |service|
|
||||
is_expected.to contain_package(service[:name]).with({
|
||||
:name => service[:package_name],
|
||||
:ensure => 'present',
|
||||
:notify => ["Service[#{service[:name]}]"],
|
||||
:tag => [ 'openstack', 'murano-package'],
|
||||
})
|
||||
is_expected.to contain_service(service[:name]).with({
|
||||
@ -41,7 +40,6 @@ shared_examples 'generic murano service' do |service|
|
||||
is_expected.to contain_package(service[:name]).with({
|
||||
:name => service[:package_name],
|
||||
:ensure => '2014.2-1',
|
||||
:notify => ["Service[#{service[:name]}]"],
|
||||
:tag => [ 'openstack', 'murano-package'],
|
||||
})
|
||||
is_expected.to contain_service(service[:name]).with({
|
||||
|
Loading…
Reference in New Issue
Block a user