Salt loop.until_no_eval:

Viewed 206

Trying to use loop.until module without success ...

what I have:

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"'}

what I'm getting :

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

Most probably - expected: isn't defined correctly however, can't understand how to should be :(

https://docs.saltproject.io/en/latest/ref/states/all/salt.states.loop.html - this doesn't help me

1 Answers

Your condition should be either a python or dict path expression, as in the examples.

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"'}
Related