Merge pull request #45778 from DSRCorporation/bugs/jenkins-813_missing_minion_test_fail

Support comma separated minion list target in payload for TCP transport
This commit is contained in:
Nicole Thomas 2018-01-30 14:49:52 -05:00 committed by GitHub
commit 42467ed2f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1336,6 +1336,7 @@ class TCPPubServerChannel(salt.transport.server.PubServerChannel):
def __init__(self, opts):
self.opts = opts
self.serial = salt.payload.Serial(self.opts) # TODO: in init?
self.ckminions = salt.utils.minions.CkMinions(opts)
self.io_loop = None
def __setstate__(self, state):
@ -1440,6 +1441,16 @@ class TCPPubServerChannel(salt.transport.server.PubServerChannel):
# add some targeting stuff for lists only (for now)
if load['tgt_type'] == 'list':
int_payload['topic_lst'] = load['tgt']
if isinstance(load['tgt'], six.string_types):
# Fetch a list of minions that match
_res = self.ckminions.check_minions(load['tgt'],
tgt_type=load['tgt_type'])
match_ids = _res['minions']
log.debug("Publish Side Match: %s", match_ids)
# Send list of miions thru so zmq can target them
int_payload['topic_lst'] = match_ids
else:
int_payload['topic_lst'] = load['tgt']
# Send it over IPC!
pub_sock.send(int_payload)