I need help in resolving the issue with below chef recipe:
application = "edge-api"
remote_file "/usr/local/edge-api/#{application}-#{application_version}.jar" do
source "#{node.default["thecloud"]["repo_url"]}/#{application}/#{application}-#{application_version}.jar"
mode "0644"
checksum application_sha256
notifies :stop, "service[edge-api]", :delayed
notifies :start, "service[edge-api]", :delayed
end
I get this error:
> FATAL: Chef::Exceptions::ResourceNotFound: resource remote_file[/usr/local/edge-api/edge-api-0.1.9.jar] is configured to notify resource service[edge-api] with action stop, but service[edge-api] cannot be found in the resource collection. remote_file[/usr/local/edge-api/edge-api-0.1.9.jar] is defined in /var/chef/cache/cookbooks/edge-api/recipes/default.rb:40:in `from_file'
I am beginner in chef and trying to modify the above recipe. The requirement is to convert upstart to systemd as we are migrating from centos 6 to 7
2
Answers
Also below is the full recipe, please review and let me know what is missing.
The error is complaining about a missing resource declaration. In the question you have shown 1 resource which will cause the service "edge-api" to stop and start when the
remote_file
(jar file) changes. From the error it appears that you don’t have a declaration for the service.In that case, the below addition should help.