mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 03:11:24 -07:00
Enos connection issue (#32895)
* Changes due to connection issues * Adding changes pertaining to connection issue of Ansible * Review comments of Kedar * Adding EOL PyLint issue * Fixing pep8 and yamlint issues
This commit is contained in:
parent
a1517234f6
commit
e5b3f60a74
3 changed files with 33 additions and 41 deletions
|
@ -35,6 +35,7 @@ from ansible.module_utils._text import to_text
|
|||
from ansible.module_utils.basic import env_fallback, return_values
|
||||
from ansible.module_utils.network_common import to_list, EntityCollection
|
||||
from ansible.module_utils.connection import Connection, exec_command
|
||||
from ansible.module_utils.connection import ConnectionError
|
||||
|
||||
_DEVICE_CONFIGS = {}
|
||||
_CONNECTION = None
|
||||
|
@ -75,7 +76,7 @@ def get_connection(module):
|
|||
global _CONNECTION
|
||||
if _CONNECTION:
|
||||
return _CONNECTION
|
||||
_CONNECTION = Connection(module)
|
||||
_CONNECTION = Connection(module._socket_path)
|
||||
|
||||
context = None
|
||||
try:
|
||||
|
@ -144,8 +145,11 @@ def run_commands(module, commands, check_rc=True):
|
|||
|
||||
|
||||
def load_config(module, config):
|
||||
conn = get_connection(module)
|
||||
conn.edit_config(config)
|
||||
try:
|
||||
conn = get_connection(module)
|
||||
conn.edit_config(config)
|
||||
except ConnectionError as exc:
|
||||
module.fail_json(msg=to_text(exc))
|
||||
|
||||
|
||||
def get_defaults_flag(module):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue