Refactor resource dependencies

This refactors resource dependencies to avoid unnecessary dependencies
across services.

Change-Id: I0f0c12f77eb39cb1d1c68fe2b02050ada257aabb
This commit is contained in:
Takashi Kajinami 2024-04-08 11:17:09 +09:00
parent 9c6139b7d1
commit 8fe204a3f0
5 changed files with 11 additions and 12 deletions

View File

@ -61,4 +61,8 @@ class {{cookiecutter.project_name}}::db (
max_overflow => $database_max_overflow,
pool_timeout => $database_pool_timeout,
}
# all db settings should be applied and all packages should be installed
# before dbsync starts
Oslo::Db['{{cookiecutter.project_name}}_config'] -> Anchor['{{cookiecutter.project_name}}::dbsync::begin']
}

View File

@ -27,15 +27,6 @@ class {{cookiecutter.project_name}}::deps {
~> Service<| tag == '{{cookiecutter.project_name}}-service' |>
~> anchor { '{{cookiecutter.project_name}}::service::end': }
# all db settings should be applied and all packages should be installed
# before dbsync starts
Oslo::Db<||> -> Anchor['{{cookiecutter.project_name}}::dbsync::begin']
# policy config should occur in the config block also.
Anchor['{{cookiecutter.project_name}}::config::begin']
-> Openstacklib::Policy<| tag == '{{cookiecutter.project_name}}' |>
~> Anchor['{{cookiecutter.project_name}}::config::end']
# Installation or config changes will always restart services.
Anchor['{{cookiecutter.project_name}}::install::end'] ~> Anchor['{{cookiecutter.project_name}}::service::begin']
Anchor['{{cookiecutter.project_name}}::config::end'] ~> Anchor['{{cookiecutter.project_name}}::service::begin']

View File

@ -272,5 +272,7 @@ class {{cookiecutter.project_name}}::keystone::authtoken(
service_type => $service_type,
interface => $interface,
}
Keystone::Resource::Authtoken['{{cookiecutter.project_name}}_config'] -> Anchor['{{cookiecutter.project_name}}::service::begin']
}

View File

@ -65,11 +65,15 @@ class {{cookiecutter.project_name}}::policy (
file_group => $::{{cookiecutter.project_name}}::params::group,
file_format => 'yaml',
purge_config => $purge_config,
tag => '{{cookiecutter.project_name}}',
}
create_resources('openstacklib::policy', { $policy_path => $policy_parameters })
# policy config should occur in the config block also.
Anchor['{{cookiecutter.project_name}}::config::begin']
-> Openstacklib::Policy[$policy_path]
-> Anchor['{{cookiecutter.project_name}}::config::end']
oslo::policy { '{{cookiecutter.project_name}}_config':
enforce_scope => $enforce_scope,
enforce_new_defaults => $enforce_new_defaults,

View File

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