【问题标题】:Node search is not working in test kitchen节点搜索在测试厨房中不起作用
【发布时间】:2017-03-02 07:02:22
【问题描述】:

我没有收到输出和错误

--------异常-------

类:厨房::ActionFailed

消息:1 个操作失败。”

食谱/测试/集成/节点 json文件

{
  "id": "hive server", 
  "chef_type": "node", 
  "environment": "dev", 
  "json_class": "Chef::Node", 
  "run_list": [], 
  "automatic": { 
      "hostname": "test.net", 
      "fqdn": "127.0.0.1", 
      "name": "test.net", 
      "ipaddress": "127.0.0.1", 
      "node_zone": "green", 
      "roles": []
  },
  "attributes": {
      "hiveserver": "true"
  }
}

食谱

hiveNodes = search(:node, "hiveserver:true AND      environment:node.environment AND node_color:node["node_color"])

# hiveserverList = ""
# hiveNodes.each |hnode| do
# hiveserverList += hnode
#end

#file '/tmp/test.txt' do
#  content '#{hiveserverList}'
#end

【问题讨论】:

  • 我不知道你想问什么。或许可以添加一些散文来解释
  • 测试厨房的节点搜索失败
  • 在测试厨房中,我想搜索虚拟节点取决于来自 nodes.json 文件的标签属性

标签: node.js chef-infra test-kitchen


【解决方案1】:

我认为您的意思是使用"hiveserver:true AND chef_environment:#{node.chef_environment} AND node_color:#{node["node_color"]}" 作为您的搜索字符串。 #{} 语法是您将 Ruby 表达式值嵌入到字符串中的方式。同样出于复杂的向后兼容的原因,节点上的环境称为chef_environment

【讨论】:

    猜你喜欢
    • 2017-07-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多