fix: failure when changing network device passwords through a gateway

This commit is contained in:
lettimepassby
2026-04-29 15:37:36 +08:00
committed by 老广
parent 5c09ce2a2f
commit 11b244888d
2 changed files with 5 additions and 1 deletions

View File

@@ -40,6 +40,8 @@
password: "{{ account.secret }}"
commands: "{{ params.commands }}"
first_conn_delay_time: "{{ first_conn_delay_time | default(0.5) }}"
gateway_args: "{{ jms_asset.ansible_ssh_common_args | default(None) }}"
old_ssh_version: "{{ jms_asset.old_ssh_version | default(False) }}"
ignore_errors: true
when: ping_info is succeeded
register: change_info

View File

@@ -174,7 +174,7 @@ class SSHClient:
self.client.connect(**self.connect_params)
self.is_connect = True
err_msg = self.switch_user()
self.after_runner_end()
# self.after_runner_end()
except Exception as err:
err_msg = str(err)
return err_msg
@@ -205,6 +205,8 @@ class SSHClient:
output += received_output
except Exception as e:
error_msg = str(e)
finally:
self.after_runner_end()
return output, error_msg
def __del__(self):