Merge branch '2014.7_sam4' of https://github.com/SmithSamuelM/salt into SmithSamuelM-2014.7_sam4

This commit is contained in:
Thomas S Hatch 2014-09-26 14:54:46 -06:00
commit 49ace43d9e
4 changed files with 32 additions and 12 deletions

View File

@ -191,7 +191,7 @@ class ZeroMQCaller(object):
'''
Return the data up to the master
'''
channel = salt.transport.Channel.factory(self.opts)
channel = salt.transport.Channel.factory(self.opts, usage='salt_call')
load = {'cmd': '_return', 'id': self.opts['id']}
for key, value in ret.items():
load[key] = value

View File

@ -821,6 +821,23 @@ class Router(ioflo.base.deeding.Deed):
self.event_req.value.append(msg)
elif d_share == 'event_fire':
self.event.value.append(msg)
elif d_share == 'remote_cmd': # assume must be minion to master
if not self.udp_stack.value.remotes:
log.error("Missing joined master. Unable to route "
"remote_cmd '{0}'.".format(msg))
d_estate = self.udp_stack.value.remotes.values()[0].name
msg['route']['dst'] = (d_estate, d_yard, d_share)
self.udp_stack.value.message(msg,
self.udp_stack.value.nameRemotes[d_estate].uid)
elif d_share == 'call_cmd': # salt call minion to master
if not self.udp_stack.value.remotes:
log.error("Missing joined master. Unable to route "
"call_cmd '{0}'.".format(msg))
d_estate = self.udp_stack.value.remotes.values()[0].name
d_share = 'remote_cmd'
msg['route']['dst'] = (d_estate, d_yard, d_share)
self.udp_stack.value.message(msg,
self.udp_stack.value.nameRemotes[d_estate].uid)
def action(self):
'''
@ -964,8 +981,8 @@ class NixExecutor(ioflo.base.deeding.Deed):
def _setup_jobber_stack(self):
'''
Setup and return the LaneStack and Yard used by the jobber to communicate to-from
the minion
Setup and return the LaneStack and Yard used by the jobber yard
to communicate with the minion manor yard
'''
mid = self.opts['id']
@ -977,6 +994,7 @@ class NixExecutor(ioflo.base.deeding.Deed):
sockdirpath=self.opts['sock_dir'])
stack.Pk = raeting.packKinds.pack
# add remote for the manor yard
stack.addRemote(RemoteYard(stack=stack,
name='manor',
lanename=mid,
@ -1028,6 +1046,7 @@ class NixExecutor(ioflo.base.deeding.Deed):
'Executing command {0[fun]} with jid {0[jid]}'.format(data)
)
log.debug('Command details {0}'.format(data))
process = multiprocessing.Process(
target=self.proc_run,
kwargs={'exchange': exchange}

View File

@ -127,12 +127,9 @@ class RunnerClient(mixins.SyncClientMixin, mixins.AsyncClientMixin, object):
'''
load = kwargs
load['cmd'] = 'runner'
# sreq = salt.payload.SREQ(
# 'tcp://{0[interface]}:{0[ret_port]}'.format(self.opts),
# )
sreq = salt.transport.Channel.factory(self.opts, crypt='clear')
if self.opts['transport'] == 'raet':
sreq.dst = (None, None, 'local_cmd')
sreq = salt.transport.Channel.factory(self.opts,
crypt='clear',
usage='master_call')
ret = sreq.send(load)
if isinstance(ret, collections.Mapping):
if 'error' in ret:

View File

@ -71,11 +71,15 @@ class RAETChannel(Channel):
The difference between the two is how the destination route
is assigned.
'''
def __init__(self, opts, **kwargs):
def __init__(self, opts, usage=None, **kwargs):
self.opts = opts
self.ttype = 'raet'
self.dst = ('master', None, 'remote_cmd') # minion to master comms
#self.dst = (None, None, 'remote_cmd')
if usage == 'master_call':
self.dst = (None, None, 'local_cmd') # runner.py master_call
elif usage == 'salt_call':
self.dst = (None, None, 'remote_cmd') # salt_call caller
else: # everything else
self.dst = (None, None, 'remote_cmd') # normal use case minion to master
self.stack = None
def _setup_stack(self):