Fix typo in ircbot's default matrix-notifier.

* Add a test fixture for the ircbot plugin that shows the bug.
* Fix the bug.

Update: Extract original example from the documentation as
ircbot001.yaml and include in the doc via literalinclude.  Add a
second test case, ircbot002.yaml to demonstrate the bug fixed by this
patch.

Closes-Bug: #1290376
Change-Id: Ifcb96a6dab5ee923cee7d3e71bfe518f1e3d0ebc
This commit is contained in:
Randy Coulman 2014-03-10 07:04:07 -07:00
parent bed596e8c6
commit 70ea148123
5 changed files with 73 additions and 19 deletions

View File

@ -2736,25 +2736,9 @@ def ircbot(parser, xml_parent, data):
* **only-configurations** (default)
* **only-parent**
Example::
publishers:
- ircbot:
strategy: all
notify-start: false
notify-committers: false
notify-culprits: false
notify-upstream: false
notify-fixers: false
message-type: summary-scm
channels:
- name: '#jenkins-channel1'
password: secrete
notify-only: false
- name: '#jenkins-channel2'
notify-only: true
matrix-notifier: only-configurations
Example:
.. literalinclude:: /../../tests/publishers/fixtures/ircbot001.yaml
"""
top = XML.SubElement(xml_parent, 'hudson.plugins.ircbot.IrcPublisher')
message_dict = {'summary-scm': 'DefaultBuildToChatNotifier',
@ -2801,7 +2785,7 @@ def ircbot(parser, xml_parent, data):
matrix_dict = {'all': 'ALL',
'only-configurations': 'ONLY_CONFIGURATIONS',
'only-parent': 'ONLY_PARENT'}
matrix = data.get('matrix-notifier', 'only_configurations')
matrix = data.get('matrix-notifier', 'only-configurations')
if matrix not in matrix_dict:
raise JenkinsJobsException("matrix-notifier entered is not valid, "
"must be one of: %s" %

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<publishers>
<hudson.plugins.ircbot.IrcPublisher>
<buildToChatNotifier class="hudson.plugins.im.build_notify.DefaultBuildToChatNotifier"/>
<strategy>ALL</strategy>
<targets>
<hudson.plugins.im.GroupChatIMMessageTarget>
<name>#jenkins-channel1</name>
<password>secrete</password>
<notificationOnly>false</notificationOnly>
</hudson.plugins.im.GroupChatIMMessageTarget>
<hudson.plugins.im.GroupChatIMMessageTarget>
<name>#jenkins-channel2</name>
<password/>
<notificationOnly>true</notificationOnly>
</hudson.plugins.im.GroupChatIMMessageTarget>
</targets>
<notifyOnBuildStart>false</notifyOnBuildStart>
<notifySuspects>false</notifySuspects>
<notifyCulprits>false</notifyCulprits>
<notifyFixers>false</notifyFixers>
<notifyUpstreamCommitters>false</notifyUpstreamCommitters>
<matrixMultiplier>ONLY_CONFIGURATIONS</matrixMultiplier>
</hudson.plugins.ircbot.IrcPublisher>
</publishers>
</project>

View File

@ -0,0 +1,16 @@
publishers:
- ircbot:
strategy: all
notify-start: false
notify-committers: false
notify-culprits: false
notify-upstream: false
notify-fixers: false
message-type: summary-scm
channels:
- name: '#jenkins-channel1'
password: secrete
notify-only: false
- name: '#jenkins-channel2'
notify-only: true
matrix-notifier: only-configurations

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<publishers>
<hudson.plugins.ircbot.IrcPublisher>
<buildToChatNotifier class="hudson.plugins.im.build_notify.DefaultBuildToChatNotifier"/>
<strategy>ALL</strategy>
<targets>
<hudson.plugins.im.GroupChatIMMessageTarget>
<name>#jenkins-channel</name>
<password/>
<notificationOnly>true</notificationOnly>
</hudson.plugins.im.GroupChatIMMessageTarget>
</targets>
<notifyOnBuildStart>false</notifyOnBuildStart>
<notifySuspects>false</notifySuspects>
<notifyCulprits>false</notifyCulprits>
<notifyFixers>false</notifyFixers>
<notifyUpstreamCommitters>false</notifyUpstreamCommitters>
<matrixMultiplier>ONLY_CONFIGURATIONS</matrixMultiplier>
</hudson.plugins.ircbot.IrcPublisher>
</publishers>
</project>

View File

@ -0,0 +1,5 @@
publishers:
- ircbot:
channels:
- name: '#jenkins-channel'
notify-only: true