Hi everyone,
I have opened this ‘thread’ to show an error than I am getting with ansible ecs_* modules ( Amazon Elastic Container Service ). First, my server details:
CentOS 7.2.1511
Python 2.7.5
ansible 2.1.0.0
I begin to take this error executing ECS task definition through module ecs_taskdefinition:
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ValueError: No JSON object could be decoded
fatal: [localhost]: FAILED! => {“changed”: false, “failed”: true, “module_stderr”: “Traceback (most recent call last):\n File "/tmp/ansible_NPl9xZ/ansible_module_ecs_taskdefinition.py", line 221, in \n main()\n File "/tmp/ansible_NPl9xZ/ansible_module_ecs_taskdefinition.py", line 181, in main\n existing = task_mgr.describe_task(task_to_describe)\n File "/tmp/ansible_NPl9xZ/ansible_module_ecs_taskdefinition.py", line 127, in describe_task\n response = self.ecs.describe_task_definition(taskDefinition=task_name)\n File "/usr/lib/python2.7/site-packages/botocore/client.py", line 278, in _api_call\n return self._make_api_call(operation_name, kwargs)\n File "/usr/lib/python2.7/site-packages/botocore/client.py", line 561, in _make_api_call\n operation_model, request_dict)\n File "/usr/lib/python2.7/site-packages/botocore/endpoint.py", line 117, in make_request\n return self._send_request(request_dict, operation_model)\n File "/usr/lib/python2.7/site-packages/botocore/endpoint.py", line 144, in _send_request\n request, operation_model, attempts)\n File "/usr/lib/python2.7/site-packages/botocore/endpoint.py", line 203, in _get_response\n response_dict, operation_model.output_shape)\n File "/usr/lib/python2.7/site-packages/botocore/parsers.py", line 209, in parse\n parsed = self._do_error_parse(response, shape)\n File "/usr/lib/python2.7/site-packages/botocore/parsers.py", line 542, in _do_error_parse\n body = self._parse_body_as_json(response[‘body’])\n File "/usr/lib/python2.7/site-packages/botocore/parsers.py", line 574, in _parse_body_as_json\n original_parsed = json.loads(body)\n File "/usr/lib64/python2.7/json/init.py", line 338, in loads\n return _default_decoder.decode(s)\n File "/usr/lib64/python2.7/json/decoder.py", line 365, in decode\n obj, end = self.raw_decode(s, idx=_w(s, 0).end())\n File "/usr/lib64/python2.7/json/decoder.py", line 383, in raw_decode\n raise ValueError("No JSON object could be decoded")\nValueError: No JSON object could be decoded\n”, “module_stdout”: “”, “msg”: “MODULE FAILURE”, “parsed”: false}
This was a VMWare virtualized server with CentOS 7, as I tryed same script in a VPS server with same CentOS 7 version, and the script executed OK. Later I tried several Linux distros, such as Ubuntu 14, Ubuntu 16 and Arch, getting same error.
Doing some debugging, I saw the script crashed here:
subprocess.py(1461): for fd, mode in ready:
subprocess.py(1453): while fd2file:
subprocess.py(1454): try:
subprocess.py(1455): ready = poller.poll()
subprocess.py(1461): for fdTraceback (most recent call last):
File “/tmp/ansible_Z6VzDk/ansible_module_ecs_taskdefinition.py”, line 221, in
main()
File “/tmp/ansible_Z6VzDk/ansible_module_ecs_taskdefinition.py”, line 181, in main
existing = task_mgr.describe_task(task_to_describe)
File “/tmp/ansible_Z6VzDk/ansible_module_ecs_taskdefinition.py”, line 127, in describe_task
response = self.ecs.describe_task_definition(taskDefinition=task_name)
File “/usr/lib/python2.7/site-packages/botocore/client.py”, line 278, in _api_call
return self._make_api_call(operation_name, kwargs)
File “/usr/lib/python2.7/site-packages/botocore/client.py”, line 561, in _make_api_call
operation_model, request_dict)
File “/usr/lib/python2.7/site-packages/botocore/endpoint.py”, line 117, in make_request
return self._send_request(request_dict, operation_model)
File “/usr/lib/python2.7/site-packages/botocore/endpoint.py”, line 144, in _send_request
request, operation_model, attempts)
File “/usr/lib/python2.7/site-packages/botocore/endpoint.py”, line 203, in _get_response
response_dict, operation_model.output_shape)
File “/usr/lib/python2.7/site-packages/botocore/parsers.py”, line 209, in parse
parsed = self._do_error_parse(response, shape)
File “/usr/lib/python2.7/site-packages/botocore/parsers.py”, line 542, in _do_error_parse
body = self._parse_body_as_json(response[‘body’])
File “/usr/lib/python2.7/site-packages/botocore/parsers.py”, line 574, in _parse_body_as_json
original_parsed = json.loads(body)
File “/usr/lib64/python2.7/json/init.py”, line 338, in loads
return _default_decoder.decode(s)
File “/usr/lib64/python2.7/json/decoder.py”, line 365, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File “/usr/lib64/python2.7/json/decoder.py”, line 383, in raw_decode
raise ValueError(“No JSON object could be decoded”)
ValueError: No JSON object could be decoded
, mode in ready:
subprocess.py(1462): if mode & select.POLLOUT:
Later, I saw that crashing system was using ‘subprocess.py’ coming with default python, while working system had this instead:
/usr/lib/python2.7/site-packages/kitchen/pycompat24/subprocess.py
/usr/lib/python2.7/site-packages/kitchen/pycompat24/subprocess.pyc
/usr/lib/python2.7/site-packages/kitchen/pycompat24/subprocess.pyo
/usr/lib/python2.7/site-packages/kitchen/pycompat27/subprocess/_subprocess.py
/usr/lib/python2.7/site-packages/kitchen/pycompat27/subprocess/_subprocess.pyc
/usr/lib/python2.7/site-packages/kitchen/pycompat27/subprocess/_subprocess.pyo
I tried installing a new Centos 7 machine, and configuring python to work with the libraries above, but it doesn’t take effect.
Now I have no more ideas to make it work, ¿could anyone help me or is getting the same error?
Best regards
Luis Miguel