예제 #1
0
 def process_request(cls, params_dict):
     response         = {}
     http_status_code = 200
     targets_uuids    = params_dict[ParameterFactory.uuid()]
     criteria         = {UUID: {"$in": targets_uuids}}
     
     records = cls._DB_CONNECTOR.find(PROBES_COLLECTION, criteria, {ID:0})
     response["deleted"] = {}
     if len(records) > 0:
         # Record records
         for record in records:
             response["deleted"][record[UUID]] = record
         
         # Delete records from database
         result = cls._DB_CONNECTOR.remove(PROBES_COLLECTION, criteria)
         
         # Delete files from disk only if removal from DB was successful
         if result and result['n'] == len(response["deleted"]):
             for _,record in response["deleted"].iteritems():
                 os.remove(record[FILEPATH])
         else:
             del response["deleted"]
             raise Exception("Error deleting records from the database: %s" % result)
     else:
         http_status_code = 404
         
     return response, http_status_code
예제 #2
0
 def parameters(cls):
     cls.uuids_param = ParameterFactory.uuid(required=False)
     parameters = [
         cls.uuids_param,
         ParameterFactory.format(),
     ]
     return parameters
예제 #3
0
 def parameters(cls):
     cls.refresh_parameter = ParameterFactory.boolean("refresh",
                                                      "Refresh available " \
                                                      "run reports.",
                                                      default_value=False)
     cls.cart_sn_parameter = ParameterFactory.cartridge_sn()
     cls.start_date = DateParameter("start",
                                    "Start date of the form YYYY_MM_DD.",
                                    allow_multiple=False,
                                    required=False)
     cls.end_date = DateParameter("end",
                                  "End date of the form YYYY_MM_DD.",
                                  allow_multiple=False,
                                  required=False)
     cls.uuid_parameter = ParameterFactory.uuid(required=False,
                                                allow_multiple=False)
     parameters = [
         cls.cart_sn_parameter,
         cls.refresh_parameter,
         cls.start_date,
         cls.end_date,
         cls.uuid_parameter,
         ParameterFactory.format(),
     ]
     return parameters
예제 #4
0
    def parameters(cls):
        cls.tags_parameter = ParameterFactory.tags("Run report tags.")
        cls.report_uuid_parameter = ParameterFactory.uuid(allow_multiple=False)

        parameters = [
            cls.tags_parameter,
            cls.report_uuid_parameter,
            ParameterFactory.format(),
        ]
        return parameters
예제 #5
0
    def parameters(cls):
        cls.dataset_parameter = ParameterFactory.pa_data_source()
        cls.report_uuid_parameter = ParameterFactory.uuid(allow_multiple=False)

        parameters = [
            cls.dataset_parameter,
            cls.report_uuid_parameter,
            ParameterFactory.format(),
        ]
        return parameters
예제 #6
0
    def parameters(cls):
        cls.filenames_parameter = ParameterFactory.filenames()
        cls.report_uuid_parameter = ParameterFactory.uuid(allow_multiple=False)

        parameters = [
            cls.filenames_parameter,
            cls.report_uuid_parameter,
            ParameterFactory.format(),
        ]
        return parameters
예제 #7
0
 def parameters(cls):
     parameters = [
                   ParameterFactory.uuid(),
                  ]
     return parameters