# rhn\_register module does not work on RHEL5 hosts

**URL:** <https://forum.ansible.com/t/rhn-register-module-does-not-work-on-rhel5-hosts/12954>\
**Category:** Ansible Project\
**Created:** [June 13, 2013, 8:06am UTC](https://forum.ansible.com/t/rhn-register-module-does-not-work-on-rhel5-hosts/12954 "2013-06-13T08:06:20Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Edgars](https://avatars.discourse-cdn.com/v4/letter/e/f17d59/32.png) [@Edgars](https://forum.ansible.com/u/Edgars)\
**Post date:** [June 13, 2013, 8:06am UTC](https://forum.ansible.com/t/rhn-register-module-does-not-work-on-rhel5-hosts/12954/1 "2013-06-13T08:06:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Edgars](https://avatars.discourse-cdn.com/v4/letter/e/f17d59/32.png) [@Edgars](https://forum.ansible.com/u/Edgars)\
**Post date:** [June 13, 2013, 9:50am UTC](https://forum.ansible.com/t/rhn-register-module-does-not-work-on-rhel5-hosts/12954/2 "2013-06-13T09:50:19Z")

</div>

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](https://xmlrpc.rhn.redhat.com/XMLRPC)’)  
> > > > print url  
> > > > (‘https’, ‘[xmlrpc.rhn.redhat.com](http://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](https://xmlrpc.rhn.redhat.com/XMLRPC)’)  
> > > > print url  
> > > > ParseResult(scheme=‘https’, netloc=‘[xmlrpc.rhn.redhat.com](http://xmlrpc.rhn.redhat.com)’, path=‘/XMLRPC’, params=‘’, query=‘’, fragment=‘’)  
> > > > print url.netloc.replace(‘xmlrpc.’,‘’)  
> > > > [rhn.redhat.com](http://rhn.redhat.com)

Edgars

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [June 13, 2013, 11:10am UTC](https://forum.ansible.com/t/rhn-register-module-does-not-work-on-rhel5-hosts/12954/3 "2013-06-13T11:10:30Z")

</div>

Thanks.

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

If not, please file a github ticket.

---

<div class="post-metadata">

**Author:** ![Edgars](https://avatars.discourse-cdn.com/v4/letter/e/f17d59/32.png) [@Edgars](https://forum.ansible.com/u/Edgars)\
**Post date:** [June 13, 2013, 11:42am UTC](https://forum.ansible.com/t/rhn-register-module-does-not-work-on-rhel5-hosts/12954/4 "2013-06-13T11:42:23Z")

</div>

Created tickets.

Thanks

Edgars

---

<div class="post-metadata">

**Author:** ![Jurrien\_Bloemen](https://avatars.discourse-cdn.com/v4/letter/j/bc79bd/32.png) [@Jurrien\_Bloemen](https://forum.ansible.com/u/Jurrien_Bloemen)\
**Post date:** [October 14, 2013, 9:45am UTC](https://forum.ansible.com/t/rhn-register-module-does-not-work-on-rhel5-hosts/12954/5 "2013-10-14T09:45:19Z")

</div>

In version 1.4 this is also not working.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [October 14, 2013, 12:32pm UTC](https://forum.ansible.com/t/rhn-register-module-does-not-work-on-rhel5-hosts/12954/6 "2013-10-14T12:32:49Z")

</div>

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](http://github.com/ansible/ansible).

Thanks!

---

<div class="post-metadata">

**Author:** ![Jurrien\_Bloemen](https://avatars.discourse-cdn.com/v4/letter/j/bc79bd/32.png) [@Jurrien\_Bloemen](https://forum.ansible.com/u/Jurrien_Bloemen)\
**Post date:** [October 14, 2013, 12:35pm UTC](https://forum.ansible.com/t/rhn-register-module-does-not-work-on-rhel5-hosts/12954/7 "2013-10-14T12:35:45Z")

</div>

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