Only display Ctrl-c message on SIGINT

This commit is contained in:
Erik Johnson 2016-10-04 14:22:28 -05:00
parent 9025be48c5
commit 0e7c600e02

View file

@ -47,19 +47,22 @@ def _handle_signals(client, signum, sigframe):
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
if signum == signal.SIGINT:
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
else:
exit_msg = None
_handle_interrupt(
SystemExit(exit_msg),