mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 17:33:54 +00:00
add code to cache jobs on the minion if option is set
This commit is contained in:
parent
f63a38d025
commit
b2151521bb
@ -80,6 +80,7 @@ def minion_config(path):
|
||||
'pki_dir': '/etc/salt/pki',
|
||||
'id': socket.getfqdn(),
|
||||
'cachedir': '/var/cache/salt',
|
||||
'cache_jobs': False,
|
||||
'conf_file': path,
|
||||
'renderer': 'yaml_jinja',
|
||||
'failhard': False,
|
||||
|
@ -312,8 +312,21 @@ class Minion(object):
|
||||
except KeyError:
|
||||
pass
|
||||
payload['load'] = self.crypticle.dumps(load)
|
||||
socket.send(self.serial.dumps(payload))
|
||||
return socket.recv()
|
||||
data = self.serial.dumps(payload)
|
||||
socket.send(data)
|
||||
ret = socket.recv()
|
||||
if self.opts['cache_jobs']:
|
||||
# Local job cache has been enabled
|
||||
fn_ = os.path.join(
|
||||
self.opts['cachedir'],
|
||||
'minion_jobs',
|
||||
load['jid'],
|
||||
'return.p')
|
||||
jdir = os.path.dirname(fn_)
|
||||
if not os.path.isdir(jdir):
|
||||
os.makedirs(jdir)
|
||||
open(fn_, 'w+').write(load)
|
||||
return ret
|
||||
|
||||
def authenticate(self):
|
||||
'''
|
||||
|
Loading…
Reference in New Issue
Block a user