【问题标题】:chef attribute precedance not working厨师属性优先级不起作用
【发布时间】:2017-11-18 03:16:23
【问题描述】:

我创建了一个角色(commonrole)并应用于多个节点。 现在我想覆盖 1 个特定节点上的属性之一以更改为不同的值。 因此,又创建了 1 个角色(noderole),并在“commonrole”之后将该角色应用于该节点,但我的节点没有选择新值(-Xmx2048m,如下所述)。

Sample common role-
{
  "name": "commonrole",
  "description": "Manages all nodes",
  "run_list": [
    "recipe[abc]"
      ],
  "default_attributes": {
    "catalina_opts": [
      "-Dfile.encoding=UTF-8"   
   ]
}

Sample noderole-
{
  "name": "noderole",
  "description": "Manages particular node",
  "run_list": [
    "role[commonrole]"
  ],
  "default_attributes": {
    "catalina_opts": [
      "-Dfile.encoding=UTF-8",
      "-Xmx2048m"
   ]
 }
}

我错过了什么吗?

【问题讨论】:

  • 你确定没有食谱属性使用override 级别为catalina_opts 吗?您如何确认该值未设置?有关合并的评估顺序,请参见 attribute precedence

标签: attributes chef-infra roles


【解决方案1】:

节点属性中的数组有点奇怪。我的网站上有完整的文章,但基本上这应该导致合并的值是:

[
  "-Dfile.encoding=UTF-8",
  "-Dfile.encoding=UTF-8",
  "-Xmx2048m"
]

或类似的东西。另请记住,只有在成功收敛后,您才会在 knife node show 输出中立即看到属性更改。

【讨论】:

    猜你喜欢
    • 2014-01-26
    • 1970-01-01
    • 2015-11-20
    • 1970-01-01
    • 2018-01-28
    • 2015-11-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多