Update class HipChat to use convert_xml()

Change-Id: I525955073483e713e634bd1591b1344754fba289
This commit is contained in:
Yolande Amate 2017-07-08 02:31:53 +01:00
parent f05f2be5f2
commit 790030117b
1 changed files with 10 additions and 12 deletions

View File

@ -82,6 +82,7 @@ from six.moves import configparser
import jenkins_jobs.errors
import jenkins_jobs.modules.base
from jenkins_jobs.modules.helpers import convert_mapping_to_xml
logger = logging.getLogger(__name__)
@ -167,18 +168,15 @@ class HipChat(jenkins_jobs.modules.base.Base):
False))).lower()
if version >= pkg_resources.parse_version("0.1.5"):
XML.SubElement(pdefhip, 'notifySuccess').text = str(
hipchat.get('notify-success', False)).lower()
XML.SubElement(pdefhip, 'notifyAborted').text = str(
hipchat.get('notify-aborted', False)).lower()
XML.SubElement(pdefhip, 'notifyNotBuilt').text = str(
hipchat.get('notify-not-built', False)).lower()
XML.SubElement(pdefhip, 'notifyUnstable').text = str(
hipchat.get('notify-unstable', False)).lower()
XML.SubElement(pdefhip, 'notifyFailure').text = str(
hipchat.get('notify-failure', False)).lower()
XML.SubElement(pdefhip, 'notifyBackToNormal').text = str(
hipchat.get('notify-back-to-normal', False)).lower()
mapping = [
('notify-success', 'notifySuccess', False),
('notify-aborted', 'notifyAborted', False),
('notify-not-built', 'notifyNotBuilt', False),
('notify-unstable', 'notifyUnstable', False),
('notify-failure', 'notifyFailure', False),
('notify-back-to-normal', 'notifyBackToNormal', False)]
convert_mapping_to_xml(pdefhip,
hipchat, mapping, fail_required=True)
publishers = xml_parent.find('publishers')
if publishers is None: