summaryrefslogtreecommitdiffstats
path: root/filters
diff options
context:
space:
mode:
authorJan Pokorný <jpokorny@redhat.com>2015-12-02 20:59:42 +0100
committerJan Pokorný <jpokorny@redhat.com>2015-12-17 23:35:58 +0100
commit68c0521a680dac89d046a631064f315a2c9e29b0 (patch)
treeb9177383933100c9326b1d6a5fe425db81a47882 /filters
parentae2dce82142cf62980b80d2dddad86b0653e0532 (diff)
downloadclufter-68c0521a680dac89d046a631064f315a2c9e29b0.tar.gz
clufter-68c0521a680dac89d046a631064f315a2c9e29b0.tar.xz
clufter-68c0521a680dac89d046a631064f315a2c9e29b0.zip
filters/ccs2needlexml[logging_daemon]: convert also log. subsys
Based on tri-state whitelist denoting positive propagation: - 1:1 - 1:1 but emit a warning (the meaning was changing in time) - rename the subsys Opened questions: - should CMAN also be renamed to PCMK? Also fix affected (but not directly related) unit test. Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
Diffstat (limited to 'filters')
-rw-r--r--filters/cluster/logging/logging_daemon/__init__.py64
1 files changed, 60 insertions, 4 deletions
diff --git a/filters/cluster/logging/logging_daemon/__init__.py b/filters/cluster/logging/logging_daemon/__init__.py
index ea13785..5e85430 100644
--- a/filters/cluster/logging/logging_daemon/__init__.py
+++ b/filters/cluster/logging/logging_daemon/__init__.py
@@ -3,7 +3,7 @@
# Part of clufter project
# Licensed under GPLv2+ (a copy included | http://gnu.org/licenses/gpl-2.0.txt)
-from ....utils_xslt import xslt_is_member
+from ....utils_xslt import xslt_is_member, xslt_string_mapping
from logging import getLogger
log = getLogger(__name__)
@@ -20,13 +20,69 @@ except IOError:
else:
ccs2needlexml_attrs = myglobals['ccs2needlexml_attrs'] + ('subsys', )
+# flatiron -> needle logging subsys mapping
+# domain: True (stay as is), False (ditto + warning), string (rename to this)
+ccs2needlexml_subsys = {
+ 'APIDEF': True,
+ 'CFG': True,
+ 'CONFDB': 'CMAP',
+ 'CPG': True,
+ 'PLOAD': True,
+ 'SERV': True,
+ 'SYNC': False,
+ 'SYNCV2': 'SYNC',
+ 'VOTEQ': True,
+ 'YKD': True,
+}
+
ccs2needlexml = '''\
- <xsl:if test="@name='corosync' and @subsys">
+ <xsl:if test="@name='corosync'
+ and
+ @subsys[
+ ''' + (
+ xslt_is_member('.', ccs2needlexml_subsys)
+) + '''
+ ]">
<logger_subsys>
- <xsl:copy-of select="@*[
+ <xsl:for-each select="@*[
''' + (
xslt_is_member('name()', ccs2needlexml_attrs)
-) + ''']"/>
+) + '''
+ ]">
+ <xsl:choose>
+ <xsl:when test="name() != 'subsys'
+ or
+''' + (
+ xslt_is_member('.', (k for k in ccs2needlexml_subsys
+ if ccs2needlexml_subsys[k] is True))
+) + ''' ">
+ <xsl:copy/>
+ </xsl:when>
+ <xsl:when test="
+''' + (
+ xslt_is_member('.', (k for k in ccs2needlexml_subsys
+ if ccs2needlexml_subsys[k] is False))
+) + '''">
+ <xsl:attribute name="{name()}">
+ <xsl:message>
+ <xsl:value-of select="concat('Logging subsystem',
+ ., ' originally had',
+ ' a different meaning',
+ ' but kept as is')"/>
+ </xsl:message>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="{name()}">
+ <xsl:choose>
+''' + (
+ xslt_string_mapping(ccs2needlexml_subsys)
+) + '''
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
</logger_subsys>
</xsl:if>
'''