Support YAML in the client and update configfile
This commit is contained in:
parent
ebd28ecef0
commit
5be1cdc40a
|
@ -28,6 +28,7 @@ import subprocess
|
|||
import difflib
|
||||
import re
|
||||
import colorama
|
||||
import yaml
|
||||
|
||||
import client_lib.common as pvc_common
|
||||
import client_lib.node as pvc_node
|
||||
|
@ -1268,23 +1269,20 @@ def cli(_zk_host):
|
|||
|
||||
"PVC_ZOOKEEPER": Set the cluster Zookeeper address instead of using "--zookeeper".
|
||||
|
||||
If no PVC_ZOOKEEPER/--zookeeper is specified, attempts to load coordinators list from /etc/pvc/pvcd.conf.
|
||||
If no PVC_ZOOKEEPER/--zookeeper is specified, attempts to load coordinators list from /etc/pvc/pvcd.yaml.
|
||||
"""
|
||||
|
||||
# If no zk_host was passed, try to read from /etc/pvc/pvcd.conf; otherwise fail
|
||||
# If no zk_host was passed, try to read from /etc/pvc/pvcd.yaml; otherwise fail
|
||||
if _zk_host is None:
|
||||
import configparser
|
||||
|
||||
try:
|
||||
config_file = '/etc/pvc/pvcd.conf'
|
||||
o_config = configparser.ConfigParser()
|
||||
o_config.read(config_file)
|
||||
_zk_host = o_config['default']['coordinators']
|
||||
cfgfile = '/etc/pvc/pvcd.yaml'
|
||||
o_config = yaml.load(cfgfile)
|
||||
_zk_host = o_config['pvc']['cluster']['coordinators']
|
||||
except:
|
||||
_zk_host = None
|
||||
|
||||
if _zk_host is None:
|
||||
print('ERROR: Must specify a PVC_ZOOKEEPER value or have a coordinator set configured in /etc/pvc/pvcd.conf.')
|
||||
print('ERROR: Must specify a PVC_ZOOKEEPER value or have a coordinator set configured in /etc/pvc/pvcd.yaml.')
|
||||
exit(1)
|
||||
|
||||
global zk_host
|
||||
|
|
|
@ -25,7 +25,7 @@ Description: Parallel Virtual Cluster common client libraries (Python 3)
|
|||
|
||||
Package: pvc-client-cli
|
||||
Architecture: all
|
||||
Depends: pvc-client-common
|
||||
Depends: pvc-client-common, python3-yaml
|
||||
Description: Parallel Virtual Cluster client (Python 3)
|
||||
The Parallel Virtual Cluster provides a management solution for QEMU/KVM virtual clusters.
|
||||
.
|
||||
|
|
Loading…
Reference in New Issue