add note on write access to socket_path (#67060)
* Change socket_path error messages to not directly refer to socket_path * Apply suggestions from code review Co-Authored-By: Nathaniel Case <this.is@nathanielca.se>
This commit is contained in:
parent
28543ae208
commit
7ef7c1b5d7
2 changed files with 22 additions and 12 deletions
|
@ -197,13 +197,12 @@ Then review the log file and find the relevant error message in the rest of this
|
||||||
|
|
||||||
.. _socket_path_issue:
|
.. _socket_path_issue:
|
||||||
|
|
||||||
Category "socket_path issue"
|
Troubleshooting socket path issues
|
||||||
============================
|
==================================
|
||||||
|
|
||||||
**Platforms:** Any
|
**Platforms:** Any
|
||||||
|
|
||||||
The ``socket_path does not exist or cannot be found`` and ``unable to connect to socket`` messages are new in Ansible 2.5. These messages indicate that the socket used to communicate with the remote network device is unavailable or does not exist.
|
The ``Socket path does not exist or cannot be found`` and ``Unable to connect to socket`` messages are new in Ansible 2.5. These messages indicate that the socket used to communicate with the remote network device is unavailable or does not exist.
|
||||||
|
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
|
@ -212,7 +211,7 @@ For example:
|
||||||
fatal: [spine02]: FAILED! => {
|
fatal: [spine02]: FAILED! => {
|
||||||
"changed": false,
|
"changed": false,
|
||||||
"failed": true,
|
"failed": true,
|
||||||
"module_stderr": "Traceback (most recent call last):\n File \"/tmp/ansible_TSqk5J/ansible_modlib.zip/ansible/module_utils/connection.py\", line 115, in _exec_jsonrpc\nansible.module_utils.connection.ConnectionError: socket_path does not exist or cannot be found\n",
|
"module_stderr": "Traceback (most recent call last):\n File \"/tmp/ansible_TSqk5J/ansible_modlib.zip/ansible/module_utils/connection.py\", line 115, in _exec_jsonrpc\nansible.module_utils.connection.ConnectionError: Socket path XX does not exist or cannot be found. See Troubleshooting socket path issues in the Network Debug and Troubleshooting Guide\n",
|
||||||
"module_stdout": "",
|
"module_stdout": "",
|
||||||
"msg": "MODULE FAILURE",
|
"msg": "MODULE FAILURE",
|
||||||
"rc": 1
|
"rc": 1
|
||||||
|
@ -225,7 +224,7 @@ or
|
||||||
fatal: [spine02]: FAILED! => {
|
fatal: [spine02]: FAILED! => {
|
||||||
"changed": false,
|
"changed": false,
|
||||||
"failed": true,
|
"failed": true,
|
||||||
"module_stderr": "Traceback (most recent call last):\n File \"/tmp/ansible_TSqk5J/ansible_modlib.zip/ansible/module_utils/connection.py\", line 123, in _exec_jsonrpc\nansible.module_utils.connection.ConnectionError: unable to connect to socket\n",
|
"module_stderr": "Traceback (most recent call last):\n File \"/tmp/ansible_TSqk5J/ansible_modlib.zip/ansible/module_utils/connection.py\", line 123, in _exec_jsonrpc\nansible.module_utils.connection.ConnectionError: Unable to connect to socket XX. See Troubleshooting socket path issues in Network Debug and Troubleshooting Guide\n",
|
||||||
"module_stdout": "",
|
"module_stdout": "",
|
||||||
"msg": "MODULE FAILURE",
|
"msg": "MODULE FAILURE",
|
||||||
"rc": 1
|
"rc": 1
|
||||||
|
@ -233,7 +232,9 @@ or
|
||||||
|
|
||||||
Suggestions to resolve:
|
Suggestions to resolve:
|
||||||
|
|
||||||
Follow the steps detailed in :ref:`enable network logging <enable_network_logging>`.
|
#. Verify that you have write access to the socket path described in the error message.
|
||||||
|
|
||||||
|
#. Follow the steps detailed in :ref:`enable network logging <enable_network_logging>`.
|
||||||
|
|
||||||
If the identified error message from the log file is:
|
If the identified error message from the log file is:
|
||||||
|
|
||||||
|
|
|
@ -135,8 +135,10 @@ class Connection(object):
|
||||||
reqid = req['id']
|
reqid = req['id']
|
||||||
|
|
||||||
if not os.path.exists(self.socket_path):
|
if not os.path.exists(self.socket_path):
|
||||||
raise ConnectionError('socket_path does not exist or cannot be found.'
|
raise ConnectionError(
|
||||||
'\nSee the socket_path issue category in Network Debug and Troubleshooting Guide')
|
'socket path %s does not exist or cannot be found. See Troubleshooting socket '
|
||||||
|
'path issues in the Network Debug and Troubleshooting Guide' % self.socket_path
|
||||||
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
data = json.dumps(req, cls=AnsibleJSONEncoder)
|
data = json.dumps(req, cls=AnsibleJSONEncoder)
|
||||||
|
@ -149,8 +151,11 @@ class Connection(object):
|
||||||
try:
|
try:
|
||||||
out = self.send(data)
|
out = self.send(data)
|
||||||
except socket.error as e:
|
except socket.error as e:
|
||||||
raise ConnectionError('unable to connect to socket. See the socket_path issue category in Network Debug and Troubleshooting Guide',
|
raise ConnectionError(
|
||||||
err=to_text(e, errors='surrogate_then_replace'), exception=traceback.format_exc())
|
'unable to connect to socket %s. See Troubleshooting socket path issues '
|
||||||
|
'in the Network Debug and Troubleshooting Guide' % self.socket_path,
|
||||||
|
err=to_text(e, errors='surrogate_then_replace'), exception=traceback.format_exc()
|
||||||
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
response = json.loads(out)
|
response = json.loads(out)
|
||||||
|
@ -198,7 +203,11 @@ class Connection(object):
|
||||||
|
|
||||||
except socket.error as e:
|
except socket.error as e:
|
||||||
sf.close()
|
sf.close()
|
||||||
raise ConnectionError('unable to connect to socket', err=to_text(e, errors='surrogate_then_replace'), exception=traceback.format_exc())
|
raise ConnectionError(
|
||||||
|
'unable to connect to socket %s. See the socket path issue category in '
|
||||||
|
'Network Debug and Troubleshooting Guide' % self.socket_path,
|
||||||
|
err=to_text(e, errors='surrogate_then_replace'), exception=traceback.format_exc()
|
||||||
|
)
|
||||||
|
|
||||||
sf.close()
|
sf.close()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue