支柱。获取以及默认值.get返回包含嵌套dict的null值

2024-06-16 11:31:52 发布

您现在位置:Python中文网/ 问答频道 /正文

在我的支柱中,我试图从defaults.yaml中的嵌套dict填充一个值:

rippled:
  version: 1.2.2
^{pr2}$

{I{I>不能返回top},但在cdm>中不能返回top}值:

salt-call defaults.get rippled
local:
    ----------
    rippled:
        ----------
        config:
            ----------
        hash:
            5zf863d39b135dce1e3a15e1b62e096df03de5c7a0e3a4b879f02b7207cf0c04
        service:
            False
        version:
            1.2.2

salt-call defaults.get rippled:version
local:

我使用pillar.get得到了类似的结果,但是在那里我可以从CLI获得嵌套的dict值,也可以在文件中得到null

rippled:
  config:
    version: 1.2.2

  tags:
    - {{ salt['pillar.get']('rippled:config:version') }}

salt-call pillar.get rippled:config:version
local:
    1.2.2

文件中的结果:

"tags": [
  null

Tags: 文件configgetversionlocaltoptagscall