mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Fix imports
This commit is contained in:
parent
7ec3954bef
commit
b7da571624
7 changed files with 32 additions and 32 deletions
|
@ -10,7 +10,7 @@ from __future__ import absolute_import, print_function, unicode_literals
|
|||
import logging
|
||||
|
||||
# Import Salt Libs
|
||||
from salt.utils.async import SyncWrapper
|
||||
from salt.utils.asynchronous import SyncWrapper
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -130,7 +130,7 @@ class IPCServer(object):
|
|||
else:
|
||||
self.sock = tornado.netutil.bind_unix_socket(self.socket_path)
|
||||
|
||||
with salt.utils.async.current_ioloop(self.io_loop):
|
||||
with salt.utils.asynchronous.current_ioloop(self.io_loop):
|
||||
tornado.netutil.add_accept_handler(
|
||||
self.sock,
|
||||
self.handle_connection,
|
||||
|
@ -196,7 +196,7 @@ class IPCServer(object):
|
|||
log.trace('IPCServer: Handling connection '
|
||||
'to address: %s', address)
|
||||
try:
|
||||
with salt.utils.async.current_ioloop(self.io_loop):
|
||||
with salt.utils.asynchronous.current_ioloop(self.io_loop):
|
||||
stream = IOStream(
|
||||
connection,
|
||||
)
|
||||
|
@ -329,7 +329,7 @@ class IPCClient(object):
|
|||
break
|
||||
|
||||
if self.stream is None:
|
||||
with salt.utils.async.current_ioloop(self.io_loop):
|
||||
with salt.utils.asynchronous.current_ioloop(self.io_loop):
|
||||
self.stream = IOStream(
|
||||
socket.socket(sock_type, socket.SOCK_STREAM),
|
||||
)
|
||||
|
@ -510,7 +510,7 @@ class IPCMessagePublisher(object):
|
|||
else:
|
||||
self.sock = tornado.netutil.bind_unix_socket(self.socket_path)
|
||||
|
||||
with salt.utils.async.current_ioloop(self.io_loop):
|
||||
with salt.utils.asynchronous.current_ioloop(self.io_loop):
|
||||
tornado.netutil.add_accept_handler(
|
||||
self.sock,
|
||||
self.handle_connection,
|
||||
|
@ -549,7 +549,7 @@ class IPCMessagePublisher(object):
|
|||
if self.opts['ipc_write_buffer'] > 0:
|
||||
kwargs['max_write_buffer_size'] = self.opts['ipc_write_buffer']
|
||||
log.trace('Setting IPC connection write buffer: %s', (self.opts['ipc_write_buffer']))
|
||||
with salt.utils.async.current_ioloop(self.io_loop):
|
||||
with salt.utils.asynchronous.current_ioloop(self.io_loop):
|
||||
stream = IOStream(
|
||||
connection,
|
||||
**kwargs
|
||||
|
|
|
@ -19,7 +19,7 @@ import traceback
|
|||
|
||||
# Import Salt Libs
|
||||
import salt.crypt
|
||||
import salt.utils.async
|
||||
import salt.utils.asynchronous
|
||||
import salt.utils.event
|
||||
import salt.utils.files
|
||||
import salt.utils.platform
|
||||
|
@ -476,7 +476,7 @@ class AsyncTCPPubChannel(salt.transport.mixins.auth.AESPubClientMixin, salt.tran
|
|||
'tok': self.tok,
|
||||
'data': data,
|
||||
'tag': tag}
|
||||
req_channel = salt.utils.async.SyncWrapper(
|
||||
req_channel = salt.utils.asynchronous.SyncWrapper(
|
||||
AsyncTCPReqChannel, (self.opts,)
|
||||
)
|
||||
try:
|
||||
|
@ -603,7 +603,7 @@ class TCPReqServerChannel(salt.transport.mixins.auth.AESReqServerMixin, salt.tra
|
|||
self.payload_handler = payload_handler
|
||||
self.io_loop = io_loop
|
||||
self.serial = salt.payload.Serial(self.opts)
|
||||
with salt.utils.async.current_ioloop(self.io_loop):
|
||||
with salt.utils.asynchronous.current_ioloop(self.io_loop):
|
||||
if USE_LOAD_BALANCER:
|
||||
self.req_server = LoadBalancerWorker(self.socket_queue,
|
||||
self.handle_message,
|
||||
|
@ -869,7 +869,7 @@ class SaltMessageClient(object):
|
|||
|
||||
self.io_loop = io_loop or tornado.ioloop.IOLoop.current()
|
||||
|
||||
with salt.utils.async.current_ioloop(self.io_loop):
|
||||
with salt.utils.asynchronous.current_ioloop(self.io_loop):
|
||||
self._tcp_client = TCPClientKeepAlive(opts, resolver=resolver)
|
||||
|
||||
self._mid = 1
|
||||
|
@ -895,7 +895,7 @@ class SaltMessageClient(object):
|
|||
if hasattr(self, '_stream') and not self._stream.closed():
|
||||
# If _stream_return() hasn't completed, it means the IO
|
||||
# Loop is stopped (such as when using
|
||||
# 'salt.utils.async.SyncWrapper'). Ensure that
|
||||
# 'salt.utils.asynchronous.SyncWrapper'). Ensure that
|
||||
# _stream_return() completes by restarting the IO Loop.
|
||||
# This will prevent potential errors on shutdown.
|
||||
try:
|
||||
|
@ -968,7 +968,7 @@ class SaltMessageClient(object):
|
|||
'source_port': self.source_port}
|
||||
else:
|
||||
log.warning('If you need a certain source IP/port, consider upgrading Tornado >= 4.5')
|
||||
with salt.utils.async.current_ioloop(self.io_loop):
|
||||
with salt.utils.asynchronous.current_ioloop(self.io_loop):
|
||||
self._stream = yield self._tcp_client.connect(self.host,
|
||||
self.port,
|
||||
ssl_options=self.opts.get('ssl'),
|
||||
|
@ -1442,7 +1442,7 @@ class TCPPubServerChannel(salt.transport.server.PubServerChannel):
|
|||
pull_uri = os.path.join(self.opts['sock_dir'], 'publish_pull.ipc')
|
||||
# TODO: switch to the actual async interface
|
||||
#pub_sock = salt.transport.ipc.IPCMessageClient(self.opts, io_loop=self.io_loop)
|
||||
pub_sock = salt.utils.async.SyncWrapper(
|
||||
pub_sock = salt.utils.asynchronous.SyncWrapper(
|
||||
salt.transport.ipc.IPCMessageClient,
|
||||
(pull_uri,)
|
||||
)
|
||||
|
|
|
@ -72,7 +72,7 @@ import tornado.iostream
|
|||
# Import salt libs
|
||||
import salt.config
|
||||
import salt.payload
|
||||
import salt.utils.async
|
||||
import salt.utils.asynchronous
|
||||
import salt.utils.cache
|
||||
import salt.utils.dicttrim
|
||||
import salt.utils.files
|
||||
|
@ -364,7 +364,7 @@ class SaltEvent(object):
|
|||
return True
|
||||
|
||||
if self._run_io_loop_sync:
|
||||
with salt.utils.async.current_ioloop(self.io_loop):
|
||||
with salt.utils.asynchronous.current_ioloop(self.io_loop):
|
||||
if self.subscriber is None:
|
||||
self.subscriber = salt.transport.ipc.IPCMessageSubscriber(
|
||||
self.puburi,
|
||||
|
@ -409,7 +409,7 @@ class SaltEvent(object):
|
|||
return True
|
||||
|
||||
if self._run_io_loop_sync:
|
||||
with salt.utils.async.current_ioloop(self.io_loop):
|
||||
with salt.utils.asynchronous.current_ioloop(self.io_loop):
|
||||
if self.pusher is None:
|
||||
self.pusher = salt.transport.ipc.IPCMessageClient(
|
||||
self.pulluri,
|
||||
|
@ -632,7 +632,7 @@ class SaltEvent(object):
|
|||
|
||||
ret = self._check_pending(tag, match_func)
|
||||
if ret is None:
|
||||
with salt.utils.async.current_ioloop(self.io_loop):
|
||||
with salt.utils.asynchronous.current_ioloop(self.io_loop):
|
||||
if auto_reconnect:
|
||||
raise_errors = self.raise_errors
|
||||
self.raise_errors = True
|
||||
|
@ -743,7 +743,7 @@ class SaltEvent(object):
|
|||
serialized_data])
|
||||
msg = salt.utils.stringutils.to_bytes(event, 'utf-8')
|
||||
if self._run_io_loop_sync:
|
||||
with salt.utils.async.current_ioloop(self.io_loop):
|
||||
with salt.utils.asynchronous.current_ioloop(self.io_loop):
|
||||
try:
|
||||
self.io_loop.run_sync(lambda: self.pusher.send(msg))
|
||||
except Exception as ex:
|
||||
|
@ -1083,7 +1083,7 @@ class EventPublisher(salt.utils.process.SignalHandlingMultiprocessingProcess):
|
|||
'''
|
||||
salt.utils.process.appendproctitle(self.__class__.__name__)
|
||||
self.io_loop = tornado.ioloop.IOLoop()
|
||||
with salt.utils.async.current_ioloop(self.io_loop):
|
||||
with salt.utils.asynchronous.current_ioloop(self.io_loop):
|
||||
if self.opts['ipc_mode'] == 'tcp':
|
||||
epub_uri = int(self.opts['tcp_master_pub_port'])
|
||||
epull_uri = int(self.opts['tcp_master_pull_port'])
|
||||
|
|
|
@ -495,7 +495,7 @@ def gen_min(cachedir, extra_mods='', overwrite=False, so_mods='',
|
|||
'salt/utils/openstack',
|
||||
'salt/utils/openstack/__init__.py',
|
||||
'salt/utils/openstack/swift.py',
|
||||
'salt/utils/async.py',
|
||||
'salt/utils/asynchronous.py',
|
||||
'salt/utils/process.py',
|
||||
'salt/utils/jinja.py',
|
||||
'salt/utils/rsax931.py',
|
||||
|
|
|
@ -21,7 +21,7 @@ import logging
|
|||
|
||||
# Import salt libs
|
||||
import salt.utils.event
|
||||
import salt.utils.async
|
||||
import salt.utils.asynchronous
|
||||
|
||||
# Import 3rd-party libs
|
||||
from tornado import gen
|
||||
|
@ -70,7 +70,7 @@ class PyTestEngine(object):
|
|||
self.sock.bind(('localhost', port))
|
||||
# become a server socket
|
||||
self.sock.listen(5)
|
||||
with salt.utils.async.current_ioloop(self.io_loop):
|
||||
with salt.utils.asynchronous.current_ioloop(self.io_loop):
|
||||
netutil.add_accept_handler(
|
||||
self.sock,
|
||||
self.handle_connection,
|
||||
|
|
|
@ -8,7 +8,7 @@ import tornado.testing
|
|||
import tornado.gen
|
||||
from tornado.testing import AsyncTestCase
|
||||
|
||||
import salt.utils.async as async
|
||||
import salt.utils.asynchronous as asynchronous
|
||||
|
||||
|
||||
class HelperA(object):
|
||||
|
@ -24,7 +24,7 @@ class HelperA(object):
|
|||
class HelperB(object):
|
||||
def __init__(self, a=None, io_loop=None):
|
||||
if a is None:
|
||||
a = async.SyncWrapper(HelperA)
|
||||
a = asynchronous.SyncWrapper(HelperA)
|
||||
self.a = a
|
||||
|
||||
@tornado.gen.coroutine
|
||||
|
@ -38,7 +38,7 @@ class TestSyncWrapper(AsyncTestCase):
|
|||
@tornado.testing.gen_test
|
||||
def test_helpers(self):
|
||||
'''
|
||||
Test that the helper classes do what we expect within a regular async env
|
||||
Test that the helper classes do what we expect within a regular asynchronous env
|
||||
'''
|
||||
ha = HelperA()
|
||||
ret = yield ha.sleep()
|
||||
|
@ -50,29 +50,29 @@ class TestSyncWrapper(AsyncTestCase):
|
|||
|
||||
def test_basic_wrap(self):
|
||||
'''
|
||||
Test that we can wrap an async caller.
|
||||
Test that we can wrap an asynchronous caller.
|
||||
'''
|
||||
sync = async.SyncWrapper(HelperA)
|
||||
sync = asynchronous.SyncWrapper(HelperA)
|
||||
ret = sync.sleep()
|
||||
self.assertTrue(ret)
|
||||
|
||||
def test_double(self):
|
||||
'''
|
||||
Test when the async wrapper object itself creates a wrap of another thing
|
||||
Test when the asynchronous wrapper object itself creates a wrap of another thing
|
||||
|
||||
This works fine since the second wrap is based on the first's IOLoop so we
|
||||
don't have to worry about complex start/stop mechanics
|
||||
'''
|
||||
sync = async.SyncWrapper(HelperB)
|
||||
sync = asynchronous.SyncWrapper(HelperB)
|
||||
ret = sync.sleep()
|
||||
self.assertFalse(ret)
|
||||
|
||||
def test_double_sameloop(self):
|
||||
'''
|
||||
Test async wrappers initiated from the same IOLoop, to ensure that
|
||||
Test asynchronous wrappers initiated from the same IOLoop, to ensure that
|
||||
we don't wire up both to the same IOLoop (since it causes MANY problems).
|
||||
'''
|
||||
a = async.SyncWrapper(HelperA)
|
||||
sync = async.SyncWrapper(HelperB, (a,))
|
||||
a = asynchronous.SyncWrapper(HelperA)
|
||||
sync = asynchronous.SyncWrapper(HelperB, (a,))
|
||||
ret = sync.sleep()
|
||||
self.assertFalse(ret)
|
||||
|
|
Loading…
Add table
Reference in a new issue