summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Pokorný <jpokorny@redhat.com>2015-06-08 21:03:02 +0200
committerJan Pokorný <jpokorny@redhat.com>2015-06-19 17:32:18 +0200
commit1cf55b2e5a7540670dcd49d4e426b53173ed1732 (patch)
tree497af04f98630b4aa91605fa9456afb58fdad719
parenta765c30697038b75018450674a9238712316474e (diff)
downloadclufter-1cf55b2e5a7540670dcd49d4e426b53173ed1732.tar.gz
clufter-1cf55b2e5a7540670dcd49d4e426b53173ed1732.tar.xz
clufter-1cf55b2e5a7540670dcd49d4e426b53173ed1732.zip
commands/ccs2pcscmd-flatiron: add "--enable" switch
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
-rw-r--r--commands/ccs2pcscmd.py3
-rw-r--r--filters/ccspcmk2pcscmd.py1
-rw-r--r--filters/cluster/__init__.py15
-rw-r--r--tests/filters/ccspcmk2pcscmd.py2
4 files changed, 18 insertions, 3 deletions
diff --git a/commands/ccs2pcscmd.py b/commands/ccs2pcscmd.py
index 50fd7f3..436e6d7 100644
--- a/commands/ccs2pcscmd.py
+++ b/commands/ccs2pcscmd.py
@@ -28,6 +28,7 @@ def ccs2pcscmd_flatiron(cmd_ctxt,
silent=False,
tmp_cib="tmp-cib.xml", # ~ filters.cib2pcscmd.TMP_CIB
dry_run=False,
+ enable=False,
_common=XMLFilter.command_common):
"""(CMAN,rgmanager) cluster cfg. -> equivalent in pcs commands
@@ -39,6 +40,7 @@ def ccs2pcscmd_flatiron(cmd_ctxt,
silent do not track the progress along the steps execution (echoes)
tmp_cib file to accumulate the changes (empty ~ direct push)
dry_run omit intrusive commands (TMP_CIB reset if empty)
+ enable enable cluster infrastructure services (autostart on reboot)
"""
if dry_run and not tmp_cib:
@@ -48,6 +50,7 @@ def ccs2pcscmd_flatiron(cmd_ctxt,
cmd_ctxt['pcscmd_verbose'] = not(silent)
cmd_ctxt['pcscmd_tmpcib'] = tmp_cib
cmd_ctxt['pcscmd_dryrun'] = dry_run
+ cmd_ctxt['pcscmd_enable'] = enable
file_proto = protocols.plugins['file'].ensure_proto
return (
file_proto(input),
diff --git a/filters/ccspcmk2pcscmd.py b/filters/ccspcmk2pcscmd.py
index 05c1140..2a56d75 100644
--- a/filters/ccspcmk2pcscmd.py
+++ b/filters/ccspcmk2pcscmd.py
@@ -23,6 +23,7 @@ def ccspcmk2pcscmd(flt_ctxt, in_obj):
pcscmd_noauth=xslt_boolean(flt_ctxt.get('pcscmd_noauth', 0)),
pcscmd_verbose=xslt_boolean(flt_ctxt.get('pcscmd_verbose', 1)),
pcscmd_dryrun=xslt_boolean(flt_ctxt.get('pcscmd_dryrun', 0)),
+ pcscmd_enable=xslt_boolean(flt_ctxt.get('pcscmd_enable', 0)),
),
),
)
diff --git a/filters/cluster/__init__.py b/filters/cluster/__init__.py
index 40c62ee..44edd08 100644
--- a/filters/cluster/__init__.py
+++ b/filters/cluster/__init__.py
@@ -660,8 +660,16 @@ ccspcmk2pcscmd = ('''\
''' + (
verbose_inform('"new cluster: ", @name')
) + '''
- <xsl:value-of select="concat('pcs cluster setup --start',
- ' --name ', @name)"/>
+ <xsl:value-of select="'pcs cluster setup --start'"/>
+ <xsl:choose>
+ <xsl:when test="$pcscmd_enable">
+ <xsl:value-of select="' --enable'"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>%(msg_enable)s</xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:value-of select="concat(' --name ', @name)"/>
<clufter:descent-mix at="clusternode"/>
<clufter:descent-mix at="cman"/>
@@ -673,4 +681,7 @@ ccspcmk2pcscmd = ('''\
</xsl:if>
''') % dict(
NL=NL,
+ msg_enable="NOTE: cluster infrastructure services not enabled"
+ " at this point, which can be changed any time by issuing:"
+ " pcs cluster enable --all",
)
diff --git a/tests/filters/ccspcmk2pcscmd.py b/tests/filters/ccspcmk2pcscmd.py
index dceaaa9..07fef33 100644
--- a/tests/filters/ccspcmk2pcscmd.py
+++ b/tests/filters/ccspcmk2pcscmd.py
@@ -24,7 +24,7 @@ class FiltersCcspcmk2pcscmdTestCase(TestCase):
#print ret.BYTESTRING()
self.assertEquals(
ret.BYTESTRING(),
- "pcs cluster setup --name test ju hele"
+ "pcs cluster setup --start --name test ju hele"
" --consensus 200 --join 100 --token 5000\n"
)