'Deletes a snapshot.'

@pure_driver_debug_trace
def delete_snapshot(self, snapshot):

    current_array = self._get_current_array()
    snap_name = self._get_snap_name(snapshot)
    try:
        current_array.destroy_volume(snap_name)
        if self.configuration.pure_eradicate_on_delete:
            current_array.eradicate_volume(snap_name)
    except purestorage.PureHTTPError as err:
        with excutils.save_and_reraise_exception() as ctxt:
            if ((err.code == 400) and ((ERR_MSG_NOT_EXIST in err.text) or (ERR_MSG_NO_SUCH_SNAPSHOT in err.text) or (ERR_MSG_PENDING_ERADICATION in err.text))):
                ctxt.reraise = False
                LOG.warning('Unable    to    delete    snapshot,    assuming    already    deleted.    Error:    %s', err.text)
