Only generate the access keys once in the master before

spining up workers
This commit is contained in:
Thomas S Hatch 2014-03-12 15:32:06 -06:00
parent a76e202003
commit 3493df2cb5
2 changed files with 9 additions and 3 deletions

View File

@ -26,6 +26,9 @@ from . import worker
__all__ = ['core', 'worker'] __all__ = ['core', 'worker']
# Import salt libs
import salt.daemons.masterapi
# Import ioflo libs # Import ioflo libs
import ioflo.app.run import ioflo.app.run
@ -52,6 +55,7 @@ class IofloMaster(object):
''' '''
self.opts = opts self.opts = opts
self.preloads = explode_opts(self.opts) self.preloads = explode_opts(self.opts)
self.access_keys = salt.daemons.masterapi.access_keys(self.opts.value)
def _make_workers(self): def _make_workers(self):
''' '''
@ -69,6 +73,8 @@ class IofloMaster(object):
''' '''
behaviors = ['salt.transport.road.raet', 'salt.daemons.flo'] behaviors = ['salt.transport.road.raet', 'salt.daemons.flo']
self.preloads.append(('.salt.yid', dict(value=yid))) self.preloads.append(('.salt.yid', dict(value=yid)))
self.preloads.append(
('.salt.access_keys', dict(value=self.access_keys)))
ioflo.app.run.start( ioflo.app.run.start(
name='worker{0}'.format(yid), name='worker{0}'.format(yid),
period=float(self.opts['ioflo_period']), period=float(self.opts['ioflo_period']),

View File

@ -17,7 +17,8 @@ class RouterWorker(ioflo.base.deeding.Deed):
Ioinits = { Ioinits = {
'uxd_stack': '.salt.uxd.stack.stack', 'uxd_stack': '.salt.uxd.stack.stack',
'opts': '.salt.opts', 'opts': '.salt.opts',
'yid': '.salt.yid' 'yid': '.salt.yid',
'access_keys': '.salt.access_keys',
} }
def postinitio(self): def postinitio(self):
@ -34,10 +35,9 @@ class RouterWorker(ioflo.base.deeding.Deed):
dirpath=self.opts.value['sock_dir']) dirpath=self.opts.value['sock_dir'])
self.uxd_stack.value.addRemoteYard(manor_yard) self.uxd_stack.value.addRemoteYard(manor_yard)
self.remote = salt.daemons.masterapi.RemoteFuncs(self.opts.value) self.remote = salt.daemons.masterapi.RemoteFuncs(self.opts.value)
self.access_keys = salt.daemons.masterapi.access_keys(self.opts.value)
self.local = salt.daemons.masterapi.LocalFuncs( self.local = salt.daemons.masterapi.LocalFuncs(
self.opts.value, self.opts.value,
self.access_keys) self.access_keys.value)
def action(self): def action(self):
''' '''