fix bugs in config file parsing

This commit is contained in:
Thomas S Hatch 2011-03-03 12:05:42 -07:00
parent 95abf25bd2
commit b70d74fa3a
2 changed files with 8 additions and 2 deletions

View file

@ -16,7 +16,7 @@ class Master(object):
'''
def __init__(self):
self.cli = self.__parse_cli()
self.opts = salt.config.master_config(self.cli)
self.opts = salt.config.master_config(self.cli['config'])
def __parse_cli(self):
'''

View file

@ -3,6 +3,7 @@ All salt configuration loading and defaults should be in this module
'''
# Import python modules
import os
import sys
import socket
# Import third party libs
import yaml
@ -18,7 +19,12 @@ def minion_config(path):
}
if os.path.isfile(path):
opts.update(yaml.load(open(path, 'r')))
try:
opts.update(yaml.load(open(path, 'r')))
except:
err = 'The master configuration file did not parse correctly,'\
+ ' please check your configuration file.\nUsing defaults'
sys.stderr.write(err + '\n')
opts['master_uri'] = 'tcp://' + opts['master'] + ':' + opts['master_port']