Skip to content

Commit 636064c

Browse files
restructured the clouds call
1 parent 7ee4cc3 commit 636064c

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

bibigrid/core/startup_rest.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -249,12 +249,8 @@ async def state(cluster_id: str):
249249
return JSONResponse(content={"error": type(exc).__name__, "message": str(exc)}, status_code=400)
250250

251251

252-
if __name__ == "__main__":
253-
parser = argparse.ArgumentParser(description='BiBiGrid REST easily sets up clusters within a cloud environment')
254-
parser.add_argument("-c", "--clouds", default=["openstack"], nargs="+",
255-
help="Name of clouds.yaml entries to check on startup.")
256-
args = parser.parse_args()
257-
clouds_yaml_check = validate_configuration.ValidateConfiguration([{"cloud": cloud} for cloud in args.clouds], None,
252+
def check_clouds_yaml(clouds):
253+
clouds_yaml_check = validate_configuration.ValidateConfiguration([{"cloud": cloud} for cloud in clouds], None,
258254
LOG).check_clouds_yamls()
259255
clouds_yaml_security_check = validate_configuration.check_clouds_yaml_security(LOG)
260256
if clouds_yaml_check and clouds_yaml_security_check:
@@ -266,5 +262,14 @@ async def state(cluster_id: str):
266262
LOG.warning(message)
267263
print(message)
268264
exit(0)
265+
266+
if __name__ == "__main__":
267+
parser = argparse.ArgumentParser(description='BiBiGrid REST easily sets up clusters within a cloud environment')
268+
parser.add_argument("-c", "--clouds", default=["openstack"], nargs="+",
269+
help="Name of clouds.yaml entries to check on startup.")
270+
args = parser.parse_args()
271+
272+
check_clouds_yaml(args.clouds)
273+
269274
uvicorn.run("bibigrid.core.startup_rest:app", host="0.0.0.0", port=8000,
270275
workers=multiprocessing.cpu_count() * 2 + 1)

0 commit comments

Comments
 (0)