Update mailer plugin

- update mailer plugin to use convert xml
- add plugin="mailer" attribute
- update doc to 4 space indent syntax

Change-Id: Ib1fd30c4e1a82a0649e452b9bf03136d1e7c5ca6
This commit is contained in:
Dong Ma 2016-09-20 03:31:09 -07:00 committed by Thanh Ha
parent 5341f48085
commit 05e92d417b
No known key found for this signature in database
GPG Key ID: B0CB27E00DA095AA
6 changed files with 14 additions and 13 deletions

View File

@ -1792,11 +1792,11 @@ def email(registry, xml_parent, data):
:arg str recipients: Space separated list of recipient email addresses
(required)
(required)
:arg bool notify-every-unstable-build: Send an email for every
unstable build (default true)
unstable build (default true)
:arg bool send-to-individuals: Send an email to the individual
who broke the build (default false)
who broke the build (default false)
Example:
@ -1811,10 +1811,11 @@ def email(registry, xml_parent, data):
# TODO: raise exception if this is applied to a maven job
mailer = XML.SubElement(xml_parent,
'hudson.tasks.Mailer')
try:
XML.SubElement(mailer, 'recipients').text = data['recipients']
except KeyError as e:
raise MissingAttributeError(e)
mailer.set('plugin', 'mailer')
mapping = [
('recipients', 'recipients', None)
]
helpers.convert_mapping_to_xml(mailer, data, mapping, fail_required=True)
# Note the logic reversal (included here to match the GUI
if data.get('notify-every-unstable-build', True):

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<publishers>
<hudson.tasks.Mailer>
<hudson.tasks.Mailer plugin="mailer">
<recipients>foo@example.com bar@example.com</recipients>
<dontNotifyEveryUnstableBuild>true</dontNotifyEveryUnstableBuild>
<sendToIndividuals>true</sendToIndividuals>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<publishers>
<hudson.tasks.Mailer>
<hudson.tasks.Mailer plugin="mailer">
<recipients>foo@example.com</recipients>
<dontNotifyEveryUnstableBuild>false</dontNotifyEveryUnstableBuild>
<sendToIndividuals>false</sendToIndividuals>

View File

@ -23,7 +23,7 @@ build(&quot;job2c&quot;)
</hudson.tasks.Shell>
</builders>
<publishers>
<hudson.tasks.Mailer>
<hudson.tasks.Mailer plugin="mailer">
<recipients>developer@nowhere.net</recipients>
<dontNotifyEveryUnstableBuild>false</dontNotifyEveryUnstableBuild>
<sendToIndividuals>false</sendToIndividuals>

View File

@ -57,7 +57,7 @@
<scm class="hudson.scm.NullSCM"/>
<builders/>
<publishers>
<hudson.tasks.Mailer>
<hudson.tasks.Mailer plugin="mailer">
<recipients>qa@example.com</recipients>
<dontNotifyEveryUnstableBuild>false</dontNotifyEveryUnstableBuild>
<sendToIndividuals>false</sendToIndividuals>

View File

@ -15,7 +15,7 @@
</hudson.tasks.Shell>
</builders>
<publishers>
<hudson.tasks.Mailer>
<hudson.tasks.Mailer plugin="mailer">
<recipients>projmanager@nowhere.net</recipients>
<dontNotifyEveryUnstableBuild>false</dontNotifyEveryUnstableBuild>
<sendToIndividuals>false</sendToIndividuals>
@ -41,7 +41,7 @@
</hudson.tasks.Shell>
</builders>
<publishers>
<hudson.tasks.Mailer>
<hudson.tasks.Mailer plugin="mailer">
<recipients>developer@nowhere.net</recipients>
<dontNotifyEveryUnstableBuild>false</dontNotifyEveryUnstableBuild>
<sendToIndividuals>false</sendToIndividuals>