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:
parent
5341f48085
commit
05e92d417b
@ -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):
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -23,7 +23,7 @@ build("job2c")
|
||||
</hudson.tasks.Shell>
|
||||
</builders>
|
||||
<publishers>
|
||||
<hudson.tasks.Mailer>
|
||||
<hudson.tasks.Mailer plugin="mailer">
|
||||
<recipients>developer@nowhere.net</recipients>
|
||||
<dontNotifyEveryUnstableBuild>false</dontNotifyEveryUnstableBuild>
|
||||
<sendToIndividuals>false</sendToIndividuals>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user