diff --git a/jenkins_jobs/modules/triggers.py b/jenkins_jobs/modules/triggers.py index cf7db9892..a888b8f41 100644 --- a/jenkins_jobs/modules/triggers.py +++ b/jenkins_jobs/modules/triggers.py @@ -1727,23 +1727,21 @@ def ivy(registry, xml_parent, data): """ it = XML.SubElement(xml_parent, 'org.jenkinsci.plugins.ivytrigger.IvyTrigger') - mappings = [('path', 'ivyPath', None), - ('settings-path', 'ivySettingsPath', None), - ('properties-file', 'propertiesFilePath', None), - ('properties-content', 'propertiesContent', None), - ('debug', 'debug', False), - ('download-artifacts', 'downloadArtifacts', True), - ('enable-concurrent', 'enableConcurrentBuild', False), - ('cron', 'spec', '')] - for prop in mappings: - opt, xmlopt, default_val = prop[:3] - val = data.get(opt, default_val) - if val is not None: - if type(val) == bool: - val = str(val).lower() - if type(val) == list: - val = ";".join(val) - XML.SubElement(it, xmlopt).text = val + mapping = [ + ('path', 'ivyPath', None), + ('settings-path', 'ivySettingsPath', None), + ('properties-content', 'propertiesContent', None), + ('debug', 'debug', False), + ('download-artifacts', 'downloadArtifacts', True), + ('enable-concurrent', 'enableConcurrentBuild', False), + ('cron', 'spec', ''), + ] + convert_mapping_to_xml(it, data, mapping, fail_required=False) + + properties_file_path = data.get('properties-file', []) + XML.SubElement(it, 'propertiesFilePath').text = ";".join( + properties_file_path) + label = data.get('label') XML.SubElement(it, 'labelRestriction').text = str(bool(label)).lower() if label: diff --git a/tests/triggers/fixtures/ivy.xml b/tests/triggers/fixtures/ivy.xml index ae37a1cb2..47a865173 100644 --- a/tests/triggers/fixtures/ivy.xml +++ b/tests/triggers/fixtures/ivy.xml @@ -4,11 +4,11 @@ path/to/file path/to/settings/file - filename1;filename2 true true false H/15 * * * * + filename1;filename2 true master