Skip to content

Commit

Permalink
Convert syndics to use older AsyncReqChannel
Browse files Browse the repository at this point in the history
There *may* be a better way to get results from syndics to the Master of
Masters, but this at least works.

Fixes saltstack#62933
  • Loading branch information
waynew committed Dec 16, 2022
1 parent e231a5a commit 16a44a5
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions salt/minion.py
Original file line number Diff line number Diff line change
Expand Up @@ -3378,6 +3378,39 @@ def destroy(self):
self.forward_events.stop()
self.forward_events = None

def _send_req_sync(self, load, timeout):
if self.opts["minion_sign_messages"]:
log.trace("Signing event to be published onto the bus.")
minion_privkey_path = os.path.join(self.opts["pki_dir"], "minion.pem")
sig = salt.crypt.sign_message(
minion_privkey_path, salt.serializers.msgpack.serialize(load)
)
load["sig"] = sig

with salt.transport.client.AsyncReqChannel.factory(self.opts) as channel:
log.warning("Sending this load %r", load)
ret = yield channel.send(
load, timeout=timeout, tries=self.opts["return_retry_tries"]
)
return ret

@salt.ext.tornado.gen.coroutine
def _send_req_async(self, load, timeout):
if self.opts["minion_sign_messages"]:
log.trace("Signing event to be published onto the bus.")
minion_privkey_path = os.path.join(self.opts["pki_dir"], "minion.pem")
sig = salt.crypt.sign_message(
minion_privkey_path, salt.serializers.msgpack.serialize(load)
)
load["sig"] = sig

with salt.transport.client.AsyncReqChannel.factory(self.opts) as channel:
log.warning("Sending this load %r", load)
ret = yield channel.send(
load, timeout=timeout, tries=self.opts["return_retry_tries"]
)
raise salt.ext.tornado.gen.Return(ret)


# TODO: need a way of knowing if the syndic connection is busted
class SyndicManager(MinionBase):
Expand Down

0 comments on commit 16a44a5

Please sign in to comment.