mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge branch '2019.2' into 52350_readd_and_gate_unicode_string_literal_support
This commit is contained in:
commit
82f010ae29
5 changed files with 25 additions and 8 deletions
|
@ -20,7 +20,6 @@ from salt.exceptions import (
|
|||
CommandExecutionError, MinionError
|
||||
)
|
||||
import salt.client
|
||||
import salt.crypt
|
||||
import salt.loader
|
||||
import salt.payload
|
||||
import salt.transport.client
|
||||
|
|
|
@ -63,10 +63,12 @@ def _ctl_cmd(cmd, name, conf_file, bin_env):
|
|||
|
||||
|
||||
def _get_return(ret):
|
||||
if ret['retcode'] == 0:
|
||||
return ret['stdout']
|
||||
else:
|
||||
return ''
|
||||
retmsg = ret['stdout']
|
||||
if ret['retcode'] != 0:
|
||||
# This is a non 0 exit code
|
||||
if 'ERROR' not in retmsg:
|
||||
retmsg = 'ERROR: {}'.format(retmsg)
|
||||
return retmsg
|
||||
|
||||
|
||||
def start(name='all', user=None, conf_file=None, bin_env=None):
|
||||
|
|
|
@ -19,7 +19,6 @@ import inspect
|
|||
import salt.loader
|
||||
import salt.fileclient
|
||||
import salt.minion
|
||||
import salt.crypt
|
||||
import salt.transport.client
|
||||
import salt.utils.args
|
||||
import salt.utils.cache
|
||||
|
|
|
@ -34,7 +34,7 @@ import salt.transport.client
|
|||
import salt.transport.server
|
||||
import salt.transport.mixins.auth
|
||||
from salt.ext import six
|
||||
from salt.exceptions import SaltReqTimeoutError
|
||||
from salt.exceptions import SaltReqTimeoutError, SaltException
|
||||
from salt._compat import ipaddress
|
||||
|
||||
from salt.utils.zeromq import zmq, ZMQDefaultLoop, install_zmq, ZMQ_VERSION_INFO, LIBZMQ_VERSION_INFO
|
||||
|
@ -260,12 +260,18 @@ class AsyncZeroMQReqChannel(salt.transport.client.ReqChannel):
|
|||
|
||||
@property
|
||||
def master_uri(self):
|
||||
if 'master_uri' in self.opts:
|
||||
return self.opts['master_uri']
|
||||
|
||||
# if by chance master_uri is not there..
|
||||
if 'master_ip' in self.opts:
|
||||
return _get_master_uri(self.opts['master_ip'],
|
||||
self.opts['master_port'],
|
||||
source_ip=self.opts.get('source_ip'),
|
||||
source_port=self.opts.get('source_ret_port'))
|
||||
return self.opts['master_uri']
|
||||
|
||||
# if we've reached here something is very abnormal
|
||||
raise SaltException('ReqChannel: missing master_uri/master_ip in self.opts')
|
||||
|
||||
def _package_load(self, load):
|
||||
return {
|
||||
|
|
|
@ -145,6 +145,17 @@ class ClearReqTestCases(BaseZMQReqCase, ReqChannelMixin):
|
|||
'''
|
||||
raise tornado.gen.Return((payload, {'fun': 'send_clear'}))
|
||||
|
||||
def test_master_uri_override(self):
|
||||
'''
|
||||
ensure master_uri kwarg is respected
|
||||
'''
|
||||
# minion_config should be 127.0.0.1, we want a different uri that still connects
|
||||
uri = 'tcp://{master_ip}:{master_port}'.format(master_ip='localhost', master_port=self.minion_config['master_port'])
|
||||
|
||||
channel = salt.transport.Channel.factory(self.minion_config, master_uri=uri)
|
||||
self.assertIn('localhost', channel.master_uri)
|
||||
del channel
|
||||
|
||||
|
||||
@flaky
|
||||
@skipIf(ON_SUSE, 'Skipping until https://github.com/saltstack/salt/issues/32902 gets fixed')
|
||||
|
|
Loading…
Add table
Reference in a new issue