3

在我的.kitchen.yml配置中,我尝试根据平台版本应用属性。我的厨房配置如下所示:

platforms:
  - name: centos-6.3
    driver_plugin: ec2
    driver:
      image_id: ami-xxxxxxxx
    attributes:
      pg_version: "9.3"
  - name: centos-6.5
    driver_plugin: ec2
    driver:
      image_id: ami-yyyyyyyy 
    attributes:
      pg_version: "9.4"

在此kitchen converge过程中,我无法pg_version正确获得价值。对于我的厨师脚本pp node.debug_value('pg_version')输出中的此代码,如下所示:

   [["set_unless_enabled?", false],
    ["default", :not_present],
    ["env_default", :not_present],
    ["role_default", :not_present],
    ["force_default", :not_present],
    ["normal", "9.4"],
    ["override", :not_present],
    ["role_override", :not_present],
    ["env_override", :not_present],
    ["force_override", :not_present],
    ["automatic", :not_present]]

我不太清楚这个结果。我假设我在platformsyml 部分中指定的属性的优先级是normal,那么我怎样才能得到它?

用户danieljimenez也在这里提出了类似的问题。

4

1 回答 1

2

各种优先级合并到一个node对象中。您需要node['pg_version']在您的情况下使用它来访问它。设置值时,您只需要node.default, 。node.setnode.override

于 2015-06-09T21:50:20.950 回答