1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# -*- coding: UTF-8 -*-
# Copyright 2014 Red Hat, Inc.
# Part of clufter project
# Licensed under GPLv2 (a copy included | http://gnu.org/licenses/gpl-2.0.txt)
flatccs2pcs = '''\
<template id="{concat('FENCEDEV-', @name)}"
class="stonith"
type="{@agent}">
<xsl:variable name='FenceDevName' select="@name"/>
<instance_attributes id="{concat('FENCEDEV-', @name, '-ATTRS')}">
<xsl:for-each select="@*[name() != 'agent' and name() != 'name']">
<nvpair id="{concat('FENCEDEV-', $FenceDevName, '-ATTRS-', name())}"
name="{name()}"
value="{.}"/>
</xsl:for-each>
</instance_attributes>
</template>
'''
ccs_obfuscate_credentials = '''\
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:for-each select="@*[contains(concat(
'|passwd',
'|snmp_priv_passwd',
'|'), concat('|', name(), '|'))]">
<xsl:attribute name="{name()}">SECRET-PASSWORD</xsl:attribute>
</xsl:for-each>
<xsl:for-each select="@*[contains(concat(
'|login',
'|'), concat('|', name(), '|'))]">
<xsl:attribute name="{name()}">SECRET-LOGIN</xsl:attribute>
</xsl:for-each>
<xsl:apply-templates/>
</xsl:copy>
'''
|