Beispiel #1
0
def ensure_grey_item_by_name(item_name):
    grey_item = GreyItem.get_by_item_name(item_name)
    if not grey_item:
        raise GulDanException().with_code(404).with_message(
            u"找不到配置项(name:{})的灰度版本".format(item_name))

    return grey_item
Beispiel #2
0
def grey_item_delete(item_id):
    grey_item = ensure_grey_item(item_id)
    invalidate_cache_for_grey(item_id, grey_item.item_name,
                              grey_item.item_visibility)
    GreyItem.delete_by_item_id(item_id)
    Item.unset_grey(item_id)