Add action_providers and legacy_action_providers
This adds two new classes to configure the config groups action_providers and legacy_action_providers in the Mistral configuration. Some config opts were introduced in [1] and others already existed and has been added as well. [1] https://review.opendev.org/c/openstack/mistral/+/944015/3 Change-Id: I6302ff41f1bad8c01defb915077ee621faa05b60
This commit is contained in:
27
manifests/action_providers.pp
Normal file
27
manifests/action_providers.pp
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
# == Class: mistral::action_providers
|
||||||
|
#
|
||||||
|
# Configure the action_providers config section.
|
||||||
|
#
|
||||||
|
# === Parameters
|
||||||
|
#
|
||||||
|
# [*allowlist*]
|
||||||
|
# (Optional) Allowlist with actions that is allowed to be
|
||||||
|
# loaded, if empty all actions will be allowed.
|
||||||
|
# Defaults to $facts['os_service_default']
|
||||||
|
|
||||||
|
# [*denylist*]
|
||||||
|
# (Optional) Denylist with actions that is not allowed to
|
||||||
|
# be loaded, allowlist takes precedence, if empty all actions
|
||||||
|
# will be allowed.
|
||||||
|
# Defaults to $facts['os_service_default']
|
||||||
|
#
|
||||||
|
class mistral::action_providers (
|
||||||
|
$allowlist = $facts['os_service_default'],
|
||||||
|
$denylist = $facts['os_service_default'],
|
||||||
|
) {
|
||||||
|
|
||||||
|
mistral_config {
|
||||||
|
'action_providers/allowlist': value => $allowlist;
|
||||||
|
'action_providers/denylist': value => $denylist;
|
||||||
|
}
|
||||||
|
}
|
||||||
50
manifests/legacy_action_providers.pp
Normal file
50
manifests/legacy_action_providers.pp
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
# == Class: mistral::legacy_action_providers
|
||||||
|
#
|
||||||
|
# Configure the legacy_action_providers config section.
|
||||||
|
#
|
||||||
|
# === Parameters
|
||||||
|
#
|
||||||
|
# [*load_action_plugins*]
|
||||||
|
# (Optional) Enables loading actions configured in the
|
||||||
|
# entry point "mistral.actions".
|
||||||
|
# Defaults to $facts['os_service_default']
|
||||||
|
#
|
||||||
|
# [*load_action_generators*]
|
||||||
|
# (Optional) Enables loading actions from action generators
|
||||||
|
# configured in the entry point "mistral.generators".
|
||||||
|
# Defaults to $facts['os_service_default']
|
||||||
|
#
|
||||||
|
# [*only_builtin_actions*]
|
||||||
|
# (Optional) If True, then the legacy action provider loads
|
||||||
|
# only the actions delivered by the Mistral project out of
|
||||||
|
# the box plugged in with the entry point "mistral.actions".
|
||||||
|
# This property is needed mostly for testing.'
|
||||||
|
# Defaults to $facts['os_service_default']
|
||||||
|
#
|
||||||
|
# [*allowlist*]
|
||||||
|
# (Optional) Allowlist with actions that is allowed to be
|
||||||
|
# loaded, if empty all actions will be allowed.
|
||||||
|
# Defaults to $facts['os_service_default']
|
||||||
|
|
||||||
|
# [*denylist*]
|
||||||
|
# (Optional) Denylist with actions that is not allowed to
|
||||||
|
# be loaded, allowlist takes precedence, if empty all actions
|
||||||
|
# will be allowed.
|
||||||
|
# Defaults to $facts['os_service_default']
|
||||||
|
#
|
||||||
|
class mistral::legacy_action_providers (
|
||||||
|
$load_action_plugins = $facts['os_service_default'],
|
||||||
|
$load_action_generators = $facts['os_service_default'],
|
||||||
|
$only_builtin_actions = $facts['os_service_default'],
|
||||||
|
$allowlist = $facts['os_service_default'],
|
||||||
|
$denylist = $facts['os_service_default'],
|
||||||
|
) {
|
||||||
|
|
||||||
|
mistral_config {
|
||||||
|
'legacy_action_providers/load_action_plugins': value => $load_action_plugins;
|
||||||
|
'legacy_action_providers/load_action_generators': value => $load_action_generators;
|
||||||
|
'legacy_action_providers/only_builtin_actions': value => $only_builtin_actions;
|
||||||
|
'legacy_action_providers/allowlist': value => $allowlist;
|
||||||
|
'legacy_action_providers/denylist': value => $denylist;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
Added ``mistral::action_providers`` and ``mistral::legacy_action_providers``
|
||||||
|
classes to configure the ``[action_providers]`` and ``[legacy_action_providers]``
|
||||||
|
configuration groups in Mistral.
|
||||||
42
spec/classes/mistral_action_providers_spec.rb
Normal file
42
spec/classes/mistral_action_providers_spec.rb
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe 'mistral::action_providers' do
|
||||||
|
let :params do
|
||||||
|
{}
|
||||||
|
end
|
||||||
|
|
||||||
|
shared_examples 'mistral::action_providers' do
|
||||||
|
context 'with defaults' do
|
||||||
|
it {
|
||||||
|
is_expected.to contain_mistral_config('action_providers/allowlist').with_value('<SERVICE DEFAULT>')
|
||||||
|
is_expected.to contain_mistral_config('action_providers/denylist').with_value('<SERVICE DEFAULT>')
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'with parameters' do
|
||||||
|
before do
|
||||||
|
params.merge!({
|
||||||
|
:allowlist => ['test'],
|
||||||
|
:denylist => ['test2'],
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
it {
|
||||||
|
is_expected.to contain_mistral_config('action_providers/allowlist').with_value(['test'])
|
||||||
|
is_expected.to contain_mistral_config('action_providers/denylist').with_value(['test2'])
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
on_supported_os({
|
||||||
|
:supported_os => OSDefaults.get_supported_os
|
||||||
|
}).each do |os,facts|
|
||||||
|
context "on #{os}" do
|
||||||
|
let (:facts) do
|
||||||
|
facts.merge!(OSDefaults.get_facts())
|
||||||
|
end
|
||||||
|
|
||||||
|
it_behaves_like 'mistral::action_providers'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
51
spec/classes/mistral_legacy_action_providers_spec.rb
Normal file
51
spec/classes/mistral_legacy_action_providers_spec.rb
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe 'mistral::legacy_action_providers' do
|
||||||
|
let :params do
|
||||||
|
{}
|
||||||
|
end
|
||||||
|
|
||||||
|
shared_examples 'mistral::legacy_action_providers' do
|
||||||
|
context 'with defaults' do
|
||||||
|
it {
|
||||||
|
is_expected.to contain_mistral_config('legacy_action_providers/load_action_plugins').with_value('<SERVICE DEFAULT>')
|
||||||
|
is_expected.to contain_mistral_config('legacy_action_providers/load_action_generators').with_value('<SERVICE DEFAULT>')
|
||||||
|
is_expected.to contain_mistral_config('legacy_action_providers/only_builtin_actions').with_value('<SERVICE DEFAULT>')
|
||||||
|
is_expected.to contain_mistral_config('legacy_action_providers/allowlist').with_value('<SERVICE DEFAULT>')
|
||||||
|
is_expected.to contain_mistral_config('legacy_action_providers/denylist').with_value('<SERVICE DEFAULT>')
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'with parameters' do
|
||||||
|
before do
|
||||||
|
params.merge!({
|
||||||
|
:load_action_plugins => true,
|
||||||
|
:load_action_generators => false,
|
||||||
|
:only_builtin_actions => true,
|
||||||
|
:allowlist => ['test'],
|
||||||
|
:denylist => ['test2'],
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
it {
|
||||||
|
is_expected.to contain_mistral_config('legacy_action_providers/load_action_plugins').with_value(true)
|
||||||
|
is_expected.to contain_mistral_config('legacy_action_providers/load_action_generators').with_value(false)
|
||||||
|
is_expected.to contain_mistral_config('legacy_action_providers/only_builtin_actions').with_value(true)
|
||||||
|
is_expected.to contain_mistral_config('legacy_action_providers/allowlist').with_value(['test'])
|
||||||
|
is_expected.to contain_mistral_config('legacy_action_providers/denylist').with_value(['test2'])
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
on_supported_os({
|
||||||
|
:supported_os => OSDefaults.get_supported_os
|
||||||
|
}).each do |os,facts|
|
||||||
|
context "on #{os}" do
|
||||||
|
let (:facts) do
|
||||||
|
facts.merge!(OSDefaults.get_facts())
|
||||||
|
end
|
||||||
|
|
||||||
|
it_behaves_like 'mistral::legacy_action_providers'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user