mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Set up the reply structure for the master
This commit is contained in:
parent
8e771c947b
commit
ca93b46228
1 changed files with 37 additions and 3 deletions
|
@ -95,9 +95,10 @@ class ReqServer(threading.Thread):
|
|||
socket.connect(self.w_uri)
|
||||
|
||||
while True:
|
||||
message = socket.recv()
|
||||
salt.payload.package(message)
|
||||
socket.send(1)
|
||||
package = socket.recv()
|
||||
payload = salt.payload.unpackage(package)
|
||||
ret = self._handle_payload(payload)
|
||||
socket.send(ret)
|
||||
|
||||
def __bind(self):
|
||||
'''
|
||||
|
@ -113,6 +114,39 @@ class ReqServer(threading.Thread):
|
|||
|
||||
zmq.device(zmq.QUEUE, self.clients, self.workers)
|
||||
|
||||
def _handle_payload(self, payload):
|
||||
'''
|
||||
The _handle_payload method is the key method used to figure out what
|
||||
needs to be done with communication to the server
|
||||
'''
|
||||
return {'aes': self._handle_aes,
|
||||
'pub': self._handle_pub,
|
||||
'clear': self._handle_clear}[payload['enc']](payload[load])
|
||||
|
||||
def _handle_clear(self, load):
|
||||
'''
|
||||
Take care of a cleartext command
|
||||
'''
|
||||
return getattr(self, load['cmd'])(load)
|
||||
|
||||
def _handle_pub(self, load):
|
||||
'''
|
||||
Handle a command sent via a public key pair
|
||||
'''
|
||||
pass
|
||||
|
||||
def _handle_aes(self. load):
|
||||
'''
|
||||
Handle a command sent via an aes key
|
||||
'''
|
||||
pass
|
||||
|
||||
def _auth(self, load):
|
||||
'''
|
||||
Authenticate the client, use the sent public key to encrypt the aes key
|
||||
which was generated at start up
|
||||
'''
|
||||
|
||||
def run(self):
|
||||
'''
|
||||
Start up the ReqServer
|
||||
|
|
Loading…
Add table
Reference in a new issue