def _process_status_update(self, repo, object_name, record, delete_record=False): # Zero it out so that if the ID is missing from a record we do not # report the last LB as the failed record in the exception record_id = None try: record_id = record['id'] record_kwargs = {} prov_status = record.get(consts.PROVISIONING_STATUS, None) if prov_status: if prov_status == consts.DELETED and delete_record: repo.delete(self.db_session, id=record_id) return else: record_kwargs[consts.PROVISIONING_STATUS] = prov_status op_status = record.get(consts.OPERATING_STATUS, None) if op_status: record_kwargs[consts.OPERATING_STATUS] = op_status if prov_status or op_status: repo.update(self.db_session, record_id, **record_kwargs) except Exception as e: # We need to raise a failure here to notify the driver it is # sending bad status data. raise driver_exceptions.UpdateStatusError( fault_string=str(e), status_object_id=record_id, status_object=object_name)
def _process_status_update(self, repo, object_name, record, delete_record=False): # Zero it out so that if the ID is missing from a record we do not # report the last LB as the failed record in the exception record_id = None try: record_id = record['id'] record_kwargs = {} prov_status = record.get(consts.PROVISIONING_STATUS, None) if prov_status: if (prov_status == consts.DELETED and object_name == consts.LOADBALANCERS): self._check_for_lb_vip_deallocate(repo, record_id) elif prov_status == consts.DELETED and delete_record: repo.delete(self.db_session, id=record_id) return record_kwargs[consts.PROVISIONING_STATUS] = prov_status op_status = record.get(consts.OPERATING_STATUS, None) if op_status: record_kwargs[consts.OPERATING_STATUS] = op_status if prov_status or op_status: repo.update(self.db_session, record_id, **record_kwargs) except Exception as e: # We need to raise a failure here to notify the driver it is # sending bad status data. raise driver_exceptions.UpdateStatusError( fault_string=str(e), status_object_id=record_id, status_object=object_name)