summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Pokorný <jpokorny@redhat.com>2015-12-10 16:03:53 +0100
committerJan Pokorný <jpokorny@redhat.com>2015-12-17 23:38:08 +0100
commit834945dccc2be3ec6c811d2d314f9de657205971 (patch)
tree73e7cf1af45a1de0f41fd9bd53452c61e06813e2
parenta7973f7a20a2a388703d51755a557a5e97d9320b (diff)
downloadclufter-834945dccc2be3ec6c811d2d314f9de657205971.tar.gz
clufter-834945dccc2be3ec6c811d2d314f9de657205971.tar.xz
clufter-834945dccc2be3ec6c811d2d314f9de657205971.zip
filters/cib2pcscmd[{op,rsc}_defaults]: handle defaults as well
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
-rw-r--r--filters/cib/configuration/__init__.py2
-rw-r--r--filters/cib/configuration/op_defaults/__init__.py31
-rw-r--r--filters/cib/configuration/rsc_defaults/__init__.py31
3 files changed, 64 insertions, 0 deletions
diff --git a/filters/cib/configuration/__init__.py b/filters/cib/configuration/__init__.py
index 2d00544..3354cb4 100644
--- a/filters/cib/configuration/__init__.py
+++ b/filters/cib/configuration/__init__.py
@@ -194,6 +194,8 @@ cib2pcscmd = ('''\
) + '''
</xsl:if>
<clufter:descent-mix at="crm_config"/>
+ <clufter:descent-mix at="rsc_defaults"/>
+ <clufter:descent-mix at="op_defaults"/>
<clufter:descent-mix at="nodes"/>
<clufter:descent-mix at="resources"/>
<clufter:descent-mix at="constraints"/>
diff --git a/filters/cib/configuration/op_defaults/__init__.py b/filters/cib/configuration/op_defaults/__init__.py
new file mode 100644
index 0000000..c217efc
--- /dev/null
+++ b/filters/cib/configuration/op_defaults/__init__.py
@@ -0,0 +1,31 @@
+# -*- coding: UTF-8 -*-
+# Copyright 2015 Red Hat, Inc.
+# Part of clufter project
+# Licensed under GPLv2+ (a copy included | http://gnu.org/licenses/gpl-2.0.txt)
+__author__ = "Jan Pokorný <jpokorny @at@ Red Hat .dot. com>"
+
+###
+
+from ....filters._2pcscmd import verbose_ec_test, verbose_inform
+from ....utils_xslt import NL
+
+
+cib2pcscmd = ('''\
+ <xsl:if test="meta_attributes/nvpair">
+''' + (
+ verbose_inform('"set operation defaults"')
+) + '''
+ <xsl:value-of select='concat($pcscmd_pcs, "resource op defaults")'/>
+ <xsl:for-each select="meta_attributes">
+ <xsl:for-each select="nvpair">
+ <xsl:value-of select='concat(" &apos;", @name, "=", @value, "&apos;")'/>
+ </xsl:for-each>
+ </xsl:for-each>
+ <xsl:value-of select="'%(NL)s'"/>
+''' + (
+ verbose_ec_test
+) + '''
+ </xsl:if>
+''') % dict(
+ NL=NL,
+)
diff --git a/filters/cib/configuration/rsc_defaults/__init__.py b/filters/cib/configuration/rsc_defaults/__init__.py
new file mode 100644
index 0000000..fc6b733
--- /dev/null
+++ b/filters/cib/configuration/rsc_defaults/__init__.py
@@ -0,0 +1,31 @@
+# -*- coding: UTF-8 -*-
+# Copyright 2015 Red Hat, Inc.
+# Part of clufter project
+# Licensed under GPLv2+ (a copy included | http://gnu.org/licenses/gpl-2.0.txt)
+__author__ = "Jan Pokorný <jpokorny @at@ Red Hat .dot. com>"
+
+###
+
+from ....filters._2pcscmd import verbose_ec_test, verbose_inform
+from ....utils_xslt import NL
+
+
+cib2pcscmd = ('''\
+ <xsl:if test="meta_attributes/nvpair">
+''' + (
+ verbose_inform('"set resource defaults"')
+) + '''
+ <xsl:value-of select='concat($pcscmd_pcs, "resource defaults")'/>
+ <xsl:for-each select="meta_attributes">
+ <xsl:for-each select="nvpair">
+ <xsl:value-of select='concat(" &apos;", @name, "=", @value, "&apos;")'/>
+ </xsl:for-each>
+ </xsl:for-each>
+ <xsl:value-of select="'%(NL)s'"/>
+''' + (
+ verbose_ec_test
+) + '''
+ </xsl:if>
+''') % dict(
+ NL=NL,
+)