saltstack/salt — Issue #564: undefined name 'cachedir' in master.py
Author: rubic
Created: 2012-01-24 01:27:25+00:00
State: open

Unfortunately mixed in with my non-urgent pull request ...

https://github.com/saltstack/salt/pull/547

... is a serious coding patch in master.py that should quickly be addressed. Line 45 references `cachedir`:

return prep_jid(cachedir, load)

But it's never defined. I think the intention there was to use `opts['cachedir']`. Either that line of code has never been executed, or nobody has yet reported it as a bug.

def prep_jid(opts, load):
'''
Parses the job return directory, generates a job id and sets up the
job id directory.
'''
serial = salt.payload.Serial(opts)
jid_root = os.path.join(opts['cachedir'], 'jobs')
jid = "{0:%Y%m%d%H%M%S%f}".format(datetime.datetime.now())

jid_dir = os.path.join(jid_root, jid)
if not os.path.isdir(jid_dir):
os.makedirs(jid_dir)
serial.dump(load, open(os.path.join(jid_dir, '.load.p'), 'w+'))
else:
return prep_jid(cachedir, load)
return jid