Bug? In Yum module, under CentOS 6.6 - plugins not loaded

40 views
Skip to first unread message

Eric Coulter

unread,
Aug 19, 2015, 10:02:19 PM8/19/15
to Ansible Project
On a machine running CentOS 6.6, and the Rocks cluster management software,
with Python 2.6.6, yum version 3.2.29,
I get the following errors from running one of the example plays in the yum module:

#############
# cat yum_test.yml
---
 - hosts: headnode
   tasks:
   - name: ensure httpd present (example in docs)
     yum: name=httpd state=present
##############

# ansible-playbook -vvv yum_test.yml                    
No config file found; using defaults
1 plays in yum_test.yml

PLAY ***************************************************************************

TASK [setup] *******************************************************************
ESTABLISH LOCAL CONNECTION FOR USER: root
localhost EXEC mkdir -p "$HOME/.ansible/tmp/ansible-tmp-1439997821.13-201432756979773" && echo "$HOME/.ansible/tmp/ansible-tmp-1439997821.13-201432756979773"
localhost PUT /tmp/tmpYGI4Qv TO /root/.ansible/tmp/ansible-tmp-1439997821.13-201432756979773/setup
localhost EXEC LANG=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1439997821.13-201432756979773/setup; rm -rf "/root/.ansible/tmp/ansible-tmp-1439997821.13-201432756979773/" >/dev/null 2>&1
ok: [localhost]

TASK [install XSEDE yum repo] **************************************************
ESTABLISH LOCAL CONNECTION FOR USER: root
localhost EXEC mkdir -p "$HOME/.ansible/tmp/ansible-tmp-1439997821.64-29832905906944" && echo "$HOME/.ansible/tmp/ansible-tmp-1439997821.64-29832905906944"
localhost PUT /tmp/tmpkYALU8 TO /root/.ansible/tmp/ansible-tmp-1439997821.64-29832905906944/yum
localhost EXEC LANG=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python -tt /root/.ansible/tmp/ansible-tmp-1439997821.64-29832905906944/yum; rm -rf "/root/.ansible/tmp/ansible-tmp-1439997821.64-29832905906944/" >/dev/null 2>&1
An exception occurred during task execution. The full traceback is:
Traceback (most recent call last):
  File "/root/.ansible/tmp/ansible-tmp-1439997821.64-29832905906944/yum", line 3424, in <module>
    main()
  File "/root/.ansible/tmp/ansible-tmp-1439997821.64-29832905906944/yum", line 919, in main
    if 'rhnplugin' in my.plugins._plugins:
AttributeError: DummyYumPlugins instance has no attribute '_plugins'

fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "parsed": false}

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

########################################

It appears that in ansible/lib/ansible/modules/core/packaging/os/yum.py
the comment in lines 917-918 is not true (at least for my system...)

914         my = yum_base(params['conf_file'])
915         # A sideeffect of accessing conf is that the configuration is
916         # loaded and plugins are discovered
917         my.conf
919         repoquery = None
919         if 'rhnplugin' in my.plugins._plugins:

Anyone run into this before? I assume it's something in my local environment, but no idea where to look.


Thanks!
Eric C.


Toshio Kuratomi

unread,
Aug 20, 2015, 6:20:11 PM8/20/15
to ansible...@googlegroups.com
I haven't seen that either. I could make that check for 'rhnplugin'
in my.plugins more robust in case of an exception but I'm not sure
what would cause it in the first place.
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-proje...@googlegroups.com.
> To post to this group, send email to ansible...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/f60edf6a-d500-4c32-9fbd-ac6bd2a89869%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Toshio Kuratomi

unread,
Aug 20, 2015, 6:44:57 PM8/20/15
to ansible...@googlegroups.com
Okay, I've just pushed a commit that should fix the traceback:
https://github.com/ansible/ansible-modules-core/commit/4721d6d8b5e251054b01ddaf8bb852e8204c2c9f

the commit assumes that if there's no _plugins attribute then we don't
have the rhnplugin enabled. That seems reasonable but it is just an
assumption. Hopefully it proves correct in practice.

-Toshio

Eric Coulter

unread,
Aug 21, 2015, 12:02:56 PM8/21/15
to Ansible Project
Awesome! The new commit does work on my system. I really appreciate your quick response.

Thanks a lot!

Eric C.
Reply all
Reply to author
Forward
0 new messages