add warning and reduce generate_cookbook duplication