I am trying to write an LWRP where based on conditionals it will call methods from a helper library. I am having problem with the syntax in getting the provider to read the external method.
The provider is pretty straightforward
# providers/provider.rb
require_relative '../libraries/acx_shared'
include Acx
action :create do
Chef::Log.debug('{jefflibrary->lwrp->user} - start')
if @new_resource.shared == true
Acx::User::Shared.true_shared()
else
Acx::User::Shared.false_shared()
end
if @new_resource.sudo == true
Chef::Log.error('I HAVE THE POWER')
else
Chef::Log.error('my power is weak and feeble')
end
if @new_resource.password == true
Chef::Log.error('the secret password is 12345')
else
Chef::Log.error('I will never tell you the secret to the airlock')
end
Chef::Log.debug('{jefflibrary->lwrp->user} - end')
end
along with the helper library
#libraries/acx_shared.rb
module Acx
module User
module Shared
def true_shared
#puts blah
Chef::Log.error('I am pulling this from a library reference')
end
def false_shared
Chef::Log.error('I am not very good at sharing')
end
end
end
end
but whenever I try to run it regardless of resource attributes set, I keep getting
NoMethodError
-------------
undefined method `false_shared' for Acx::User::Shared:Module
I am clearly missing something in the documentation on writing a helper library, but I am not sure what. Tried moving a few things around but starting to run out of ideas.