深入探索Chef格式化器与自定义订阅者
1. 自定义格式化器方法
在这个示例中,我们将扩展自定义的 Awesome 格式化器类,添加处理三个特定事件输出的方法:
- synchronized_cookbook :当食谱同步完成时调用。
- resource_up_to_date :当资源已是最新状态(即完全收敛)时调用。
- resource_updated :当资源已更新(即之前未收敛)时调用。
所有格式化器都是 EventDispatch::Base 类的子类,该类为Chef运行期间可能发生的每个事件定义了特定方法。我们需要重写 EventDispatch::Base 中的这些方法,以实现自定义输出。以下是 EventDispatch::Base 中我们要重写的方法:
class Chef
module EventDispatch
class Base
# Other methods removed
# Called when cookbook, cookbook_name, has been synced
def synchronized_cookbook(cookbook_name)
end
# Called when a resource has no converge actions (i.e., was
超级会员免费看
订阅专栏 解锁全文
10

被折叠的 条评论
为什么被折叠?



