盐 loop.until_no_eval:

Salt loop.until_no_eval:

尝试使用 loop.until 模块但没有成功...

我有:

check_for_windows_logon:
  loop.until_no_eval:
    - name: cmd.run
    - expected: 'Logon is available'
    - compare_operator: data.subdict_match
    - period: 5
    - timeout: 20
    - args:
      - powershell Get-Process LogonUI {echo 'changed=no comment="Logon is available"'}

我得到了什么:

LKA5:
----------
          ID: check_for_windows_logon
    Function: loop.until_no_eval
        Name: cmd.run
      Result: False
     Comment: Call did not produce the expected result after 4 attempts
     Started: 12:36:06.397818
    Duration: 27255.023 ms
     Changes:

Summary for LKA5
------------
Succeeded: 0
Failed:    1
------------
Total states run:     1
Total run time:  27.255 s

很可能 - 预期:没有正确定义但是,无法理解应该如何:(

https://docs.saltproject.io/en/latest/ref/states/all/salt.states.loop.html - 这对我没有帮助

您的条件应该是 python 或字典路径表达式,如示例中所示。

check_for_windows_logon:
  loop.until_no_eval:
    - name: cmd.run
    - expected: '"Logon is available" in m_ret'
    - period: 5
    - timeout: 20
    - args:
      - powershell Get-Process LogonUI {echo 'changed=no comment="Logon is available"'}