Example #1
0
 def check_object_exist(cls, context, location):
     try:
         parts = location.split('/')
         obj = parts[-1]
         container = parts[-2]
         client = create_swift_client(context)
         client.head_object(container, obj)
         return True
     except ClientException as e:
         if e.http_status == 404:
             return False
         else:
             raise exception.SwiftAuthError(tenant_id=context.tenant)
Example #2
0
 def verify_swift_auth_token(cls, context):
     try:
         client = create_swift_client(context)
         client.get_account()
     except ClientException:
         raise exception.SwiftAuthError(tenant_id=context.tenant)