rhn_register module does not work on RHEL5 hosts

Hi list

I am trying to register my RHEL5 hosts to RHN. Here is an example what I do:

ansible HostA -kK -u admin -m rhn_register -a “state=present username=YYYY password=XXXX”

And the output:

HostA | FAILED => failed to parse:
Traceback (most recent call last):
File “/home/admin/.ansible/tmp/ansible-1371109421.04-39163328736735/rhn_register”, line 1264, in ?
main()
File “/home/admin/.ansible/tmp/ansible-1371109421.04-39163328736735/rhn_register”, line 349, in main
rhn.register(module.params[‘enable_eus’] == True, activationkey)
File “/home/admin/.ansible/tmp/ansible-1371109421.04-39163328736735/rhn_register”, line 263, in register
run_command(register_cmd)
File “/home/admin/.ansible/tmp/ansible-1371109421.04-39163328736735/rhn_register”, line 101, in run_command
stderr=subprocess.STDOUT)
File “/usr/lib64/python2.4/subprocess.py”, line 550, in init
errread, errwrite)
File “/usr/lib64/python2.4/subprocess.py”, line 996, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory

I have all required packages on remote host:

[root@HostA ~]# rpm -qa | grep rhn-setup
rhn-setup-0.4.20-86.el5
[root@HostA ~]# which rhnreg_ks
/usr/sbin/rhnreg_ks

[root@HostA ~]# uname -a
Linux HostA 2.6.18-348.6.1.el5 #1 SMP Fri Apr 26 09:21:26 EDT 2013 x86_64 x86_64 x86_64 GNU/Linux
[root@HostA ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5.9 (Tikanga)

ansible --version
ansible 1.3

I guess folks who writemodules must be informed that RHEL5 requires full path to any binary, otherwise it cannot find it, for some reason.

Thanks
Edgars

And one more thing:

This module is also incompatible with Python 2.4.3 (which is shipped with RHEL5.9). In particular line 184:

return url.netloc.replace(‘xmlrpc.’,‘’)

Python 2.4.3 does not support tuple attributes.

Here is the example on system with Python 2.4.3:

url = urlparse.urlparse(‘https://xmlrpc.rhn.redhat.com/XMLRPC’)
print url
(‘https’, ‘xmlrpc.rhn.redhat.com’, ‘/XMLRPC’, ‘’, ‘’, ‘’)
print url.netloc.replace(‘xmlrpc.’,‘’)
Traceback (most recent call last):
File “”, line 1, in ?
AttributeError: ‘tuple’ object has no attribute ‘netloc’

And here is the same example on system with Python 2.7.3

url=urlparse.urlparse(‘https://xmlrpc.rhn.redhat.com/XMLRPC’)
print url
ParseResult(scheme=‘https’, netloc=‘xmlrpc.rhn.redhat.com’, path=‘/XMLRPC’, params=‘’, query=‘’, fragment=‘’)
print url.netloc.replace(‘xmlrpc.’,‘’)
rhn.redhat.com

Edgars

Thanks.

Is this something you would like to submit a pull request for?

If not, please file a github ticket.

Created tickets.

Thanks

Edgars

In version 1.4 this is also not working.

Unfortunately “Not working” is not a helpful bug report because it doesn’t state how something is not working.

Please make sure there is a bug report that includes steps to reproduce the problem, including a sample playbook and output.

This needs to be filed on the github tracker at github.com/ansible/ansible.

Thanks!

I can reproduce it so I will report it at github.