Skip to content

Instantly share code, notes, and snippets.

Created September 12, 2013 23:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/71c0527841d30b80424b to your computer and use it in GitHub Desktop.
Save anonymous/71c0527841d30b80424b to your computer and use it in GitHub Desktop.
the description for this gist
In [1]: from katello.client import server
In [2]: from katello.client.server import BasicAuthentication
In [3]: from katello.client.api.organization import OrganizationAPI
In [4]: from katello.client.api.system_group import SystemGroupAPI
In [5]: organization_api = OrganizationAPI()
In [6]: katello_server = server.KatelloServer(host='qetello01.usersys.redhat.com', path_prefix='/katello/', port=443)
In [7]: katello_server.set_auth_method(BasicAuthentication(username='admin', password='admin'))
In [8]: server.set_active_server(katello_server)
In [9]: org = organization_api.organization('ACME_Corporation')
In [10]: org
Out[10]:
{u'apply_info_task_id': None,
u'created_at': u'2013-09-12T20:15:06Z',
u'default_info': {u'distributor': [], u'system': []},
u'deletion_task_id': None,
u'description': u'ACME_Corporation Organization',
u'id': 1,
u'label': u'ACME_Corporation',
u'name': u'ACME_Corporation',
u'owner_auto_attach_all_systems_task_id': None,
u'service_level': None,
u'service_levels': [],
u'updated_at': u'2013-09-12T20:15:06Z'}
In [11]: new_org = organization_api.create(name='New Org', label='new-org', description='Created via API')
In [12]: new_org
Out[12]:
{u'apply_info_task_id': None,
u'created_at': u'2013-09-12T21:48:55Z',
u'default_info': {u'distributor': [], u'system': []},
u'deletion_task_id': None,
u'description': u'Created via API',
u'id': 283,
u'label': u'new-org',
u'name': u'New Org',
u'owner_auto_attach_all_systems_task_id': None,
u'service_level': None,
u'service_levels': [],
u'updated_at': u'2013-09-12T21:48:55Z'}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment