Merge "Update class HipChat to use convert_xml()"

This commit is contained in:
Jenkins 2017-07-10 20:38:15 +00:00 committed by Gerrit Code Review
commit 0328c88755
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: