Merge "Change default on fail_required parameter to True for convert xml"

This commit is contained in:
Zuul 2018-06-11 14:31:43 +00:00 committed by Gerrit Code Review
commit c07f2711b3
2 changed files with 3 additions and 5 deletions

View File

@ -589,7 +589,7 @@ def trigger_project(tconfigs, project_def, param_order=None):
mapping, fail_required=True)
def convert_mapping_to_xml(parent, data, mapping, fail_required=False):
def convert_mapping_to_xml(parent, data, mapping, fail_required=True):
"""Convert mapping to XML
fail_required affects the last parameter of the mapping field when it's
@ -624,12 +624,9 @@ def convert_mapping_to_xml(parent, data, mapping, fail_required=False):
valid_dict = elem[3]
# Use fail_required setting to allow support for optional parameters
# we will phase this out in the future as we rework plugins so that
# optional parameters use a default setting instead.
if val is None and fail_required is True:
raise MissingAttributeError(optname)
# (Deprecated) in the future we will default to fail_required True
# if no value is provided then continue else leave it
# up to the user if they want to use an empty XML tag
if val is None and fail_required is False:

View File

@ -388,7 +388,8 @@ def mqtt(registry, xml_parent, data):
'EXACTLY_ONCE': '2'}),
('retain-message', 'retainMessage', False)
]
helpers.convert_mapping_to_xml(mqtt, data, mqtt_mapping)
helpers.convert_mapping_to_xml(mqtt, data, mqtt_mapping,
fail_required=False)
def codecover(registry, xml_parent, data):