Refactor resource dependencies
This refactors resource dependencies to improve the following points. - Avoid unnecessary dependencies across services. For example aodh service does not require cinder db. - Restart only api service when config files like paste.ini, which are used only be api service is changed. Change-Id: Iad138f5d2e8c7427e02b889c43c26f00213636f3
This commit is contained in:
parent
4947050bc7
commit
7040e66812
|
@ -436,13 +436,21 @@ class barbican::api (
|
||||||
# Debian is using UWSGI, not gunicorn
|
# Debian is using UWSGI, not gunicorn
|
||||||
if $facts['os']['name'] != 'Debian' {
|
if $facts['os']['name'] != 'Debian' {
|
||||||
file_line { 'Modify bind_port in gunicorn-config.py':
|
file_line { 'Modify bind_port in gunicorn-config.py':
|
||||||
path => '/etc/barbican/gunicorn-config.py',
|
path => '/etc/barbican/gunicorn-config.py',
|
||||||
line => "bind = '${bind_host}:${bind_port}'",
|
line => "bind = '${bind_host}:${bind_port}'",
|
||||||
match => '^bind = .*',
|
match => '^bind = .*',
|
||||||
tag => 'modify-bind-port',
|
tag => 'modify-bind-port',
|
||||||
|
require => Anchor['barbican::config::begin'],
|
||||||
|
before => Anchor['barbican::config::end'],
|
||||||
|
notify => Service['barbican-api'],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# On any paste-api.ini config change, we must restart Barbican API.
|
||||||
|
Barbican_api_paste_ini<||> ~> Service['barbican-api']
|
||||||
|
# On any uwsgi config change, we must restart Barbican API.
|
||||||
|
Barbican_api_uwsgi_config<||> ~> Service['barbican-api']
|
||||||
|
|
||||||
} elsif $service_name == 'httpd' {
|
} elsif $service_name == 'httpd' {
|
||||||
# Ubuntu packages does not have a barbican-api service
|
# Ubuntu packages does not have a barbican-api service
|
||||||
if $facts['os']['name'] != 'Ubuntu' {
|
if $facts['os']['name'] != 'Ubuntu' {
|
||||||
|
@ -456,7 +464,12 @@ class barbican::api (
|
||||||
|
|
||||||
# we need to make sure barbican-api is stopped before trying to start apache
|
# we need to make sure barbican-api is stopped before trying to start apache
|
||||||
Service['barbican-api'] -> Service[$service_name]
|
Service['barbican-api'] -> Service[$service_name]
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# On any paste-api.ini config change, we must restart Barbican API.
|
||||||
|
Barbican_api_paste_ini<||> ~> Service[$service_name]
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
fail('Invalid service_name.')
|
fail('Invalid service_name.')
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,4 +87,7 @@ class barbican::db (
|
||||||
'DEFAULT/sql_pool_max_overflow': value => $database_max_overflow;
|
'DEFAULT/sql_pool_max_overflow': value => $database_max_overflow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# all db settings should be applied and all packages should be installed
|
||||||
|
# before dbsync starts
|
||||||
|
Oslo::Db['barbican_config'] -> Anchor['barbican::dbsync::begin']
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,29 +24,13 @@ class barbican::deps {
|
||||||
~> Service<| tag == 'barbican-service' |>
|
~> Service<| tag == 'barbican-service' |>
|
||||||
~> anchor { 'barbican::service::end': }
|
~> anchor { 'barbican::service::end': }
|
||||||
|
|
||||||
# all db settings should be applied and all packages should be installed
|
|
||||||
# before dbsync starts
|
|
||||||
Oslo::Db<||> -> Anchor['barbican::dbsync::begin']
|
|
||||||
|
|
||||||
# policy config should occur in the config block also.
|
|
||||||
Anchor['barbican::config::begin']
|
|
||||||
-> Openstacklib::Policy<| tag == 'barbican' |>
|
|
||||||
-> Anchor['barbican::config::end']
|
|
||||||
|
|
||||||
# barbican-api-paste.ini config should occur in the config block also.
|
|
||||||
Anchor['barbican::config::begin']
|
Anchor['barbican::config::begin']
|
||||||
-> Barbican_api_paste_ini<||>
|
-> Barbican_api_paste_ini<||>
|
||||||
~> Anchor['barbican::config::end']
|
-> Anchor['barbican::config::end']
|
||||||
|
|
||||||
# On any uwsgi config change, we must restart Barbican API.
|
|
||||||
Anchor['barbican::config::begin']
|
Anchor['barbican::config::begin']
|
||||||
-> Barbican_api_uwsgi_config<||>
|
-> Barbican_api_uwsgi_config<||>
|
||||||
~> Anchor['barbican::config::end']
|
-> Anchor['barbican::config::end']
|
||||||
|
|
||||||
# Ensure files are modified in the config block
|
|
||||||
Anchor['barbican::config::begin']
|
|
||||||
-> File_line<| tag == 'modify-bind-port' |>
|
|
||||||
~> Anchor['barbican::config::end']
|
|
||||||
|
|
||||||
# Installation or config changes will always restart services.
|
# Installation or config changes will always restart services.
|
||||||
Anchor['barbican::install::end'] ~> Anchor['barbican::service::begin']
|
Anchor['barbican::install::end'] ~> Anchor['barbican::service::begin']
|
||||||
|
|
|
@ -279,4 +279,6 @@ class barbican::keystone::authtoken(
|
||||||
service_type => $service_type,
|
service_type => $service_type,
|
||||||
interface => $interface;
|
interface => $interface;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Keystone::Resource::Authtoken['barbican_config'] -> Anchor['barbican::config::end']
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,11 +65,15 @@ class barbican::policy (
|
||||||
file_group => $::barbican::params::group,
|
file_group => $::barbican::params::group,
|
||||||
file_format => 'yaml',
|
file_format => 'yaml',
|
||||||
purge_config => $purge_config,
|
purge_config => $purge_config,
|
||||||
tag => 'barbican',
|
|
||||||
}
|
}
|
||||||
|
|
||||||
create_resources('openstacklib::policy', { $policy_path => $policy_parameters })
|
create_resources('openstacklib::policy', { $policy_path => $policy_parameters })
|
||||||
|
|
||||||
|
# policy config should occur in the config block also.
|
||||||
|
Anchor['barbican::config::begin']
|
||||||
|
-> Openstacklib::Policy[$policy_path]
|
||||||
|
-> Anchor['barbican::config::end']
|
||||||
|
|
||||||
oslo::policy { 'barbican_config':
|
oslo::policy { 'barbican_config':
|
||||||
enforce_scope => $enforce_scope,
|
enforce_scope => $enforce_scope,
|
||||||
enforce_new_defaults => $enforce_new_defaults,
|
enforce_new_defaults => $enforce_new_defaults,
|
||||||
|
@ -77,5 +81,4 @@ class barbican::policy (
|
||||||
policy_default_rule => $policy_default_rule,
|
policy_default_rule => $policy_default_rule,
|
||||||
policy_dirs => $policy_dirs,
|
policy_dirs => $policy_dirs,
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,6 @@ describe 'barbican::policy' do
|
||||||
:file_group => 'barbican',
|
:file_group => 'barbican',
|
||||||
:file_format => 'yaml',
|
:file_format => 'yaml',
|
||||||
:purge_config => false,
|
:purge_config => false,
|
||||||
:tag => 'barbican',
|
|
||||||
)
|
)
|
||||||
is_expected.to contain_oslo__policy('barbican_config').with(
|
is_expected.to contain_oslo__policy('barbican_config').with(
|
||||||
:enforce_scope => false,
|
:enforce_scope => false,
|
||||||
|
@ -64,7 +63,6 @@ describe 'barbican::policy' do
|
||||||
:file_group => 'barbican',
|
:file_group => 'barbican',
|
||||||
:file_format => 'yaml',
|
:file_format => 'yaml',
|
||||||
:purge_config => true,
|
:purge_config => true,
|
||||||
:tag => 'barbican',
|
|
||||||
)
|
)
|
||||||
is_expected.to contain_oslo__policy('barbican_config').with(
|
is_expected.to contain_oslo__policy('barbican_config').with(
|
||||||
:enforce_scope => false,
|
:enforce_scope => false,
|
||||||
|
|
Loading…
Reference in New Issue