mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-26 14:41:23 -07:00
enforce required config
This commit is contained in:
parent
f426fcd9a6
commit
cbedbd3c9c
1 changed files with 14 additions and 5 deletions
|
@ -343,6 +343,15 @@ class ConfigManager(object):
|
||||||
|
|
||||||
# set default if we got here w/o a value
|
# set default if we got here w/o a value
|
||||||
if value is None:
|
if value is None:
|
||||||
|
if defs[config].get('required', False):
|
||||||
|
entry = ''
|
||||||
|
if plugin_type:
|
||||||
|
entry += 'plugin_type: %s ' % plugin_type
|
||||||
|
if plugin_name:
|
||||||
|
entry += 'plugin: %s ' % plugin_name
|
||||||
|
entry += 'setting: %s ' % config
|
||||||
|
raise AnsibleError("No setting was provided for required configuration %s" % (entry))
|
||||||
|
else:
|
||||||
value = defs[config].get('default')
|
value = defs[config].get('default')
|
||||||
origin = 'default'
|
origin = 'default'
|
||||||
# skip typing as this is a temlated default that will be resolved later in constants, which has needed vars
|
# skip typing as this is a temlated default that will be resolved later in constants, which has needed vars
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue