Cloned Ansible from github, now I have 'module' object has no attribute 'COLOER_ERROR'

When running ad-hoc ansible commands, I get the following error:

$ ansible slackware-lab-64 -m setup

[WARNING]: Error when using <bound method CallbackModule.v2_runner_on_failed of </home/ansible-user/ansible/lib/ansible/plugins/callback/minimal.CallbackModule object at 0x21d15d0>>: ‘module’ object has no attribute
‘COLOR_ERROR’

I am also getting the ssh_split error whenever I try to run a playbook, so my Ansible is completely broken right now.

Fixed the typo in the subject. The ad-hoc commands are failing instantly after this error.

I noticed that this module isn’t importing this module:

from ansible.utils.color import colorize, hostcolor

To be clear, in /ansible/lib/ansible/plugins/callback/minimal, there is no import of ansible.utils.color:

Make coding more python3-ish

from future import (absolute_import, division, print_function)
metaclass = type

from ansible.plugins.callback import CallbackBase
from ansible import constants as C

class CallbackModule(CallbackBase):

Based on this email and your other email about the ssh error, it looks like you are running a mismatched partially updated version of ansible. I might recommend completely uninstalling and reinstalling ansible.

That sounds like a bug, then. Do you know where to report it?

I would see if adding the allege missing line fixes the problem before reporting it as bug. I don’t know if I have the most current build, but that line is missing from my last pull:

$ ansible --version
ansible 2.1.0 (devel fb797a9e77) last updated 2016/01/22 14:23:55 (GMT -500)

In the minimal.py callback the reference is to C.COLOR_ERROR. C comes from the ‘from ansible import constants as C’

I can see COLOR_ERROR in constants.py. If this error is happening, it would appear that the code is out of sync.

https://github.com/ansible/ansible/blob/d3deb24ead59d5fdbecad3c946848537f95772ad/lib/ansible/constants.py#L274

https://github.com/ansible/ansible/blob/d3deb24ead59d5fdbecad3c946848537f95772ad/lib/ansible/plugins/callback/minimal.py#L56

These changes were implemented on Dec 29.

Hi Matt,

I did the following:

rm -rf ansible/
git clone git://github.com/ansible/ansible.git --recursive
cd ansible/
source hacking/env-setup

I did it again just now. I still get the same attribute ‘COLOR_ERROR’ when attempting ad-hoc commands and attribute split_ssh_args error when running playbooks.

What am I missing?
Thanks a ton for your input! I appreciate it.

Joanna

Do you have ansible installed anywhere else on that system?

What do you get when you run:

python -c “import sys; print sys.path”

You should see what is in your PYTHONPATH from using env-setup at the front after ‘’. If not, then something could be inserting additional paths for python to search, and you could be grabbing files from incorrect locations.

Hi Arthur,

When I run ansible --version, I get this:

$ ansible --version
ansible 2.1.0
config file = /home/ansible-user/parkland/config/ansible.cfg
configured module search path = Default w/o overrides

It appears that I do have another installation as well. Grr. I’ll ask pip to uninstall for me.

$ python -c “import sys; print sys.path”

[‘’, ‘/usr/lib/python2.7/site-packages/ansible-2.1.0-py2.7.egg’, ‘/home/ansible/ansible/lib’, ‘/home/ansible/parkland’, ‘/usr/lib64/python27.zip’, ‘/usr/lib64/python2.7’, ‘/usr/lib64/python2.7/plat-linux2’, ‘/usr/lib64/python2.7/lib-tk’, ‘/usr/lib64/python2.7/lib-old’, ‘/usr/lib64/python2.7/lib-dynload’, ‘/usr/lib64/python2.7/site-packages’, ‘/usr/lib64/python2.7/site-packages/gtk-2.0’, ‘/usr/lib/python2.7/site-packages’, ‘/usr/lib/python2.7/site-packages’]

Matt, I owe you a drink.

sudo pip uninstall ansible removed the extra ansible installation. Now ansible functions again from the git clone.

Thanks!
Joanna

run ‘make clean’ on the github repo, it seems you are mixing old files with the new code. You’ll need to run . hacking/env-setup again.

Hi Brian,

Thanks! It turns out I had a system installation still hanging around in addition to the github clone. So, I pip uninstalled to remove the system installation of Ansible and now everything works again.