Moved exception Salt core

The timeout exception is now part of exceptions.py and no longer solely
defined in the module.
This commit is contained in:
Jochen Breuer 2017-09-19 09:53:27 +02:00
parent 7431ec64e3
commit 35cf69bc50
No known key found for this signature in database
GPG key ID: 29ACE79F4D5EEE69
2 changed files with 9 additions and 6 deletions

View file

@ -265,6 +265,12 @@ class SaltCacheError(SaltException):
'''
class TimeoutError(SaltException):
'''
Thrown when an opration cannot be completet within a given time limit.
'''
class SaltReqTimeoutError(SaltException):
'''
Thrown when a salt master request call fails to return within the timeout

View file

@ -48,6 +48,7 @@ from salt.exceptions import CommandExecutionError
from salt.ext.six import iteritems
import salt.utils
import salt.utils.templates
from salt.exceptions import TimeoutError
from salt.ext.six.moves import range # pylint: disable=import-error
try:
@ -82,15 +83,11 @@ def __virtual__():
return False, 'python kubernetes library not found'
class TimeoutException(Exception):
pass
if salt.utils.is_windows():
@contextmanager
def _time_limit(seconds):
def signal_handler(signum, frame):
raise TimeoutException
raise TimeoutError
signal.signal(signal.SIGALRM, signal_handler)
signal.alarm(seconds)
try:
@ -723,7 +720,7 @@ def delete_deployment(name, namespace='default', **kwargs):
sleep(1)
else: # pylint: disable=useless-else-on-loop
mutable_api_response['code'] = 200
except TimeoutException:
except TimeoutError:
pass
else:
# Windows has not signal.alarm implementation, so we are just falling