AttributeError: 'module' object has no attribute 'ETIME' - after git update

Had a working setup using the dev branch from a week or two ago… today I did an update and after that I am getting an error:

GATHERING FACTS ***************************************************************
<107.170.122.172> REMOTE_MODULE setup
<10.1.1.191> REMOTE_MODULE setup
fatal: [fat.natserv.net] => failed to parse: Traceback (most recent call last):
File “/root/.ansible/tmp/ansible-tmp-1397944758.52-275089191503778/setup”, line 1391, in
def timeout(seconds=10, error_message=os.strerror(errno.ETIME)):
AttributeError: ‘module’ object has no attribute ‘ETIME’

The error only happens going against a FreeBSD machine. No error against ubuntu.

The FreeBSD machine in question is a test machine so I don’t recall having done any updates to it.

Control machine: 10.0-RELEASE-p1
Ansible in control machine: ansible 1.6 (devel ae29e43f93) last updated 2014/04/19 17:36:26 (GMT -400)

Node FreeBSD machine: Python 2.7.6

Any pointers greatly appreciated.

Had a working setup using the dev branch from a week or two ago… today I did an update and after that I am getting an error:

fatal: [fat.natserv.net] => failed to parse: Traceback (most recent call last):

I have another playbook which disables gathering facts
gather_facts: False

That playbook works without issues. So the problem is gathering facts in FreeBSD.

This actually affects also FreeBSD 8 and 9, the issue is that python errno module does not have ETIME constant on FreeBSD, this constant is used by the new timer module. The patch below fixes this in my tests, PR incoming.

diff --git a/lib/ansible/module_utils/facts.py b/lib/ansible/module_utils/facts.py
index c056404…4c3e5ad 100644
— a/lib/ansible/module_utils/facts.py
+++ b/lib/ansible/module_utils/facts.py
@@ -49,7 +49,7 @@ except ImportError:
class TimeoutError(Exception):
pass

-def timeout(seconds=10, error_message=os.strerror(errno.ETIME)):
+def timeout(seconds=10, error_message=“Timer expired”):
def decorator(func):
def _handle_timeout(signum, frame):
raise TimeoutError(error_message)

https://github.com/ansible/ansible/pull/7081

Thanks.
That worked nicely. Patched my local copy until the repo has the fix.

Merged, thanks!

We should not be putting functional calls in default assignments either so glad to see that cleaned up :slight_smile: