From 5ce0a52b17e530436c298e1b581d37bac853f5a7 Mon Sep 17 00:00:00 2001 From: Sawyer Bergeron Date: Thu, 7 Oct 2021 17:14:01 -0400 Subject: Manually merge CI files Signed-off-by: Sawyer Bergeron Change-Id: Ic63d5da699578007ef2f2cc373350ded06c66971 --- src/booking/quick_deployer.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/booking/quick_deployer.py') diff --git a/src/booking/quick_deployer.py b/src/booking/quick_deployer.py index 2ab18a6..261b095 100644 --- a/src/booking/quick_deployer.py +++ b/src/booking/quick_deployer.py @@ -219,6 +219,12 @@ def create_from_form(form, request): global_cloud_config = None if not form.cleaned_data['global_cloud_config'] else form.cleaned_data['global_cloud_config'] if global_cloud_config: + try: + d = yaml.load(global_cloud_config) + if not (type(d) is dict): + raise Exception("CI file was valid yaml but was not a dict") + except Exception as e: + raise ValidationError("The provided Cloud Config is not valid yaml, please refer to the Cloud Init documentation for expected structure") print("about to create global cloud config") global_cloud_config = CloudInitFile.create(text=global_cloud_config, priority=CloudInitFile.objects.count()) print("made global cloud config") -- cgit 1.2.3-korg