我在cookbook中有一个属性定义为:
default[appName]['releasePackageURL'] = "https://nexus.abc.com/Test/.1/web-.8.zip"我在环境下也有一个default_attribute,如下所示:
default_attributes": {
"wwwRoot" : "C:\\Websites",
"ABC" : {
"version" : "ABC0.0.0.1_Release",
"releasePackageURL" : "https://nexus.abc.com/Test/.1/web-.8.zip"
}
} releasePackageURL的值在环境和食谱中都是重复的。如何才能避免这种情况?
发布于 2016-02-13 05:07:00
属性在定义时保留在相应的定义中。因此,这两个地方都存在的属性是无法避免的(因为您已经定义了它)。但是当chef-client运行时,会针对优先级https://docs.chef.io/attributes.html对属性进行评估,并将正确的属性值提供给chef-client。在您的示例中,将从环境属性中提取值。
https://stackoverflow.com/questions/35370277
复制相似问题