def cachedir_index_del(minion_id, base=None):
    '''
    Delete an entry from the cachedir index. This generally only needs to happen
    when an instance is deleted.
    '''
    base = init_cachedir(base)
    index_file = os.path.join(base, 'index.p')
    lock_file(index_file)

    if os.path.exists(index_file):
        mode = 'rb' if six.PY3 else 'r'
        with salt.utils.files.fopen(index_file, mode) as fh_:
            index = salt.utils.data.decode(
                salt.utils.msgpack.load(fh_, encoding=MSGPACK_ENCODING))
    else:
        return

    if minion_id in index:
        del index[minion_id]

    mode = 'wb' if six.PY3 else 'w'
    with salt.utils.files.fopen(index_file, mode) as fh_:
        salt.utils.msgpack.dump(index, fh_, encoding=MSGPACK_ENCODING)

    unlock_file(index_file)
def cachedir_index_del ( minion_id , base = None ) : base = init_cachedir ( base ) index_file = os . path . join ( base , 'index.p' ) lock_file ( index_file ) if os . path . exists ( index_file ) : mode = 'rb' if six . PY3 else 'r' with salt . utils . files . fopen ( index_file , mode ) as fh_ : index = salt . utils . data . decode ( salt . utils . msgpack . load ( fh_ , encoding = MSGPACK_ENCODING ) ) else : return if minion_id in index : del index [ minion_id ] mode = 'wb' if six . PY3 else 'w' with salt . utils . files . fopen ( index_file , mode ) as fh_ : salt . utils . msgpack . dump ( index , fh_ , encoding = MSGPACK_ENCODING ) unlock_file ( index_file )
Delete an entry from the cachedir index. This generally only needs to happen
    when an instance is deleted.