Skip to content
This repository has been archived by the owner on Nov 22, 2021. It is now read-only.

request urllib3 pkg error #25

Open
lorimariner opened this issue Jul 24, 2017 · 4 comments
Open

request urllib3 pkg error #25

lorimariner opened this issue Jul 24, 2017 · 4 comments

Comments

@lorimariner
Copy link

lorimariner commented Jul 24, 2017

I installed this on Ansible 2.3.0.0 Python 2.7.5;
Set my parameters for Infoblox and kept receiving errors:
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: 'module' object has no attribute 'urllib3'
failed: [localhost] (item=test01.local) => {"failed": true, "item": "test01.local", "module_stderr": "Traceback (most recent call last):\n File "/tmp/ansible_94H14V/ansible_module_infoblox.py", line 8, in \n requests.packages.urllib3.disable_warnings()\nAttributeError: 'module' object has no attribute 'urllib3'\n", "module_stdout": "", "msg": "MODULE FAILURE", "rc": 0}

@lorimariner
Copy link
Author

I discovered the the request module does not have the package urllib3 so with this entry: requests.packages.urllib3.disable_warnings()
It continued to fail.

I modified by adding:
import urllib3
urllib3.disable_warnings()

Fixed the error

@lorimariner
Copy link
Author

I am able to connect and verify the existing hosts that are in Infoblox but continue to have this error output:
TASK [Add host] **************************************************************************************************************************
task path: /var/lib/awx/projects/ansible-tower/infoblox_example.yml:7
Using module file /usr/share/my_modules/ansible-module-infoblox/infoblox.py
<10.150.253.151> ESTABLISH LOCAL CONNECTION FOR USER: root
<10.150.253.151> EXEC /bin/sh -c 'echo ~ && sleep 0'
<10.150.253.151> EXEC /bin/sh -c '( umask 77 && mkdir -p "echo /root/.ansible/tmp/ansible-tmp-1500910719.66-264084341675421" && echo ansible-tmp-1500910719.66-264084341675421="echo /root/.ansible/tmp/ansible-tmp-1500910719.66-264084341675421" ) && sleep 0'
<10.150.253.151> PUT /tmp/tmpyQ58Ax TO /root/.ansible/tmp/ansible-tmp-1500910719.66-264084341675421/infoblox.py
<10.150.253.151> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1500910719.66-264084341675421/ /root/.ansible/tmp/ansible-tmp-1500910719.66-264084341675421/infoblox.py && sleep 0'
<10.150.253.151> EXEC /bin/sh -c '/usr/bin/python /root/.ansible/tmp/ansible-tmp-1500910719.66-264084341675421/infoblox.py; rm -rf "/root/.ansible/tmp/ansible-tmp-1500910719.66-264084341675421/" > /dev/null 2>&1 && sleep 0'
The full traceback is:
Traceback (most recent call last):
File "/tmp/ansible_TJu_Sj/ansible_module_infoblox.py", line 771, in
main()
File "/tmp/ansible_TJu_Sj/ansible_module_infoblox.py", line 686, in main
result = infoblox.create_host_record(host, network, address, comment)
File "/tmp/ansible_TJu_Sj/ansible_module_infoblox.py", line 357, in create_host_record
return self.invoke("post", "record:host?_return_fields=ipv4addrs", ok_codes=(200, 201, 400), json=payload)
File "/tmp/ansible_TJu_Sj/ansible_module_infoblox.py", line 185, in invoke
response.raise_for_status()
File "/usr/lib/python2.7/site-packages/requests/models.py", line 937, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://10.150.253.151/wapi/v1.7.1/record:host?_return_fields=ipv4addrs
failed: [infoblox] (item=test01.local) => {
"failed": true,
"item": "test01.local",
"module_stderr": "Traceback (most recent call last):\n File "/tmp/ansible_TJu_Sj/ansible_module_infoblox.py", line 771, in \n main()\n File "/tmp/ansible_TJu_Sj/ansible_module_infoblox.py", line 686, in main\n result = infoblox.create_host_record(host, network, address, comment)\n File "/tmp/ansible_TJu_Sj/ansible_module_infoblox.py", line 357, in create_host_record\n return self.invoke("post", "record:host?_return_fields=ipv4addrs", ok_codes=(200, 201, 400), json=payload)\n File "/tmp/ansible_TJu_Sj/ansible_module_infoblox.py", line 185, in invoke\n response.raise_for_status()\n File "/usr/lib/python2.7/site-packages/requests/models.py", line 937, in raise_for_status\n raise HTTPError(http_error_msg, response=self)\nrequests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://10.150.253.151/wapi/v1.7.1/record:host?_return_fields=ipv4addrs\n",
"module_stdout": "",
"msg": "MODULE FAILURE",
"rc": 0
}
to retry, use: --limit @/var/lib/awx/projects/ansible-tower/infoblox_example.retry

PLAY RECAP *******************************************************************************************************************************
infoblox : ok=0 changed=0 unreachable=0 failed=1

@lorimariner
Copy link
Author

the last httperror is this:
{ "Error": "AdmConProtoError: Unknown argument/field: 'ipv4addrs\n"'",
"code": "Client.Ibap.Proto",
"text": "Unknown argument/field: 'ipv4addrs\n"'"
}

@seph3
Copy link

seph3 commented Jan 9, 2018

I have same issue for action "get_a_record"

fatal: [localhost]: FAILED! => {
"changed": false,
"module_stderr": "Traceback (most recent call last):\n File "/tmp/ansible_TNQH5i/ansible_module_infoblox.py", line 185, in \n requests.packages.urllib3.disable_warnings()\nAttributeError: 'module' object has no attribute 'urllib3'\n",
"module_stdout": "",
"msg": "MODULE FAILURE",
"rc": 0

My configuration:
ansible-playbook 2.4.2.0
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/usr/share/ansible/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /bin/ansible-playbook
python version = 2.7.5 (default, May 3 2017, 07:55:04) [GCC 4.8.5 20150623 (Red Hat 4.8.5-14)]

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants