I am trying to test creation of my own LWRP. I keep getting the following error message, even though I have tried specifying my default_action in three different ways.
Error Message: FC016: LWRP does not declare a default action: mycookbook/resources/eapi_deploy.rb:1
First Try
actions :deploy, :undeploy, :debug
default_action :debug
Second Try
default_action :debug
actions :deploy, :undeploy, :debug
Third Try
actions :deploy, :undeploy, :debug
def initialize(*args)
super
@action = :debug
end
According to the LWRP Chef docs, your first try looks correct. I used Berkshelf to create a new cookbook (
berks cookbook mycookbook
), and created resources/test.rb and pasted in:And I don't get a foodcritic error. Do you happen to have more than resource defined? Are you sure the foodcritic warning is pointing to the resource you're showing us?
For what it's worth, I then removed the
default_action
line, and re-ran foodcritic, and I get FC016 like you do.