I had a problem using the search method in the library code: libraries /helpers.rb
Bcpc
Helper
extend self
def help(node=node)
search(:node, "....")
end
end
end
Chef::Recipe.send(:include, Bcpc::Helper)
Chef :: Resource.send (: include, Bcpc :: Helper) for recipes using modular methods.
Then use this module method in recipes, for example: BCPC :: Helper.help (node) When I run it, it reports an error that the search method is not defined in Bcpc :: Helper: Module
I found that the search method is defined in the Chef :: Search :: Query class. Then I tried to use the full search name in my library code, for example: Chef :: Search :: Query.search (: node, "...."). But he said that the search is undefined in Chef :: Search :: Query. Should this search method be a static method that can be called with its class name?
How can I use Chef provided that the search method in my library code is in this case? Thank!
source
share