Fixed bungled default logic for minionswarm root_dir

This commit is contained in:
Seth House 2012-10-09 12:19:50 -06:00
parent 6b4368d290
commit 8c18c29323

View file

@ -75,7 +75,11 @@ class Swarm(object):
self.opts = opts
# If given a root_dir, keep the tmp files there as well
tmpdir = opts['root_dir'] or os.path.join(opts['root_dir'], 'tmp')
if opts['root_dir']:
tmpdir = os.path.join(opts['root_dir'], 'tmp')
else:
tmpdir = opts['root_dir']
self.swarm_root = tempfile.mkdtemp(prefix='mswarm-root', suffix='.d',
dir=tmpdir)
@ -113,13 +117,15 @@ class Swarm(object):
data = {
'id': minion_id,
'user': pwd.getpwuid(os.getuid()).pw_name,
'root_dir': self.opts['root_dir'],
'pki_dir': self.pki,
'cachedir': os.path.join(dpath, 'cache'),
'master': self.opts['master'],
'log_file': os.path.join(dpath, 'minion.log')
}
if self.opts['root_dir']:
data['root_dir'] = self.opts['root_dir']
path = os.path.join(dpath, 'minion')
if self.opts['keep']: