diff options
author | Sawyer Bergeron <sbergeron@iol.unh.edu> | 2021-10-11 22:02:16 +0000 |
---|---|---|
committer | Sawyer Bergeron <sbergeron@iol.unh.edu> | 2021-10-11 22:02:16 +0000 |
commit | afcee3cad5c091e78e909b83f8df49accf1af5b6 (patch) | |
tree | f0e57c648e1688a977a7456554886772c6531e93 /src/api/views.py | |
parent | 5ce0a52b17e530436c298e1b581d37bac853f5a7 (diff) |
Prod cobbler hotfixes
Signed-off-by: Sawyer Bergeron <sbergeron@iol.unh.edu>
Change-Id: I092bc6d85a3b2c77bfbe24f3af0d2b7a5f75a8c3
Diffstat (limited to 'src/api/views.py')
-rw-r--r-- | src/api/views.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/api/views.py b/src/api/views.py index 5af3d69..13bf1dd 100644 --- a/src/api/views.py +++ b/src/api/views.py @@ -37,6 +37,8 @@ from resource_inventory.models import ( ) import json +import yaml +import uuid from deepmerge import Merger """ @@ -309,19 +311,19 @@ def resource_ci_userdata_directory(request, lab_name="", job_id="", resource_id= ["override"], # if types conflict (shouldn't happen in CI, but handle case) ) - for file in files.order_by("priority").all(): + for f in resource.config.cloud_init_files.order_by("priority").all(): try: - other_dict = yaml.load(file.text) + other_dict = yaml.load(f.text) if not (type(d) is dict): raise Exception("CI file was valid yaml but was not a dict") merger.merge(d, other_dict) except Exception as e: # if fail to merge, then just skip - print("Failed to merge file in, as it had invalid content:", file.id) + print("Failed to merge file in, as it had invalid content:", f.id) print("File text was:") - print(file.text) - d['merge_failures'].append({file.id: str(e)}) + print(f.text) + d['merge_failures'].append({f.id: str(e)}) file = CloudInitFile.create(text=yaml.dump(d), priority=0) |