查询木偶

时间:2017-07-13 22:32:33

标签: puppet

我尝试使用Puppet 4.4 AST使用inventory API查询自定义事实。我查询的事实的结构是

apps: [
  {
    name: 'test-app-1',
    version: '1'
  },
  {
    name: 'test-app-2',
    version: '5'
  }
  ...
]

我希望返回包含app['name'] == 'test-app-1'哈希值的所有节点。这接近回归我正在寻找的东西:

["=", "facts.apps[1].name", "test-app-2"]

但我不知道应用程序将使用哪个元素索引,所以我需要更像这样(不正确)的语法:

["=", "facts.apps[*].name", "test-app-2"]

1 个答案:

答案 0 :(得分:0)

我使用WHERE QryTraining IN (IIf([Forms]![ReportDeployer]![CHKAV]<>"" ,"'Avonmouth'",x), IIf([Forms]![ReportDeployer]![CHKBA]<>"","'Basingstoke'",x), IIf([Forms]![ReportDeployer]![CHKBT]<>"","'Bedford Transport'",x), IIf([Forms]![ReportDeployer]![CHKBW]<>"","'Bedford Warehouse'",x), IIf([Forms]![ReportDeployer]![CHKBE]<>"","'Belfast'",x), IIf([Forms]![ReportDeployer]![CHKCA]<>"","'Carluke'",x), IIf([Forms]![ReportDeployer]![CHKEX]<>"","'Exeter'",x), IIf([Forms]![ReportDeployer]![CHKKI]<>"","'Kidderminister'",x), IIf([Forms]![ReportDeployer]![CHKKN]<>"","'Knowsley'",x), IIf([Forms]![ReportDeployer]![CHKTE]<>"","'Teva'",x), IIf([Forms]![ReportDeployer]![CHKWI]<>"","'Wickford'",x), IIf([Forms]![ReportDeployer]![CHKYO]<>"","'York'",x))表示法来解决这个问题。

match