In a cookbook I have a library(client_helper.rb). A module is defined inside it. Module name is Client_helper. Here is the module code.
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)
Now I have default recipe. Where I am calling the method network_zone from direct recipe it is working.
But when I am calling the method network_zone inside ruby_block(eg. Client_helper.network_zone) it is not working.
Please find the recipe code.
# 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
My cookbook directory structure-
Please help me.