Change default on fail_required parameter to True for convert xml

If optional setting was set and then is removed, Jenkins will retain the last
configured setting for the option. This is inconsistent as it is expected that
Jenkins will revert back to its default setting. And so optional parameters
should use default setting. That is, JJB will handle default setting if
optional parameter is not set.

Original issue:
http://lists.openstack.org/pipermail/openstack-infra/2016-February/003746.html

Change-Id: Iaf8684053f8a2a035467f13d91fe2f0a56be5906
Signed-off-by: Kien Ha <kienha9922@gmail.com>
This commit is contained in:
Kien Ha 2016-07-22 13:16:35 -04:00
parent 1614f4f992
commit 1799211e3e
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):