summaryrefslogtreecommitdiffstats
path: root/filters
diff options
context:
space:
mode:
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>
'''