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@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-users


Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
Freeipa-users mailing list
Freeipa-users@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-users

Reply via email to