aboutsummaryrefslogtreecommitdiff
path: root/utils/mangle-jobs/logparser-add.mangle
blob: 597a66ee1a75816b8ccb6d59d460474f64f2bb27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# Add Log Parser plugin application to jobs

#from lxml.etree import Element
from lxml.etree import fromstring

def mangle(tree):
    if tree.xpath("//hudson.plugins.logparser.LogParserPublisher"):
        # Already there
        return
    tag = tree.xpath('//publishers')[0]
    node = fromstring("""\
    <hudson.plugins.logparser.LogParserPublisher>
      <unstableOnWarning>false</unstableOnWarning>
      <failBuildOnError>false</failBuildOnError>
      <parsingRulesPath>/var/lib/jenkins/userContent/android.parse</parsingRulesPath>
    </hudson.plugins.logparser.LogParserPublisher>
""")
    tag.append(node)
    node.getprevious().tail += "  "
    node.tail = "\n  "