def authenticate_user(self): if not (self.options.os_auth_token and self.options.ripcord_url): if not self.options.os_username: raise exception.CommandError( 'You must provide a username via either --os-username or ' 'env[OS_USERNAME]') if not self.options.os_password: raise exception.CommandError( 'You must provide a password via either --os-password or ' 'env[OS_PASSWORD]') if not (self.options.os_tenant_id or self.options.os_tenant_name): raise exception.CommandError( 'You must provide a tenant_id via either --os-tenant-id ' 'or env[OS_TENANT_ID]') if not self.options.os_auth_url: raise exception.CommandError( 'You must provide an auth url via either --os-auth-url or ' 'env[OS_AUTH_URL]') self.client_manager = client.get_client( self.api_version, **(self.options.__dict__)) return
def client(request): return get_client( 1, ripcord_url=base.url_for(request, 'sip'), os_auth_token=request.user.token.id, )