Skip to content

Commit

Permalink
Allow saving the cib to a file
Browse files Browse the repository at this point in the history
  • Loading branch information
feist committed Sep 12, 2012
1 parent 20e6aa1 commit 67a3b22
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
16 changes: 13 additions & 3 deletions pcs/cluster.py
Expand Up @@ -60,7 +60,7 @@ def cluster_cmd(argv):
else:
disable_cluster(argv)
elif (sub_cmd == "cib"):
get_cib()
get_cib(argv)
elif (sub_cmd == "push"):
cluster_push(argv)
elif (sub_cmd == "node"):
Expand Down Expand Up @@ -314,8 +314,18 @@ def cluster_push(argv):
else:
print "CIB updated"

def get_cib():
print utils.get_cib(),
def get_cib(argv):
if len(argv) == 0:
print utils.get_cib(),
else:
filename = argv[0]
f = open(filename, 'w')
output = utils.get_cib()
if output != "":
f.write(utils.get_cib())
else:
print "Error: No data in the CIB"
sys.exit(1)

def cluster_node(argv):
if len(argv) != 2:
Expand Down
6 changes: 4 additions & 2 deletions pcs/usage.py
Expand Up @@ -184,8 +184,10 @@ def cluster():
--local will only perform changes on the local node
--start will also start the cluster on the specified nodes
cib
Get the raw xml from the CIB (Cluster Information Base)
cib [filename]
Get the raw xml from the CIB (Cluster Information Base). If a
filename is provided, we save the cib to that file, otherwise the cib
is printed
push cib <filename>
Push the raw xml from <filename> to the CIB (Cluster Information Base)
Expand Down

0 comments on commit 67a3b22

Please sign in to comment.