djoos-cookbooks / newrelic

Development repository for the newrelic cookbook
https://supermarket.chef.io/cookbooks/newrelic
MIT License
143 stars 247 forks source link

Newrelic dot APM agent doesnot upgrade #363

Closed nvyas1015 closed 2 years ago

nvyas1015 commented 5 years ago

current cookbook doesnot upgrade APM agent. def install_newrelic windows_package 'Install New Relic .NET Agent' do source new_resource.https_download options "/qb NR_LICENSE_KEY=#{new_resource.license} INSTALLLEVEL=#{new_resource.install_level}" installer_type :msi action :install **not_if { ::File.exist?('C:\\Program Files\\New Relic\\.NET Agent') }** end

  1. if Agent is installed findout the version, and if it is not the one which recipe is trying to install, should uninstall the current version and install the updated one.
legendary-acp commented 2 years ago

Any updates on this one?

djoos commented 2 years ago

Would this be best handled in a wrapper cookbook, given the "levers" (:remove + :install) are available on the agent_dotnet resource? The alternative I could see is an additional action "upgrade" on the resource that would then bring this new behaviour in, but I'm (at the moment) more hesitant to go for that option.

Let me know what your thoughts are - thanks in advance for your feedback!

legendary-acp commented 2 years ago

By default what cookbook does is the installation part. I am looking for the upgrade action. Why are you hesitant to make that change? Does it breaks something?

djoos commented 2 years ago

I was considering adding in a "update" action on the resource, which would simply push that action down to the windows_package resource. However, the windows_package resource doesn't have an update action.

Wrapping install and remove into an update on the New Relic .NET agent resource, feels to me responsibility that belongs in a wrapper cookbook, as it'll surely need some additional padding. So, right now the cookbook provides an idempotent way to install and remove, whilst an upgrade would come with additional "yak shaving" that I currently wouldn't want to add into the cookbook.

P.S. Once you have a wrapper cookbook, feel free to share (ie. reopen this issue or create a PR utilising the logic you came up with in the wrapper cookbook) and I would be happy to pick up the discussion though!