Closed martinb3 closed 9 years ago
Hi @martinb3,
as the template can handle a nil app_name, I actually wondered why it has to be set to the node['hostname']; there doesn't seem to be any reason for it, so I've taken that logic out. If someone wants app_name to be node['hostname'], they can set it on the LWRP or set the attribute when using the java_agent-recipe...
Hope this helps!
Kind regards, David
Hi, I am getting the same error. My environment info is listed below: Centos 7.4 Chef Development Kit Version: 2.4.17 chef-client version: 13.6.4 delivery version: master (73ebb72a6c42b3d2ff5370c476be800fee7e5427) berks version: 6.3.1 kitchen version: 1.19.2 inspec version: 1.45.13
I used berks and I am running the java_agent with the following command: sudo chef-client --local-mode --runlist 'recipe[newrelic::java_agent]'
[2018-02-12T20:06:41+00:00] INFO: Running queued delayed notifications before re-raising exception
================================================================================
Error executing action `install` on resource 'newrelic_agent_java[Install]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
execute[newrelic_install_newrelic.jar] (/home/centos/.chef/local-mode-cache/cache/cookbooks/newrelic/providers/agent_java.rb line 110) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of sudo java -jar newrelic.jar -s /opt/newrelic/java install ----
STDOUT:
STDERR: sudo: sorry, you must have a tty to run sudo
---- End output of sudo java -jar newrelic.jar -s /opt/newrelic/java install ----
Ran sudo java -jar newrelic.jar -s /opt/newrelic/java install returned 1
Resource Declaration:
---------------------
# In /home/centos/.chef/local-mode-cache/cache/cookbooks/newrelic/recipes/java_agent.rb
8: newrelic_agent_java 'Install' do
9: license NewRelic.application_monitoring_license(node)
Hi @murashid786,
the error flagged in this thread (NoMethodError - undefined method
app_name=' for Chef::Resource::NewrelicAgentJava) is not the same as the error you are getting, ie.
STDERR: sudo: sorry, you must have a tty to run sudo`...
For the issue you are getting, it might be worth looking into how you are handling your sudoers in your setup.
Hope this helps! David
It appears to be illegal to set resource values during the provider execution:
agent_java.rb:66
(second line):