def _delete_swift_signal_url(self): object_name = self.data().get('swift_signal_object_name') if not object_name: return try: container_name = self.stack.id swift = self.client('swift') # delete all versions of the object, in case there are some # signals that are waiting to be handled container = swift.get_container(container_name) filtered = [obj for obj in container[1] if object_name in obj['name']] for obj in filtered: # we delete the main object every time, swift takes # care of restoring the previous version after each delete swift.delete_object(container_name, object_name) headers = swift.head_container(container_name) if int(headers['x-container-object-count']) == 0: swift.delete_container(container_name) except Exception as ex: self.client_plugin('swift').ignore_not_found(ex) self.data_delete('swift_signal_object_name') self.data_delete('swift_signal_url')
def _delete_swift_signal_url(self): object_name = self.data().get('swift_signal_object_name') if not object_name: return with self.client_plugin('swift').ignore_not_found: container_name = self.stack.id swift = self.client('swift') # delete all versions of the object, in case there are some # signals that are waiting to be handled container = swift.get_container(container_name) filtered = [obj for obj in container[1] if object_name in obj['name']] for obj in filtered: # we delete the main object every time, swift takes # care of restoring the previous version after each delete swift.delete_object(container_name, object_name) headers = swift.head_container(container_name) if int(headers['x-container-object-count']) == 0: swift.delete_container(container_name) self.data_delete('swift_signal_object_name') self.data_delete('swift_signal_url')