djoos-cookbooks / newrelic

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

Cannot overwrite windows newrelic-infra agent source #373

Open jhuaMFC opened 5 years ago

jhuaMFC commented 5 years ago

I am writing a wrapper cookbook around newrelic cookbook.

def install_newrelic_infrastructure_service_windows
  windows_package 'newrelic-infra' do
    source "https://download.newrelic.com/infrastructure_agent/windows/newrelic-infra.#{new_resource.windows_version}.msi"
    installer_type :msi
    version new_resource.windows_version
    action new_resource.action
    checksum new_resource.windows_checksum
  end

  # lay down newrelic-infra agent config
  template 'C:\Program Files\New Relic\newrelic-infra\newrelic-infra.yml' do
    cookbook new_resource.template_cookbook
    source new_resource.template_source
    variables(
      :resource => new_resource
    )
    sensitive true
    notifies :restart, 'service[newrelic-infra]', :delayed
  end

  # setup newrelic-infra service
  service 'newrelic-infra' do
    action new_resource.service_actions
  end
end

It would be helpful if the source attribute can be overwritten through new_resource instead of just the version number.

djoos commented 4 years ago

I'm happy to get this change in, if done inline with eg. https://github.com/djoos-cookbooks/newrelic/blob/master/resources/agent_java.rb#L13 + https://github.com/djoos-cookbooks/newrelic/blob/master/providers/agent_java.rb#L57.

If possible, ping me a PR and I'll review it!