Skip to content

Commit

Permalink
Merge pull request #543 from opensafely-core/extract-license-error
Browse files Browse the repository at this point in the history
chore: factor out the  stata licene error message
  • Loading branch information
bloodearnest authored Dec 29, 2022
2 parents f97f09e + 1d10332 commit f13b889
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions jobrunner/cli/local_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,23 @@
LOCAL_RUN_FORMAT = "{action}{message}"


STATA_ERROR_MESSGE = """
The docker image 'stata-mp' requires a license to function.
If you are a member of OpenSAFELY we should have been able to fetch
the license automatically, so something has gone wrong. Please open
a new discussion here so we can help:
https://github.com/opensafely/documentation/discussions
If you are not a member of OpenSAFELY you will have to provide your
own license. See the dicussion here for pointers:
https://github.com/opensafely/documentation/discussions/299
"""


# Super-crude support for colourised/formatted output inside Github Actions. It
# would be good to support formatted output in the CLI more generally, but we
# should use a decent library for that to handle the various cross-platform
Expand Down Expand Up @@ -316,18 +333,7 @@ def create_and_run_jobs(
if uses_stata and config.STATA_LICENSE is None:
config.STATA_LICENSE = get_stata_license()
if config.STATA_LICENSE is None:
print(
"The docker image 'stata-mp' requires a license to function.\n"
"\n"
"If you are a member of OpenSAFELY we should have been able to fetch\n"
"the license automatically, so something has gone wrong. Please open\n"
"a new discussion here so we can help:\n"
" https://github.com/opensafely/documentation/discussions\n"
"\n"
"If you are not a member of OpenSAFELY you will have to provide your\n"
"own license. See the dicussion here for pointers:\n"
" https://github.com/opensafely/documentation/discussions/299"
)
print(STATA_ERROR_MESSGE)
return False

for image in docker_images:
Expand Down

0 comments on commit f13b889

Please sign in to comment.