More work to make stuff work right

This commit is contained in:
Joshua Boniface 2018-06-10 20:45:32 -04:00
parent 93385836e4
commit 0a882ef693
2 changed files with 8 additions and 6 deletions

View File

@ -18,13 +18,14 @@
# ipmi_username: username to connect to IPMI
# ipmi_password: password to connect to IPMI
[*]
[default]
zookeeper = 127.0.0.1:2181
keepalive_interval = 5
ipmi_hostname =
ipmi_username = admin
ipmi_password = admin
[test1.i.bonilan.net]
ipmi_hostname = test1-lom.m.bonilan.net
[test2.i.bonilan.net]
ipmi_hostname = test2-lom.m.bonilan.net

View File

@ -49,7 +49,6 @@ print('Loading configuration from file {}'.format(pvcd_config_file))
myhostname = socket.gethostname()
myshorthostname = myhostname.split('.', 1)[0]
mydomainname = ''.join(myhostname.split('.', 1)[1:])
config = readConfig(pvcd_config_file, myhostname)
print(myhostname)
print(myshorthostname)
print(mydomainname)
@ -70,20 +69,22 @@ def readConfig(pvcd_config_file, myhostname):
try:
entries = o_config[myhostname]
except:
entries = o_config['*']
entries = o_config['default']
for entry in config_values:
try:
config[entry] = entries[entry]
except:
config[entry] = entries['*']
config[entry] = o_config['default'][entry]
# Handle an empty ipmi_hostname
if config['ipmi_hostname'] == '':
config['ipmi_hostname'] = myshorthostname + '-lom' + mydomainname
config['ipmi_hostname'] = myshorthostname + '-lom.' + mydomainname
return config
config = readConfig(pvcd_config_file, myhostname)
# Connect to local zookeeper
zk = kazoo.client.KazooClient(hosts=config['zookeeper'])
try: