在一本食谱中,我有一个库(client_helper.rb)。在其中定义了一个模块。模块名称是Client_helper。这是模块代码。
module Client_helper
# This module contains helper methods
def network_zone
Chef::Log.debug('network zone called...********')
Chef::Log.debug("inside-::::"+self.class.to_s)
end
end
Chef::Recipe.send(:include, Client_helper)
现在我有默认食谱。我从直接配方调用方法network_zone的地方它正在工作。
但是,当我在ruby_block(例如 Client_helper.network_zone)中调用方法 network_zone 时,它不起作用。
请找到食谱代码。
# Cookbook: client
# Recipe: default
Chef::Resource.send(:include, Sap_splunk_client_helper)
host_network_zone = network_zone # This is working
Log.info("inside-::::"+self.class.to_s)
ruby_block 'parse auto generated templates' do
block do
host_network_zone = Client_helper.network_zone #This is not working
Log.info("inside ruby block-::::"+self.class.to_s)
end
end
我的食谱目录结构-
请帮我。