[Freeipa-users] Export user and host list to a csv or text file

Bret Wortman bret.wortman at damascusgrp.com
Fri May 23 12:02:04 UTC 2014


Is the Python API documented anywhere? I've looked around without success.

On 05/23/2014 07:54 AM, Martin Kosek wrote:
> On 05/23/2014 06:42 AM, Sanju A wrote:
>> Dear All,
>>
>> Is there any command to export the user and host list to a csv or text format
> There is no such command out of the shelf, I would personally just write a
> short Python script to export the hosts (or anything else) in a format I need.
>
> Example for host:
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> #!/usr/bin/python2
>
> from ipalib import api
> api.bootstrap(context='exporter', debug=False)
> api.finalize()
> api.Backend.xmlclient.connect()
>
> hosts = api.Command['host_find']()['result']
>
> for host in hosts:
>     print host['fqdn'][0]
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> This will print one host for each new line.
>
> Martin
>
> _______________________________________________
> Freeipa-users mailing list
> Freeipa-users at redhat.com
> https://www.redhat.com/mailman/listinfo/freeipa-users


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3766 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://listman.redhat.com/archives/freeipa-users/attachments/20140523/e86fa232/attachment.p7s>


More information about the Freeipa-users mailing list