Search code examples
chef-infrachef-recipeoctopus-deploy

How can I override an attribute value that is specified in a Chef library file of a community cookbook


I am trying to figure out how to override an attribute using a wrapper cookbook without changing a community cookbook directly.

In this case, it is the Octopus-Deploy cookbook.

There is a server.rb library that uses a container to specify attributes. I need to override the installer_url attribute as my servers will not have access to the internet and I need to point them to a local install file.

def installer_url(version)
  "https://download.octopusdeploy.com/octopus/Octopus.#{version}-x64.msi"
end

I need to override this value to be something like:

"file:///c:/temp/octopus_server_install.#{version}-x64.msi"

Can this be achieved by somehow wrapping the community cookbook?

The attribute is referenced in the provider by calling the method in the library

include OctopusDeploy::Server
...
action :install do
  ...
  install_url = installer_url(new_resource.version)
  ...
end

Any help much appreciated.


Solution

  • You will have to fork the relevant code.