# Hacking user module for portability

**URL:** <https://forum.ansible.com/t/hacking-user-module-for-portability/12050>\
**Category:** Ansible Project\
**Created:** [October 29, 2012, 10:11pm UTC](https://forum.ansible.com/t/hacking-user-module-for-portability/12050 "2012-10-29T22:11:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nigel\_Metheringham](https://avatars.discourse-cdn.com/v4/letter/n/3ec8ea/32.png) [@Nigel\_Metheringham](https://forum.ansible.com/u/Nigel_Metheringham)\
**Post date:** [October 29, 2012, 10:11pm UTC](https://forum.ansible.com/t/hacking-user-module-for-portability/12050/1 "2012-10-29T22:11:28Z")

</div>

I've hacked around the user module specifically to add FreeBSD support,  
although the intention is to be able to add other OS support very simply  
by adding an OS flavour specific superclass.

I would appreciate if folks could have a look at this abd ideally test  
to see what I broke... bearing in mind I am neither a python nor a  
FreeBSD person (yeah - I'm wondering why I started here too).

Code is at  
&nbsp;&nbsp;[https://github.com/nigelm/ansible/tree/nigelm\_freebsd](https://github.com/nigelm/ansible/tree/nigelm_freebsd)

Only the user module has been changed, and basically its as one big  
commit (unfortunately the spacing changes caused by making most of the  
code into a class makes the changed lines look more substantial than  
they are).

Unless someone shows me real problems with this I'm aiming to send it as  
a pull request as soon as I have had a little time to convince myself  
its stable.

&nbsp;&nbsp;Nigel.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [October 29, 2012, 10:35pm UTC](https://forum.ansible.com/t/hacking-user-module-for-portability/12050/2 "2012-10-29T22:35:25Z")

</div>

In general, looks good.

If someone else would like to supply testing to this on FreeBSD, this  
would be helpful -- and I can take care of refactoring the class  
loader into something I think we want to have as a standard across  
modules (hopefully something in module common).

Thanks!

---

<div class="post-metadata">

**Author:** ![Romeo\_Theriault](https://avatars.discourse-cdn.com/v4/letter/r/839c29/32.png) [@Romeo\_Theriault](https://forum.ansible.com/u/Romeo_Theriault)\
**Post date:** [October 30, 2012, 7:16am UTC](https://forum.ansible.com/t/hacking-user-module-for-portability/12050/3 "2012-10-30T07:16:56Z")

</div>

I haven't tried it but I love the idea. It will make adding solaris  
support (and others) that much easier. Thanks much.

---

<div class="post-metadata">

**Author:** ![Nigel\_Metheringham](https://avatars.discourse-cdn.com/v4/letter/n/3ec8ea/32.png) [@Nigel\_Metheringham](https://forum.ansible.com/u/Nigel_Metheringham)\
**Post date:** [October 30, 2012, 9:15am UTC](https://forum.ansible.com/t/hacking-user-module-for-portability/12050/4 "2012-10-30T09:15:59Z")

</div>

Michael DeHaan wrote:

> If someone else would like to supply testing to this on FreeBSD, this  
> would be helpful

Absolutely. I have only tested against FreeBSD 9.0 - a fresh install,  
and even that is fairly lightly tested. The python package goes into  
/usr/local/bin so the platform requires ansible\_python\_interpreter to be  
set.

The standard part of it has been tested against Centos 6

> -- and I can take care of refactoring the class  
> loader into something I think we want to have as a standard across  
> modules (hopefully something in module common).

I added a (slightly half-arsed) distribution part to the loader - it  
seemed likely that at least one of the linuxes will need something  
different, so having a way of picking up a new module based on that  
looked useful.

I'm aiming to add some more comments around it, then I'll raise a pull  
req with you - unless you would prefer it now and I can then decorate it  
after merging. Not sure how much time I have in the next few days so  
there may be a pause.

&nbsp;&nbsp;Nigel.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [October 30, 2012, 12:03pm UTC](https://forum.ansible.com/t/hacking-user-module-for-portability/12050/5 "2012-10-30T12:03:12Z")

</div>

You can go ahead and send it over. I may hack around with it some in  
the next few days.

Glad to see this, it can help set a standard for the other modules.

---

<div class="post-metadata">

**Author:** ![Nigel\_Metheringham](https://avatars.discourse-cdn.com/v4/letter/n/3ec8ea/32.png) [@Nigel\_Metheringham](https://forum.ansible.com/u/Nigel_Metheringham)\
**Post date:** [October 30, 2012, 12:10pm UTC](https://forum.ansible.com/t/hacking-user-module-for-portability/12050/6 "2012-10-30T12:10:55Z")

</div>

Pull request 1483 raised.

Its been an interesting learning experience - not done serious python  
previously.

Feel free to bat bugs back across to me - there are quite likely to be  
some (mostly of the leaving () off method names - I mostly write perl,  
these brackets are all optional!).

&nbsp;&nbsp;Nigel.
