More work to make stuff work right
This commit is contained in:
parent
93385836e4
commit
0a882ef693
|
@ -18,13 +18,14 @@
|
||||||
# ipmi_username: username to connect to IPMI
|
# ipmi_username: username to connect to IPMI
|
||||||
# ipmi_password: password to connect to IPMI
|
# ipmi_password: password to connect to IPMI
|
||||||
|
|
||||||
[*]
|
[default]
|
||||||
zookeeper = 127.0.0.1:2181
|
zookeeper = 127.0.0.1:2181
|
||||||
keepalive_interval = 5
|
keepalive_interval = 5
|
||||||
ipmi_hostname =
|
|
||||||
ipmi_username = admin
|
ipmi_username = admin
|
||||||
ipmi_password = admin
|
ipmi_password = admin
|
||||||
|
|
||||||
[test1.i.bonilan.net]
|
[test1.i.bonilan.net]
|
||||||
|
ipmi_hostname = test1-lom.m.bonilan.net
|
||||||
|
|
||||||
[test2.i.bonilan.net]
|
[test2.i.bonilan.net]
|
||||||
|
ipmi_hostname = test2-lom.m.bonilan.net
|
||||||
|
|
9
pvcd.py
9
pvcd.py
|
@ -49,7 +49,6 @@ print('Loading configuration from file {}'.format(pvcd_config_file))
|
||||||
myhostname = socket.gethostname()
|
myhostname = socket.gethostname()
|
||||||
myshorthostname = myhostname.split('.', 1)[0]
|
myshorthostname = myhostname.split('.', 1)[0]
|
||||||
mydomainname = ''.join(myhostname.split('.', 1)[1:])
|
mydomainname = ''.join(myhostname.split('.', 1)[1:])
|
||||||
config = readConfig(pvcd_config_file, myhostname)
|
|
||||||
print(myhostname)
|
print(myhostname)
|
||||||
print(myshorthostname)
|
print(myshorthostname)
|
||||||
print(mydomainname)
|
print(mydomainname)
|
||||||
|
@ -70,20 +69,22 @@ def readConfig(pvcd_config_file, myhostname):
|
||||||
try:
|
try:
|
||||||
entries = o_config[myhostname]
|
entries = o_config[myhostname]
|
||||||
except:
|
except:
|
||||||
entries = o_config['*']
|
entries = o_config['default']
|
||||||
|
|
||||||
for entry in config_values:
|
for entry in config_values:
|
||||||
try:
|
try:
|
||||||
config[entry] = entries[entry]
|
config[entry] = entries[entry]
|
||||||
except:
|
except:
|
||||||
config[entry] = entries['*']
|
config[entry] = o_config['default'][entry]
|
||||||
|
|
||||||
# Handle an empty ipmi_hostname
|
# Handle an empty ipmi_hostname
|
||||||
if config['ipmi_hostname'] == '':
|
if config['ipmi_hostname'] == '':
|
||||||
config['ipmi_hostname'] = myshorthostname + '-lom' + mydomainname
|
config['ipmi_hostname'] = myshorthostname + '-lom.' + mydomainname
|
||||||
|
|
||||||
return config
|
return config
|
||||||
|
|
||||||
|
config = readConfig(pvcd_config_file, myhostname)
|
||||||
|
|
||||||
# Connect to local zookeeper
|
# Connect to local zookeeper
|
||||||
zk = kazoo.client.KazooClient(hosts=config['zookeeper'])
|
zk = kazoo.client.KazooClient(hosts=config['zookeeper'])
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue