Reputation: 11
I have an attribute defined in cookbook as:
default[appName]['releasePackageURL'] = "https://nexus.abc.com/Test/.1/web-.8.zip"
I also have a default_attribute
under environment as below:
default_attributes": {
"wwwRoot" : "C:\\Websites",
"ABC" : {
"version" : "ABC0.0.0.1_Release",
"releasePackageURL" : "https://nexus.abc.com/Test/.1/web-.8.zip"
}
}
The value for releasePackageURL
is getting duplicated in both environment and in cookbook. How can this be avoided?
Upvotes: 0
Views: 306
Reputation: 1396
Attributes when defined stay in the respective definitions. So the attribute being present in both places cannot be avoided (since you have defined it). But when chef-client is run the attributes are evaluated for precedence https://docs.chef.io/attributes.html and the right attribute value is provided to the chef-client. In your case, the value from environment attribute will be picked up.
Upvotes: 2