厨房汇合运行时angular色属性何时适用?

我试图访问属于节点angular色的节点属性。 然而,当我调用这些属性的配方运行时,似乎厨师零运行时我没有运行厨房收敛。 只是为了清楚我试图检索数组node['splunk']['monitors']所以我可以使用模板资源创build一个文件。

这个debugging语句的输出似乎表明如此:

 output = node.debug_value('splunk', 'monitors').to_yaml file './node.yaml' do content output end Recipe: cookbook-forwarders::server_dimensions * file[./node.yaml] action create - create new file ./node.yaml - update content in file ./node.yaml from none to a03cf8 --- ./node.yaml 2017-08-14 21:19:17.621000000 +0000 +++ ./.node.yaml20170814-11056-1uoh9mv 2017-08-14 21:19:17.621000000 +0000 @@ -1 +1,24 @@ +--- +- - set_unless_enabled? + - false +- - default + - :not_present +- - env_default + - :not_present +- - role_default + - :not_present +- - force_default + - :not_present +- - normal + - :not_present +- - override + - :not_present +- - role_override + - :not_present +- - env_override + - :not_present +- - force_override + - :not_present +- - automatic + - :not_present Running handlers: Running handlers complete Chef Client finished, 1/1 resources updated in 1.731361259 seconds Finished converging <default-ylinux6> (0m15.23s). 

JSONangular色看起来像这样

 { "chef_type": "role", "default_attributes": { "gateway_common_input": { "monitor": "/home/app/logs/common", "index": "gateway_common", "sourcetype": "common" }, "gateway_recv_counter_input": { "monitor": "/home/app/logs/recv_counter", "index": "gateway_recv_counter", "sourcetype": "recv_counter" }, "gateway_send_counter_input": { "monitor": "/home/app/logs/send_counter", "index": "gateway_send_counter", "sourcetype": "send_counter" } }, "description": "Role for Gateway hosts", "env_run_lists": {}, "json_class": "Chef::Role", "name": "rgateway", "override_attributes": {}, "run_list": [ "role[gateway]", "recipe[gateway_dimensions]" ] } 

angular色和环境的path在我的.kitchen.yaml文件中定义:

 --- driver: name: docker provisioner: name: chef_zero environments_path: environments/ roles_path: roles/ client_rb: environment: smoke role: server "Ohai::Config[:disabled_plugins] = [:GCE] #":