aboutsummaryrefslogtreecommitdiff
path: root/control/job-mangle/add-logparser.mangle
blob: 99de234830651d47679f4ab8b4f29909ef0d28c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# Reset any triggers of a job, cron triggers in particular (but not limited)

#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  "