Beispiel #1
0
def get_project_name():
    """Returns the current openshift project

    Returns:
        str: name of openshift project
    """
    return oc.get_project_name()
 def __init__(self, ocp_provider_ref, *args, **kwargs):
     threescale_api.client.ThreeScaleClient.__init__(self, *args, **kwargs)
     self._ocp_provider_ref = ocp_provider_ref
     self._ocp_namespace = ocp.get_project_name()
     self._services = resources.Services(crd_client=self,
                                         instance_klass=resources.Service)
     self._active_docs = resources.ActiveDocs(
         crd_client=self, instance_klass=resources.ActiveDoc)
     self._policy_registry = resources.PoliciesRegistry(
         self, instance_klass=resources.PolicyRegistry)
     self._backends = resources.Backends(crd_client=self,
                                         instance_klass=resources.Backend)
Beispiel #3
0
#!/usr/bin/env python

import openshift as oc

if __name__ == '__main__':
    with oc.tracking() as tracker:
        try:
            print('Current project: {}'.format(oc.get_project_name()))
            print('Current user: {}'.format(oc.whoami()))
        except:
            print('Error acquire details about project/user')

        # Print out details about the invocations made within this context.
        print tracker.get_result()