summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Pokorný <jpokorny@redhat.com>2015-07-02 23:35:01 +0200
committerJan Pokorný <jpokorny@redhat.com>2015-07-02 23:44:14 +0200
commit5255e8564d2fdc11d911a05f9c852607d759e2a5 (patch)
treefb3d7f3922d634c27822347a137e0c44dcf801ce
parentcc90e481c126f97e5c191bdfe028d61089a92e3f (diff)
downloadclufter-5255e8564d2fdc11d911a05f9c852607d759e2a5.tar.gz
clufter-5255e8564d2fdc11d911a05f9c852607d759e2a5.tar.xz
clufter-5255e8564d2fdc11d911a05f9c852607d759e2a5.zip
commands/cib2pcscmd: deserves dedicated exposure as a command
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
-rw-r--r--commands/cib2pcscmd.py51
1 files changed, 51 insertions, 0 deletions
diff --git a/commands/cib2pcscmd.py b/commands/cib2pcscmd.py
new file mode 100644
index 0000000..ba5cd51
--- /dev/null
+++ b/commands/cib2pcscmd.py
@@ -0,0 +1,51 @@
+# -*- 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)
+"""cib2pcscmd command"""
+__author__ = "Jan Pokorný <jpokorny @at@ Red Hat .dot. com>"
+
+from ..command import Command
+from ..filter import XMLFilter
+from ..protocol import protocols
+from ..utils_cib import PATH_CIB
+
+
+@Command.deco('cib2pcscmd')
+def cib2pcscmd(cmd_ctxt,
+ input=PATH_CIB,
+ output="-",
+ force=False,
+ noauth=False,
+ silent=False,
+ tmp_cib="{cib2pcscmd.defs[pcscmd_tmpcib]}",
+ dry_run=False,
+ enable=False,
+ text_width='0',
+ _common=XMLFilter.command_common):
+ """CIB -> equivalent in pcs commands
+
+ Options:
+ input input (CMAN,rgmanager) cluster config. file
+ output pcs commands to reinstate the cluster per the inputs
+ force may the force be with emitted pcs commands
+ noauth skip authentication step (OK if already set up)
+ 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)
+ text_width for commands rewrapping (0/-1/neg. ~ auto/disable/hi-limit)
+ """
+ cmd_ctxt['pcscmd_force'] = force
+ cmd_ctxt['pcscmd_noauth'] = noauth
+ cmd_ctxt['pcscmd_verbose'] = not(silent)
+ cmd_ctxt['pcscmd_tmpcib'] = tmp_cib
+ cmd_ctxt['pcscmd_dryrun'] = dry_run
+ cmd_ctxt['pcscmd_enable'] = enable
+ cmd_ctxt['text_width'] = text_width
+
+ file_proto = protocols.plugins['file'].ensure_proto
+ return (
+ file_proto(input),
+ file_proto(output),
+ )