Hi Andrew and Jens,

 

I’ve been using python-freeipa

 

https://github.com/opennode/python-freeipa

https://pypi.python.org/pypi/python-freeipa/0.1.2

 

So…

 

from python_freeipa import Client

from configuration import config, args # a thing that processes args and 
configparser config

 

client = Client(

    config['freeipa']['server'],

    version=config['freeipa']['version'],

    verify_ssl=false

)

client.login(

    config['freeipa']['user'],

    config['freeipa']['password']

)

client.user_find(‘username’)

 

 

I use some basic wrapper functions around the methods though:

 

def ipa_user_mod(uid, **kwargs):

    if config['freeipa'].getboolean('enabled') is True:

        if args.dry_run is not True:

            client.user_mod(uid, **kwargs)

        else:

            logger.info("Dry-run, last user update(s) skipped")

        return True

    else:

        logger.info(‘freeIPA disabled')

        return None

 

 

def ipa_group_mod(uid, **kwargs):

    if config['freeipa'].getboolean('enabled') is True:

        if args.dry_run is not True:

            client.group_mod(uid, **kwargs)

        else:

            logger.info("Dry-run, last group update(s) skipped")

        return True

    else:

        logger.info(‘freeIPA disabled')

        return None

 

My group and user add functions are more complicated and contain duplicate 
tests etc.

 

 

 

From: Andrew Meyer via FreeIPA-users 
[mailto:freeipa-users@lists.fedorahosted.org] 
Sent: Friday, 22 December 2017 5:50 AM
To: FreeIPA users list <freeipa-users@lists.fedorahosted.org>
Cc: Jens Timmerman <jens.timmer...@ugent.be>; Andrew Meyer 
<andrewm...@yahoo.com>
Subject: [Freeipa-users] Re: api scripts

 

Thank you

 

On Thursday, December 21, 2017 4:31 AM, Jens Timmerman via FreeIPA-users 
<freeipa-users@lists.fedorahosted.org 
<mailto:freeipa-users@lists.fedorahosted.org> > wrote:

 

Hi Andrew,

On 20/12/2017 22:42, Andrew Meyer via FreeIPA-users wrote:
> Does anyone have any examples or could share what they have written?
>
> I am trying to write a script and not sure what components I need. 
I've been working on a python client for a bit. It will probably be made
public when I'm done.
But at the moment I'm just adding methods as I need them.
You can find what I'm allowed to share at the moment at
https://gist.github.com/JensTimmerman/c123d5f6291e4cd542473241ce7bf4c9

feedback greatly appreciated.

Regards,
Jens Timmerman
>
>
> _______________________________________________
> FreeIPA-users mailing list -- freeipa-users@lists.fedorahosted.org 
> <mailto:freeipa-users@lists.fedorahosted.org> 
> To unsubscribe send an email to freeipa-users-le...@lists.fedorahosted.org 
> <mailto:freeipa-users-le...@lists.fedorahosted.org> 




_______________________________________________
FreeIPA-users mailing list -- freeipa-users@lists.fedorahosted.org 
<mailto:freeipa-users@lists.fedorahosted.org> 
To unsubscribe send an email to freeipa-users-le...@lists.fedorahosted.org 
<mailto:freeipa-users-le...@lists.fedorahosted.org> 

 

_______________________________________________
FreeIPA-users mailing list -- freeipa-users@lists.fedorahosted.org
To unsubscribe send an email to freeipa-users-le...@lists.fedorahosted.org

Reply via email to