Skip to content

Commit

Permalink
Do not fail on route error
Browse files Browse the repository at this point in the history
  • Loading branch information
ccheetham committed Jan 17, 2023
1 parent 207e355 commit 3bd4d84
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions pysteel/cloudfoundry.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ class CloudFoundryObjectDoesNotExistError(Exception):
pass


class CloudFoundryRouteError(Exception):
pass


class CloudFoundry(object):

def __init__(self, context):
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 3 additions & 1 deletion steps/process_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 3bd4d84

Please sign in to comment.