Revision ea9d3b40 lib/client/gnt_cluster.py

b/lib/client/gnt_cluster.py
26 26
# W0614: Unused import %s from wildcard import (since we need cli)
27 27
# C0103: Invalid name gnt-cluster
28 28

  
29
from cStringIO import StringIO
29 30
import os.path
30 31
import time
31 32
import OpenSSL
......
1491 1492
    return _off_fn(opts, node_list, inst_map)
1492 1493

  
1493 1494

  
1495
def _GetCreateCommand(info):
1496
  buf = StringIO()
1497
  buf.write("gnt-cluster init")
1498
  PrintIPolicyCommand(buf, info["ipolicy"], False)
1499
  buf.write(" ")
1500
  buf.write(info["name"])
1501
  return buf.getvalue()
1502

  
1503

  
1504
def ShowCreateCommand(opts, args):
1505
  """Shows the command that can be used to re-create the cluster.
1506

  
1507
  Currently it works only for ipolicy specs.
1508

  
1509
  """
1510
  cl = GetClient(query=True)
1511
  result = cl.QueryClusterInfo()
1512
  ToStdout(_GetCreateCommand(result))
1513

  
1514

  
1494 1515
commands = {
1495 1516
  "init": (
1496 1517
    InitCluster, [ArgHost(min=1, max=1)],
......
1603 1624
  "deactivate-master-ip": (
1604 1625
    DeactivateMasterIp, ARGS_NONE, [CONFIRM_OPT], "",
1605 1626
    "Deactivates the master IP"),
1627
  "show-ispecs-cmd": (
1628
    ShowCreateCommand, ARGS_NONE, [], "",
1629
    "Show the command line to re-create the cluster"),
1606 1630
  }
1607 1631

  
1608 1632

  

Also available in: Unified diff