def take_action(self, parsed_args):
     jobs = parsed_args.job_id
     kingbird_client = self.app.client_manager.sync_engine
     for job in jobs:
         try:
             kingbird_client.sync_manager.delete_sync_job(job)
         except Exception as e:
             print (e)
             error_msg = "Unable to delete the entries of %s" % (job)
             raise exceptions.KingbirdClientException(error_msg)
Exemple #2
0
 def take_action(self, parsed_args):
     kingbird_client = self.app.client_manager.sync_engine
     target_tenant = parsed_args.tenant
     try:
         kingbird_client.quota_manager.sync_quota(target_tenant)
         print("Request to sync quota for tenant %s has been triggered." %
               (parsed_args.tenant))
     except Exception as e:
         print(e)
         error_msg = "Unable to sync quota for tenant %s." \
                     % (parsed_args.tenant)
         raise exceptions.KingbirdClientException(error_msg)
Exemple #3
0
    def take_action(self, parsed_args):
        kingbird_client = self.app.client_manager.sync_engine
        quota_class = parsed_args.quota_class
        try:
            kingbird_client.quota_class_manager.\
                delete_quota_class(quota_class)
            print("Request to delete %s quota_class has been accepted." %
                  (parsed_args.quota_class))
        except Exception as e:
            print(e)

            error_msg = "Unable to delete the specified quota_class."
            raise exceptions.KingbirdClientException(error_msg)
Exemple #4
0
 def take_action(self, parsed_args):
     kingbird_client = self.app.client_manager.sync_engine
     target_tenant = parsed_args.tenant
     try:
         kingbird_client.quota_manager.\
             delete_quota(target_tenant)
         print("Request to delete quotas"
               " for tenant %s has been accepted." %
               (parsed_args.tenant))
     except Exception as e:
         print(e)
         error_msg = "Unable to delete quota for specified resource."
         raise exceptions.KingbirdClientException(error_msg)
def do_action_on_many(action, resources, success_msg, error_msg):
    """Helper to run an action on many resources."""
    failure_flag = False

    for resource in resources:
        try:
            action(resource)
            print(success_msg % resource)
        except Exception as e:
            failure_flag = True
            print(e)

    if failure_flag:
        raise exceptions.KingbirdClientException(error_msg)