Skip to content

Commit

Permalink
backport syndic communication fix from saltstack#63428
Browse files Browse the repository at this point in the history
  • Loading branch information
hurzhurz committed Apr 6, 2023
1 parent fe67de4 commit 540970c
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions salt/minion.py
Original file line number Diff line number Diff line change
Expand Up @@ -3306,6 +3306,32 @@ def timeout_handler(*args):
**kwargs
)

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
return self.req_channel.send(
load, timeout=timeout, tries=self.opts["return_retry_tries"]
)

@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
ret = yield self.async_req_channel.send(
load, timeout=timeout, tries=self.opts["return_retry_tries"]
)
return ret

def fire_master_syndic_start(self):
# Send an event to the master that the minion is live
if self.opts["enable_legacy_startup_events"]:
Expand Down Expand Up @@ -3335,6 +3361,8 @@ def tune_in_no_block(self):

# add handler to subscriber
self.pub_channel.on_recv(self._process_cmd_socket)
self.req_channel = salt.channel.client.ReqChannel.factory(self.opts)
self.async_req_channel = salt.channel.client.ReqChannel.factory(self.opts)

def _process_cmd_socket(self, payload):
if payload is not None and payload["enc"] == "aes":
Expand Down

0 comments on commit 540970c

Please sign in to comment.