如何在 Chef 中访问 run_list 的所有食谱?
How to access all recipes of run_list in chef?
我正在编写一个 HWRP,我需要访问将在客户端-运行 期间聚合的所有配方。
我正在使用 node.run_list.recipe_names 来访问它。但似乎不包括通过角色设置的食谱。
For example, I have a node with run_list
role[role1] that has cookbook1::recipe2
role[role2] that has cookbook2::recipe1
cookbook3::recipe1
cookbook4::default
如果我用node.run_list.recipe_names它returns我
cookbook3::recipe1
cookbook4::default
node.run_list._to_s returns
"role[role1],
role[role2],
recipe[cookbook3::recipe1],
recipe[cookbook4::default].
角色未展开。
我怎样才能创建一个只有 将要收敛的配方的变量?
喜欢
"recipe[cookbook1:recipe2],
recipe[cookbook2:recipe1],
recipe[cookbook3::recipe1],
recipe[cookbook4::default]"
你要的是node['recipes']
。但请记住,这不是一个完美的列表,通过 include_recipe
的任何 运行 只会在包含发生后显示在那里。
我正在编写一个 HWRP,我需要访问将在客户端-运行 期间聚合的所有配方。 我正在使用 node.run_list.recipe_names 来访问它。但似乎不包括通过角色设置的食谱。
For example, I have a node with run_list
role[role1] that has cookbook1::recipe2
role[role2] that has cookbook2::recipe1
cookbook3::recipe1
cookbook4::default
如果我用node.run_list.recipe_names它returns我
cookbook3::recipe1
cookbook4::default
node.run_list._to_s returns
"role[role1],
role[role2],
recipe[cookbook3::recipe1],
recipe[cookbook4::default].
角色未展开。 我怎样才能创建一个只有 将要收敛的配方的变量? 喜欢
"recipe[cookbook1:recipe2],
recipe[cookbook2:recipe1],
recipe[cookbook3::recipe1],
recipe[cookbook4::default]"
你要的是node['recipes']
。但请记住,这不是一个完美的列表,通过 include_recipe
的任何 运行 只会在包含发生后显示在那里。