From 3bd4d84bfe0580c5f484ad106ac67ed8ec681a2d Mon Sep 17 00:00:00 2001 From: Chris Cheetham Date: Mon, 9 Jan 2023 08:50:46 -0500 Subject: [PATCH] Do not fail on route error --- pysteel/cloudfoundry.py | 6 ++++++ steps/process_steps.py | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/pysteel/cloudfoundry.py b/pysteel/cloudfoundry.py index 9d353e59b..d328c57b4 100644 --- a/pysteel/cloudfoundry.py +++ b/pysteel/cloudfoundry.py @@ -11,6 +11,10 @@ class CloudFoundryObjectDoesNotExistError(Exception): pass +class CloudFoundryRouteError(Exception): + pass + + class CloudFoundry(object): def __init__(self, context): @@ -207,6 +211,8 @@ def get_app_status(self, app_name): except command.CommandException as e: if "App '{}' not found".format(app_name) in str(e): raise CloudFoundryObjectDoesNotExistError() + if "Requested route" in str(e) and "does not exist" in str(e): + raise CloudFoundryRouteError() raise e match = re.search(r'^#0\s+(\S+)', cmd.stdout, re.MULTILINE) if not match: diff --git a/steps/process_steps.py b/steps/process_steps.py index d0ab9e681..78957393a 100644 --- a/steps/process_steps.py +++ b/steps/process_steps.py @@ -3,7 +3,7 @@ from behave import * -from pysteel.cloudfoundry import CloudFoundry, CloudFoundryObjectDoesNotExistError +from pysteel.cloudfoundry import CloudFoundry, CloudFoundryObjectDoesNotExistError, CloudFoundryRouteError from pysteel.command import Command @@ -89,6 +89,8 @@ def app_started(): return status == 'running' except CloudFoundryObjectDoesNotExistError: return False + except CloudFoundryRouteError: + return False try_until(context, app_started, context.options.cf.max_attempts)