Skip to content

Commit

Permalink
When first setting up the server the service account may not yet exist
Browse files Browse the repository at this point in the history
In this case trying to stop the server running as this account will
obviously fail until the setup has created this very account. Allow for
this case.

The specific error message to check for should perhaps not include
hardcoded "irods" as username, but is used in the present release in a
fixed way anyway and with few call-sites, and it makes the code somewhat
more self-explaining.
  • Loading branch information
fiberbit authored and alanking committed Nov 27, 2023
1 parent f65c7da commit 0121a2b
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions irods_testing_environment/irods_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,8 +436,17 @@ def setup_irods_server(container, setup_input):
from . import container_info
from . import irods_config

if stop_irods(container) != 0:
logging.debug(f'[{container.name}] failed to stop iRODS server before setup')
try:
if stop_irods(container) != 0:
logging.debug(f'[{container.name}] failed to stop iRODS server before setup')
except Exception as e:
error_msg = f'[{container.name}] failed to stop iRODS server before setup: {str(e)}'
if "unable to find user irods" in str(e):
# If the user didn't exist at this point then the service probably wasn't started.
logging.debug(error_msg)
else:
logging.error(error_msg)
raise e

ec = execute.execute_command(container, 'bash -c \'echo "{}" > /input\''.format(setup_input))
if ec != 0:
Expand Down

0 comments on commit 0121a2b

Please sign in to comment.