appdynamics-cookbooks icon indicating copy to clipboard operation
appdynamics-cookbooks copied to clipboard

machine_agent.rb recipe: extracting -> config change -> restart on every chef run

Open rediculum opened this issue 6 years ago • 1 comments

There are some conditions missing in the remote_file agent_zip and execute 'unzip-appdynamics-machine-agent' resource. On each chef run, the ZIP file is extracted again and the configuration file is been altered. This leads to a restart of the machine agent on every chef run.

rediculum avatar Dec 19 '18 14:12 rediculum

Add a condition to extract only if the ./bin directory is missing and the default action for the unzip task is nothing.

remote_file agent_zip do
  source package_source
  checksum agent['checksum']
  backup false
  mode '0444'
  notifies :run, 'execute[unzip-appdynamics-machine-agent]', :immediately
end unless ::File.exist?([agent['install_dir'], '/bin'].join)
...
...
execute 'unzip-appdynamics-machine-agent' do
  cwd agent['install_dir']
  command "unzip -qqo #{agent_zip}"
  action :nothing
end

rediculum avatar Dec 19 '18 14:12 rediculum