Chef infra 厨师倒带:发布上游配方的倒带部分(ceph::mon)
我正试图从我的包装食谱中的上游食谱(ceph)中解开厨师食谱的一部分。简而言之,ceph用户池创建块在部署中执行得太早,在某些必需的服务启动和运行之前。我将它转移到一个新的包装器配方中,当服务运行时,它将在运行列表的下一步执行 为此,我尝试从ceph::mon上游配方中倒回下面的块,然后在我的新包装器配方中的稍后点执行它。我的代码目前如下:Chef infra 厨师倒带:发布上游配方的倒带部分(ceph::mon),chef-infra,chef-recipe,rewind,Chef Infra,Chef Recipe,Rewind,我正试图从我的包装食谱中的上游食谱(ceph)中解开厨师食谱的一部分。简而言之,ceph用户池创建块在部署中执行得太早,在某些必需的服务启动和运行之前。我将它转移到一个新的包装器配方中,当服务运行时,它将在运行列表的下一步执行 为此,我尝试从ceph::mon上游配方中倒回下面的块,然后在我的新包装器配方中的稍后点执行它。我的代码目前如下: include_recipe 'workday::chef-client' require 'chef/rewind' include_recipe 'ce
include_recipe 'workday::chef-client'
require 'chef/rewind'
include_recipe 'ceph::mon'
if node['ceph']['user_pools']
# Create user-defined pools
node['ceph']['user_pools'].each do |pool|
ceph_pool pool['name'] do
unwind "pool"
pg_num pool['pg_num']
create_options pool['create_options'] if pool['create_options']
end
end
end
if node['ceph']['user_pools']
# Create user-defined pools
node['ceph']['user_pools'].each do |pool|
# unwind user-defined pools
unwind "ceph_pool[#{pool['name']}]"
end
end
来自chef客户端的错误输出:
NoMethodError
-------------
undefined method `unwind' for Chef::Resource::CephPool
我尝试过各种放松语句:
e、 g
我以前在资源(例如“执行x”)上使用过展开/回放,但我不确定如何正确展开。我已经阅读了chef rewind提供的有限文档,但我找不到解决方案。我已经解决了这个问题,并将分享我的解决方案,以防将来有人遇到类似问题。正确的工作解决方案如下:
include_recipe 'workday::chef-client'
require 'chef/rewind'
include_recipe 'ceph::mon'
if node['ceph']['user_pools']
# Create user-defined pools
node['ceph']['user_pools'].each do |pool|
ceph_pool pool['name'] do
unwind "pool"
pg_num pool['pg_num']
create_options pool['create_options'] if pool['create_options']
end
end
end
if node['ceph']['user_pools']
# Create user-defined pools
node['ceph']['user_pools'].each do |pool|
# unwind user-defined pools
unwind "ceph_pool[#{pool['name']}]"
end
end
它最初失败是因为我没有正确插入“展开”属性:
i、 e.我错误地使用了unwind“ceph\u pool['name']”
而不是正确插入的形式:unwind“ceph\u pool[{pool['name']}]”
我希望这个答案对其他可能遇到类似问题的人有所帮助