mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Include the jid (when available) in SystemExit message on Ctrl-c
This commit is contained in:
parent
9c9f1f620b
commit
9025be48c5
1 changed files with 17 additions and 2 deletions
|
@ -46,9 +46,24 @@ def _handle_signals(client, signum, sigframe):
|
|||
hardcrash = client.options.hard_crash
|
||||
except (AttributeError, KeyError):
|
||||
hardcrash = False
|
||||
|
||||
exit_msg = '\nExiting gracefully on Ctrl-c'
|
||||
try:
|
||||
jid = client.local_client.pub_data['jid']
|
||||
exit_msg += (
|
||||
'\n'
|
||||
'This job\'s jid is: {0}\n'
|
||||
'The minions may not have all finished running and any remaining '
|
||||
'minions will return upon completion. To look up the return data '
|
||||
'for this job later, run the following command:\n\n'
|
||||
'salt-run jobs.lookup_jid {0}'.format(jid)
|
||||
)
|
||||
except (AttributeError, KeyError):
|
||||
pass
|
||||
|
||||
_handle_interrupt(
|
||||
SystemExit('\nExiting gracefully on Ctrl-c'),
|
||||
Exception('\nExiting with hard crash Ctrl-c'),
|
||||
SystemExit(exit_msg),
|
||||
Exception('\nExiting with hard crash on Ctrl-c'),
|
||||
hardcrash, trace=trace)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue