Amazon ec2 测试厨房:如何在kitchen.yml中读取特定于平台的属性

Amazon ec2 测试厨房:如何在kitchen.yml中读取特定于平台的属性,amazon-ec2,chef-infra,test-kitchen,chefdk,Amazon Ec2,Chef Infra,Test Kitchen,Chefdk,在我的.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:

在我的
.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"
过程中
我无法正确获取
pg\u版本
值。对于my chef script
pp节点中的此代码。调试值(“pg\U版本”)
输出如下:

   [["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]]
我不清楚这个结果。我假设我在
platforms
yml部分中指定的属性的优先级是
normal
,那么如何获得它呢


用户也提出了类似的问题。

不同的优先级被合并到一个
节点
对象中。在您的情况下,您需要使用
节点['pg_version']
访问它。设置值时,您只需要
node.default
node.set
node.override

您能告诉我们如何访问属性吗?我希望它出现在
节点['pg_version']
@martinjust中updated@Martin这是否意味着默认情况下,所有平台属性都处于
normal
优先级,我们需要像
node.normal['pg\u version']
一样使用smth?