[Spacewalk-list] Query the Org ID via APIs

Jon Miller jonebird at gmail.com
Mon Jul 22 20:13:50 UTC 2013


I would like to be able to query the org of a user that is currently
authenticated to the server via an API call. I realize that there is the
"org.listOrgs" call but that is only available for a Spacewalk
administrator. What I'm looking for is something that a regular organization
admin can use. 

I currently only know how to retrieve the org number by querying my custom
snippets. I'm hoping there is a better method that I am just not finding?

def get_org(session, client):
    # Really, really silly but I do not know how to get the Org other than the fragment
    snippets = client.kickstart.snippet.listCustom(session)
    if not snippets:
        return -1
    return re.search(r'/(\d+)/', snippets[0]['fragment']).group(1)

Thanks,
-- 
Jon Miller




More information about the Spacewalk-list mailing list