Update LogStash plugin to use convert xml

- Fix doc syntax
- Add plugin="logstash" attribute

Change-Id: Ie5ea7e230d8d406bc0a597da6342a6f36e09b952
Signed-off-by: Kien Ha <kienha9922@gmail.com>
This commit is contained in:
Kien Ha 2016-07-28 21:08:48 -04:00
parent a88104422e
commit 57a0a2235f
3 changed files with 15 additions and 12 deletions

View File

@ -5253,28 +5253,31 @@ def logstash(parser, xml_parent, data):
your job data. Also stores test metrics from Junit.
Requires the Jenkins :jenkins-wiki:`Logstash Plugin <Logstash+Plugin>`.
:arg num max-lines: The maximum number of log lines to send to Logstash.
( default 1000 )
:arg int max-lines: The maximum number of log lines to send to Logstash.
(default 1000)
:arg bool fail-build: Mark build as failed if this step fails.
( default false )
(default false)
Minimal Example:
.. literalinclude:: /../../tests/publishers/fixtures/logstash-min.yaml
:language: yaml
Full Example:
.. literalinclude:: /../../tests/publishers/fixtures/logstash-full.yaml
:language: yaml
"""
logstash = XML.SubElement(xml_parent,
'jenkins.plugins.logstash.LogstashNotifier')
XML.SubElement(logstash, 'maxLines').text = str(
data.get('max-lines', 1000))
logstash.set('plugin', 'logstash')
XML.SubElement(logstash, 'failBuild').text = str(
data.get('fail-build', False))
mapping = [
('max-lines', 'maxLines', 1000),
('fail-build', 'failBuild', False),
]
helpers.convert_mapping_to_xml(logstash, data, mapping, fail_required=True)
def image_gallery(parser, xml_parent, data):

View File

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<publishers>
<jenkins.plugins.logstash.LogstashNotifier>
<jenkins.plugins.logstash.LogstashNotifier plugin="logstash">
<maxLines>2000</maxLines>
<failBuild>True</failBuild>
<failBuild>true</failBuild>
</jenkins.plugins.logstash.LogstashNotifier>
</publishers>
</project>

View File

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<publishers>
<jenkins.plugins.logstash.LogstashNotifier>
<jenkins.plugins.logstash.LogstashNotifier plugin="logstash">
<maxLines>1000</maxLines>
<failBuild>False</failBuild>
<failBuild>false</failBuild>
</jenkins.plugins.logstash.LogstashNotifier>
</publishers>
</project>