gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-03 16:24:37 25 4
gpt4 key购买 nike

在我的 .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 值。对于我的 Chef 脚本 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]]

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

用户 danieljimenez也提出了类似的问题here .

最佳答案

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

关于amazon-ec2 - 测试厨房:如何读取 kitchen.yml 中的平台特定属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30740921/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com