Switch remaining uses of sreq to channel

This commit is contained in:
Thomas Jackson 2015-01-08 07:56:00 -08:00
parent 7c93360a82
commit 62d9d3cdad
2 changed files with 15 additions and 19 deletions

View File

@ -28,6 +28,7 @@ from salt.ext.six.moves import input
# Import salt libs
import salt.config
import salt.loader
import salt.transport.channel
import salt.utils
import salt.utils.minions
import salt.payload
@ -337,20 +338,17 @@ class Resolver(object):
def _send_token_request(self, load):
if self.opts['transport'] == 'zeromq':
sreq = salt.payload.SREQ(
'tcp://{0}:{1}'.format(
salt.utils.ip_bracket(self.opts['interface']),
self.opts['ret_port']),
opts=self.opts
)
tdata = sreq.send('clear', load)
return tdata
master_uri = 'tcp://' + salt.utils.ip_bracket(self.opts['interface']) + \
':' + str(self.opts['ret_port'])
channel = salt.transport.channel.ReqChannel.factory(self.opts,
crypt='clear',
master_uri=master_uri)
return channel.send(load)
elif self.opts['transport'] == 'raet':
sreq = salt.transport.Channel.factory(
self.opts)
sreq.dst = (None, None, 'local_cmd')
tdata = sreq.send(load)
return tdata
channel = salt.transport.channel.ReqChannel.factory(self.opts)
channel.dst = (None, None, 'local_cmd')
return channel.send(load)
def cli(self, eauth):
'''

View File

@ -28,6 +28,7 @@ except ImportError:
import salt.defaults.exitcodes
import salt.utils
import salt.payload
import salt.transport.channel
import salt.utils.verify
import salt.version
from salt.exceptions import (
@ -685,14 +686,11 @@ class SAuth(object):
auth['master_uri'] = self.opts['master_uri']
sreq = salt.payload.SREQ(
self.opts['master_uri'],
opts=self.opts
)
channel = salt.transport.channel.ReqChannel.factory(self.opts, crypt='clear')
try:
payload = sreq.send_auto(
self.minion_sign_in_payload(),
payload = channel.send(
self.minion_sign_in_payload()['load'], # TODO: change func to retur load instead of payload
tries=tries,
timeout=timeout
)