[RESOLVED] Using library functions in a recipe


#1

Hi,

I have started from a recipe created from chef generate with nothing in it. I created libraries/test_library.rb with the following:

module Test
   def configure_test()
    ...
  end
end

In my default.rb recipe, I have tried to access the method by configure_test(), Test.configure_test() and Test::configure_test() but they all result in NoMethodError. I loosely built my library from the instructions here: https://www.sethvargo.com/using-gems-with-chef/. How can I reference the module and its method from my recipe?

Thanks


#2

Include the libary in the recipe.
The following blog post has an example


#3

Thanks! I had tried include without success, Chef::Recipe.send() worked.