def parse_auth_response(self, auth_response):
        """Parse the auth response and return the tenant, token, and username.

        :param auth_response: the full object returned from an auth call
        :returns: ``dict``
        """

        auth_dict = dict()
        auth_response = auth_response.json()
        LOG.debug('Authentication Response Body [ %s ]', auth_response)

        access = auth_response.get('access')
        access_token = access.get('token')
        access_tenant = access_token.get('tenant')
        access_user = access.get('user')

        auth_dict['os_token'] = access_token.get('id')
        auth_dict['os_tenant'] = access_tenant.get('name')
        auth_dict['os_user'] = access_user.get('name')

        if not auth_dict['os_token']:
            raise exceptions.AuthenticationProblem(
                'When attempting to grab the tenant or user nothing was'
                ' found. No Token Found to Parse. Here is the DATA: [ %s ]'
                ' Stack Trace [ %s ]',
                auth_response,
                traceback.format_exc()
            )

        region = self.job_args.get('os_region')
        print(region)
        if not region:
            raise exceptions.SystemProblem('No Region Set')

        service_catalog = access.pop('serviceCatalog')

        # Get the storage URL
        object_endpoints = self._service_endpoints(
            service_catalog=service_catalog,
            types_list=turbolift.__srv_types__
        )

        # In the legacy internal flag is set override the os_endpoint_type
        #  TODO(cloudnull) Remove this in future releases
        if 'internal' in self.job_args and self.job_args['internal']:
            LOG.warn(
                'The use of the ``--internal`` flag has been deprecated and'
                ' will be removed in future releases. Please use the'
                ' ``--os-endpoint-type`` flag and set the type name'
                ' instead. In the case of using snet (service net) this is'
                ' generally noted as "internalURL". Example setting:'
                ' ``--os-endpoint-type internalURL``'
            )
            self.job_args['os_endpoint_type'] = 'internalURL'

        auth_dict['storage_url'] = get_service_url(
            region=region,
            endpoint_list=object_endpoints,
            lookup=self.job_args['os_endpoint_type']
        )

        # Get the CDN URL
        cdn_endpoints = self._service_endpoints(
            service_catalog=service_catalog, types_list=turbolift.__cdn_types__
        )

        if cdn_endpoints:
            auth_dict['cdn_storage_url'] = get_service_url(
                region=region,
                endpoint_list=cdn_endpoints,
                lookup=self.job_args['cdn_endpoint_type']
            )

        return auth_dict
def parse_auth_response ( self , auth_response ) : auth_dict = dict ( ) auth_response = auth_response . json ( ) LOG . debug ( 'Authentication Response Body [ %s ]' , auth_response ) access = auth_response . get ( 'access' ) access_token = access . get ( 'token' ) access_tenant = access_token . get ( 'tenant' ) access_user = access . get ( 'user' ) auth_dict [ 'os_token' ] = access_token . get ( 'id' ) auth_dict [ 'os_tenant' ] = access_tenant . get ( 'name' ) auth_dict [ 'os_user' ] = access_user . get ( 'name' ) if not auth_dict [ 'os_token' ] : raise exceptions . AuthenticationProblem ( 'When attempting to grab the tenant or user nothing was' ' found. No Token Found to Parse. Here is the DATA: [ %s ]' ' Stack Trace [ %s ]' , auth_response , traceback . format_exc ( ) ) region = self . job_args . get ( 'os_region' ) print ( region ) if not region : raise exceptions . SystemProblem ( 'No Region Set' ) service_catalog = access . pop ( 'serviceCatalog' ) object_endpoints = self . _service_endpoints ( service_catalog = service_catalog , types_list = turbolift . __srv_types__ ) if 'internal' in self . job_args and self . job_args [ 'internal' ] : LOG . warn ( 'The use of the ``--internal`` flag has been deprecated and' ' will be removed in future releases. Please use the' ' ``--os-endpoint-type`` flag and set the type name' ' instead. In the case of using snet (service net) this is' ' generally noted as "internalURL". Example setting:' ' ``--os-endpoint-type internalURL``' ) self . job_args [ 'os_endpoint_type' ] = 'internalURL' auth_dict [ 'storage_url' ] = get_service_url ( region = region , endpoint_list = object_endpoints , lookup = self . job_args [ 'os_endpoint_type' ] ) cdn_endpoints = self . _service_endpoints ( service_catalog = service_catalog , types_list = turbolift . __cdn_types__ ) if cdn_endpoints : auth_dict [ 'cdn_storage_url' ] = get_service_url ( region = region , endpoint_list = cdn_endpoints , lookup = self . job_args [ 'cdn_endpoint_type' ] ) return auth_dict
Parse the auth response and return the tenant, token, and username.

        :param auth_response: the full object returned from an auth call
        :returns: ``dict``