[Freeipa-users] DHCP plugin (don't get your hopes up)
Jeffery Harrell
sparky at charlietango.com
Wed May 11 15:17:22 UTC 2016
Thanks. It was a pretty long weekend’s work.
As for easier, I’ll be honest: I was really only able to do what I did by thoroughly reading the IPA source code. There’s some quite good documentation embedded in some of the Python source files, so the Python side was pretty easy, but I found the JavaScript side to be a real challenge. It was very trial-and-error. I still have no idea why I can’t get an attribute_table to work in place of a multivalue (see install/ui/js/freeipa/widget.js).
I think a quite important thing to pass on to others is how to debug IPA: You can use self.log.debug() calls in Python (to the pre-configured logging framework) if you invoke the ipa command as “ipa -d -e in_server=True” and that’s very helpful … but to make that work I had to install a global anyone all-permissions ACI. Otherwise I got an insufficient-access error that threw me out of the program before any LDAP create/update/delete calls could complete. Maybe I missed a command-line option or something.
On the JavaScript side, what worked best for me was to use Firebug with Firefox and make console.log() calls. I gather that you can basically do that without Firebug, but I’m not a web developer, so I went with what I knew — or rather vaguely remembered from the last time I wrote a web page, back in the 90s.
As for the rest, it really boiled down to monkey-see-monkey-do mimicry. I can’t find a range validator in the source code, so I want to write my own. Let me go grep the source to find examples of validators and see how they’re written. And so on. The hard parts were when I wanted to do things that I don’t think FreeIPA does itself, like a validator that executes an LDAP query. I had to flail my way through that one and probably did it all wrong.
I do have one concrete suggestion. You might maybe consider taking some chunk of functionality and packaging it as a separate, installable “reference plugin.” DNS might be too complex for that, considering it has its tendrils in host.js etc. Maybe automount might be a good candidate. I bring this up because a good example is the best documentation. When somebody asks “How do I write a plugin?” you can just point and say “Why, like this.”
Just a thought.
On May 11, 2016 at 4:03:04 AM, Petr Vobornik (pvoborni at redhat.com) wrote:
On 05/10/2016 09:39 PM, Jeffery Harrell wrote:
> As promised yesterday, here’s the link to my bespoke DHCP plugin. It’s really
> nothing, just a little thing I whipped up for my own use.
>
> https://github.com/jefferyharrell/IPA-dhcp
>
>
Very nice. This is probably the most complex 'external' IPA plugin I've
seen.
You must have put quite a lot of effort into making it happen. Were
there any areas in code/docs/wiki/... you encountered which you would
like to see improved in FreeIPA or maybe some obstacles removed so that
plugins like this can be made easier?
Regards
--
Petr Vobornik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/freeipa-users/attachments/20160511/a9fcd32c/attachment.htm>
More information about the Freeipa-users
mailing list