mirror of https://github.com/Icinga/icinga2.git
Fix the vm-test runner's error handling
This commit is contained in:
parent
a7e237640f
commit
862f61d93b
|
@ -117,9 +117,14 @@ class LiveStatusSocket(object):
|
|||
while not self._connected and time.time() - start < timeout:
|
||||
try:
|
||||
self.connect()
|
||||
except socket.error, error:
|
||||
if error.errno != 111:
|
||||
raise
|
||||
except socket.error:
|
||||
# Icinga2 does some "magic" with the socket during startup
|
||||
# which causes random errors being raised (EACCES, ENOENT, ..)
|
||||
# so we just ignore them until the timeout is reached
|
||||
time.sleep(1)
|
||||
if not self._connected:
|
||||
# Raise the very last exception once the timeout is reached
|
||||
raise
|
||||
|
||||
def close(self):
|
||||
if self._connected:
|
||||
|
|
|
@ -85,15 +85,23 @@ class TestSuite(object):
|
|||
|
||||
def _remove_file(self, path):
|
||||
command = self._config['commands']['clean'].format(path)
|
||||
subprocess.call(command, stdout=DEVNULL, shell=True)
|
||||
rc = subprocess.call(command, stdout=DEVNULL, shell=True)
|
||||
if rc != 0:
|
||||
print 'WARNING: Cannot remove file "{0}" ({1})'.format(path, rc)
|
||||
|
||||
def _exec_command(self, command):
|
||||
command = self._config['commands']['exec'].format(command)
|
||||
subprocess.call(command, stdout=DEVNULL, shell=True)
|
||||
rc = subprocess.call(command, stdout=DEVNULL, shell=True)
|
||||
if rc != 0:
|
||||
print 'WARNING: Command "{0}" exited with exit code "{1}"' \
|
||||
''.format(command, rc)
|
||||
|
||||
def _copy_file(self, source, destination):
|
||||
command = self._config['commands']['copy'].format(source, destination)
|
||||
subprocess.call(command, stdout=DEVNULL, shell=True)
|
||||
rc = subprocess.call(command, stdout=DEVNULL, shell=True)
|
||||
if rc != 0:
|
||||
print 'WARNING: Cannot copy file "{0}" to "{1}" ({2})' \
|
||||
''.format(source, destination, rc)
|
||||
|
||||
def _copy_test(self, path):
|
||||
self._copy_file(path, os.path.join(self._config['settings']['test_root'],
|
||||
|
|
Loading…
Reference in New Issue