【问题标题】:Salt shows K/V in pillar.items but don't show specific keySalt 在pillar.items 中显示K/V,但不显示特定键
【发布时间】:2020-04-29 07:45:35
【问题描述】:

我是这方面的新手,在使用盐时遇到了一些问题。

我想使用支柱数据定位一些 monions

  1. 我在 Consul [testrun:run] 上为节点添加了 K\V
  2. 我尝试在 CLI 中查看pillar.items,这就是我所看到的

    # salt node-306 pillar.items
    node-306:
        ----------
        group:
            cpc
        region:
            ru
        sname:
            ru-qa-bat3
        team:
            qa
        testrun:
            run
    
  3. 但是当我尝试获取特定的密钥时,我看到了这个:

    # salt node-306 pillar.item testrun
    node-306:
        ----------
        testrun:
    

我做错了什么?要检查什么?不明白为什么盐会显示它,同时又没有

统一更新: 应用 salt node-306 saltutil.refresh_pillar 后

 #salt node-306 saltutil.refresh_pillar
node-306:
    True
# salt node-306 pillar.item testrun
node-306:
    ----------
    testrun:
        run
# salt -C "I@testrun:run" pillar.item sname
node-306:
    Minion did not return. [No response]
ERROR: Minions returned with non-zero exit code

【问题讨论】:

  • 尝试运行salt node-306 saltutil.refresh_pillar,然后运行pillar.item 命令。我刚刚使用常规支柱值对此进行了测试,并且它工作正常。如果 Consul 支柱没有返回 testrun 键值,则存在错误。
  • 谢谢你!这有帮助。但在那之后我又遇到了另一个问题。试图使用复合物来定位这个奴才并得到错误 - 更新的问题
  • node-306 运行的是哪个操作系统?
  • Windows 8.1 专业版

标签: salt-stack salt


【解决方案1】:

根据我的第一条评论,尝试运行salt node-306 saltutil.refresh_pillar

那么对于您的第二个问题,有时 Windows 有点慢。尝试让 Salt cli 再等几秒钟等待 minion 的响应:

salt -C "I@testrun:run" pillar.item sname -t 20

【讨论】:

  • 这没有帮助。不知道为什么。如果我使用pillar.item - 没关系
猜你喜欢
  • 2020-06-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2010-11-15
  • 2015-10-15
  • 2021-12-03
  • 1970-01-01
相关资源
最近更新 更多