Merge "Refactor resource dependencies"

This commit is contained in:
Zuul 2024-02-29 08:15:12 +00:00 committed by Gerrit Code Review
commit 9c0930273d
6 changed files with 29 additions and 26 deletions

View File

@ -436,13 +436,21 @@ class barbican::api (
# Debian is using UWSGI, not gunicorn
if $facts['os']['name'] != 'Debian' {
file_line { 'Modify bind_port in gunicorn-config.py':
path => '/etc/barbican/gunicorn-config.py',
line => "bind = '${bind_host}:${bind_port}'",
match => '^bind = .*',
tag => 'modify-bind-port',
path => '/etc/barbican/gunicorn-config.py',
line => "bind = '${bind_host}:${bind_port}'",
match => '^bind = .*',
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' {
# Ubuntu packages does not have a barbican-api service
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
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 {
fail('Invalid service_name.')
}

View File

@ -87,4 +87,7 @@ class barbican::db (
'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']
}

View File

@ -24,29 +24,13 @@ class barbican::deps {
~> Service<| tag == 'barbican-service' |>
~> 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']
-> 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']
-> Barbican_api_uwsgi_config<||>
~> 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']
-> Anchor['barbican::config::end']
# Installation or config changes will always restart services.
Anchor['barbican::install::end'] ~> Anchor['barbican::service::begin']

View File

@ -279,4 +279,6 @@ class barbican::keystone::authtoken(
service_type => $service_type,
interface => $interface;
}
Keystone::Resource::Authtoken['barbican_config'] -> Anchor['barbican::config::end']
}

View File

@ -65,11 +65,15 @@ class barbican::policy (
file_group => $::barbican::params::group,
file_format => 'yaml',
purge_config => $purge_config,
tag => 'barbican',
}
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':
enforce_scope => $enforce_scope,
enforce_new_defaults => $enforce_new_defaults,
@ -77,5 +81,4 @@ class barbican::policy (
policy_default_rule => $policy_default_rule,
policy_dirs => $policy_dirs,
}
}

View File

@ -33,7 +33,6 @@ describe 'barbican::policy' do
:file_group => 'barbican',
:file_format => 'yaml',
:purge_config => false,
:tag => 'barbican',
)
is_expected.to contain_oslo__policy('barbican_config').with(
:enforce_scope => false,
@ -64,7 +63,6 @@ describe 'barbican::policy' do
:file_group => 'barbican',
:file_format => 'yaml',
:purge_config => true,
:tag => 'barbican',
)
is_expected.to contain_oslo__policy('barbican_config').with(
:enforce_scope => false,