mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-23 19:01:26 -07:00
Create persistent socket path using port and connection type (#28492)
* Create persistent socket path using port and connection type * Use remote address, port, connection type and remote user to create a socket path. * Fix review comment
This commit is contained in:
parent
9407a17c40
commit
cd8c1c1108
2 changed files with 4 additions and 2 deletions
|
@ -295,7 +295,7 @@ def main():
|
|||
sys.exit("FAIL: %s" % e)
|
||||
|
||||
ssh = connection_loader.get('ssh', class_only=True)
|
||||
cp = ssh._create_control_path(pc.remote_addr, pc.port, pc.remote_user)
|
||||
cp = ssh._create_control_path(pc.remote_addr, pc.port, pc.remote_user, pc.connection)
|
||||
|
||||
# create the persistent connection dir if need be and create the paths
|
||||
# which we will be using later
|
||||
|
|
|
@ -268,9 +268,11 @@ class Connection(ConnectionBase):
|
|||
sock.close()
|
||||
|
||||
@staticmethod
|
||||
def _create_control_path(host, port, user):
|
||||
def _create_control_path(host, port, user, connection=None):
|
||||
'''Make a hash for the controlpath based on con attributes'''
|
||||
pstring = '%s-%s-%s' % (host, port, user)
|
||||
if connection:
|
||||
pstring += '-%s' % connection
|
||||
m = hashlib.sha1()
|
||||
m.update(to_bytes(pstring))
|
||||
digest = m.hexdigest()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue