Add in opts for open mode in the config support

This commit is contained in:
Thomas S Hatch 2011-03-10 08:59:57 -07:00
parent 3b5d4484a9
commit 36984c8d40

View file

@ -19,17 +19,26 @@ def minion_config(path):
'pki_dir': '/etc/salt/pki',
'hostname': socket.getfqdn(),
'cachedir': '/var/cache/salt',
'open_mode': False,
}
if os.path.isfile(path):
try:
opts.update(yaml.load(open(path, 'r')))
except:
err = 'The minon configuration file did not parse correctly,'\
err = 'The salt minon 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']
# Enableing open mode requires that the value be set to True, and nothing
# else!
if opts['open_mode']:
if opts['open_mode'] == 'True':
opts['open_mode'] = True
else:
opts['open_mode'] = False
return opts
@ -45,16 +54,27 @@ def master_config(path):
'local_port': '4507',
'pki_dir': '/etc/salt/pki',
'cachedir': '/var/cache/salt',
'open_mode': False,
}
if os.path.isfile(path):
try:
opts.update(yaml.load(open(path, 'r')))
except:
err = 'The master configuration file did not parse correctly,'\
err = 'The salt master configuration file did not parse'\
+ ' correctly,'\
+ ' please check your configuration file.\nUsing defaults'
sys.stderr.write(err + '\n')
opts['aes'] = salt.crypt.Crypticle.generate_key_string()
# Enableing open mode requires that the value be set to True, and nothing
# else!
if opts['open_mode']:
if opts['open_mode'] == 'True':
opts['open_mode'] = True
else:
opts['open_mode'] = False
return opts