jlafon / ansible-profile

An Ansible plugin for timing tasks
http://jlafon.io/ansible-profiling.html
MIT License
342 stars 57 forks source link

Failing on ansible 1.9 #14

Open Eyjafjallajokull opened 8 years ago

Eyjafjallajokull commented 8 years ago

Hey, When using ansible 1.9 and installing this plugin with

wget https://raw.githubusercontent.com/jlafon/ansible-profile/master/callback_plugins/profile_tasks.py

I get following error when running ansible:

Traceback (most recent call last):
  File "/usr/bin/ansible-playbook", line 324, in <module>
    sys.exit(main(sys.argv[1:]))
  File "/usr/bin/ansible-playbook", line 210, in main
    force_handlers=options.force_handlers,
  File "/usr/lib/pymodules/python2.7/ansible/playbook/__init__.py", line 181, in __init__
    ansible.callbacks.load_callback_plugins()
  File "/usr/lib/pymodules/python2.7/ansible/callbacks.py", line 51, in load_callback_plugins
    callback_plugins = [x for x in utils.plugins.callback_loader.all()]
  File "/usr/lib/pymodules/python2.7/ansible/utils/plugins.py", line 232, in all
    self._module_cache[path] = imp.load_source('.'.join([self.package, name]), path)
  File "/usr/share/ansible_plugins/callback_plugins/profile_tasks.py", line 4, in <module>
    from ansible.plugins.callback import CallbackBase
ImportError: No module named plugins.callback

Please tag commit 168cb0996fd which is compatible with 1.9 and update readme with something like:

wget https://raw.githubusercontent.com/jlafon/ansible-profile/v1.9/callback_plugins/profile_tasks.py
pastephens commented 8 years ago

Hi, what am I not doing or doing wrong?

ansible --version ansible 1.9.4 configured module search path = /usr/share/ansible

Traceback (most recent call last): File "/usr/bin/ansible-playbook", line 324, in sys.exit(main(sys.argv[1:])) File "/usr/bin/ansible-playbook", line 210, in main force_handlers=options.force_handlers, File "/usr/lib/python2.7/site-packages/ansible/playbook/init.py", line 181, in init ansible.callbacks.load_callback_plugins() File "/usr/lib/python2.7/site-packages/ansible/callbacks.py", line 51, in load_callback_plugins callback_plugins = [x for x in utils.plugins.callback_loader.all()] File "/usr/lib/python2.7/site-packages/ansible/utils/plugins.py", line 232, in all self._module_cache[path] = imp.load_source('.'.join([self.package, name]), path) File "/home/stephens1/ansible/callback_plugins/profile_tasks.py", line 4, in from ansible.plugins.callback import CallbackBase ImportError: No module named plugins.callback

fridim commented 8 years ago

same here:

Traceback (most recent call last):
  File "/usr/bin/ansible-playbook", line 324, in <module>
    sys.exit(main(sys.argv[1:]))
  File "/usr/bin/ansible-playbook", line 210, in main
    force_handlers=options.force_handlers,
  File "/usr/lib/python2.7/site-packages/ansible/playbook/__init__.py", line 181, in __init__
    ansible.callbacks.load_callback_plugins()
  File "/usr/lib/python2.7/site-packages/ansible/callbacks.py", line 51, in load_callback_plugins
    callback_plugins = [x for x in utils.plugins.callback_loader.all()]
  File "/usr/lib/python2.7/site-packages/ansible/utils/plugins.py", line 232, in all
    self._module_cache[path] = imp.load_source('.'.join([self.package, name]), path)
  File "/home/jenkins/workspace/rcip-openshift-ansible-openstack-functional-tests/rcip-openshift-ansible/callback_plugins/profile_tasks.py", line 4, in <module>
    from ansible.plugins.callback import CallbackBase
ImportError: No module named plugins.callback

i'm not sure the line from ansible.plugins.callback import CallbackBase is needed for 1.9

see: https://github.com/ansible/ansible/tree/stable-1.9/plugins/callbacks

oalders commented 8 years ago

Since the tag hasn't been created as requested by @Eyjafjallajokull, this should work in the meantime:

wget https://raw.githubusercontent.com/jlafon/ansible-profile/168cb0996fd1b8b5f27d515e87b1c4154078b6b0/callback_plugins/profile_tasks.py