Return value of salt-call is always zero

154 views
Skip to first unread message

Bernd Nigmann

unread,
Nov 26, 2012, 4:05:28 PM11/26/12
to salt-...@googlegroups.com
When I run salt-call, it always returns zero, regardless of the outcome of the executed states. Even when no state matches are found at all for the minion, it returns zero:

# salt-call -l quiet state.highstate ; echo $?
 
local:
----------
    State: - no
    Name:      states
    Function:  None
        Result:    False
        Comment:   No Top file or external nodes data matches found
        Changes:   
0

A few hours ago, on #Salt, "Smaragd_" had the same problem and "kuffs" mentioned he remembered an open bug around that. Neither Smaragd_ nor I could find it, though. Can anyone please point me in the right direction?

Thomas S Hatch

unread,
Nov 26, 2012, 4:25:26 PM11/26/12
to salt-...@googlegroups.com
Hmm, salt-call does not make an explicit distinction as to whether a command fails or succeds if it executed and then returned then I have considered it success  This could also be seen as being highly subjective depending on the command. I am not aware of an open issue off the top of my head

Bernd Nigmann

unread,
Nov 26, 2012, 4:57:56 PM11/26/12
to salt-...@googlegroups.com
Ah, that explains why I couldn't find one. That's okay, I can work around it by switching to raw or YAML output and parsing the "result" field of each of the execution blocks. Thanks, Thomas.


PS: It would've been nice if the return value for salt-call was non-zero if any of the nested "result" results was "false", as in

# salt-call -l quiet --yaml-out state.highstate

local:
  no_|-states_|-states_|-None:
    __run_num__: 0
    changes: {}
    comment: No Top file or external nodes data matches found
    name: No States
    result: false

Thomas S Hatch

unread,
Nov 26, 2012, 5:48:45 PM11/26/12
to salt-...@googlegroups.com
I have been thinking about this, the trouble is that we would need to do this for all modules, and not all cases are easily defined as pass/fail. I am game for it though, since I think it is a killer idea, I just worry about the ability to execute in a consistent way....
Reply all
Reply to author
Forward
0 new messages