diff options
author | Sawyer Bergeron <sbergeron@iol.unh.edu> | 2021-09-30 14:03:55 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2021-09-30 14:03:55 +0000 |
commit | 529b2521627b17142284c55c744812129edc71e8 (patch) | |
tree | b68175b19f3cdc06207c7c600baa7a639084081d | |
parent | d55551394df73645e49ae2ae3e730a9f1c6af81d (diff) | |
parent | e9d72ce78a85c6ff2f3f8591bcbf4115f97318d5 (diff) |
Merge "Push cloud config content for generated files into userdata_raw" into cobbler
-rw-r--r-- | src/resource_inventory/models.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/resource_inventory/models.py b/src/resource_inventory/models.py index 1505f02..941c38f 100644 --- a/src/resource_inventory/models.py +++ b/src/resource_inventory/models.py @@ -18,6 +18,7 @@ import json import yaml import re +import uuid from collections import Counter from account.models import Lab @@ -171,7 +172,19 @@ class CloudInitFile(models.Model): prepended_text = "#cloud-config\n" prepended_text = prepended_text + yaml.dump(CloudInitFile.merge_strategy()) + "\n" print("in cloudinitfile create") - return CloudInitFile.objects.create(priority=priority, text=(prepended_text + text)) + text = prepended_text + text + cloud_dict = { + "datasource": { + "None": { + "metadata": { + "instance-id": str(uuid.uuid4()) + }, + "userdata_raw": text, + }, + }, + "datasource_list": ["None"], + } + return CloudInitFile.objects.create(priority=priority, text=json.dumps(cloud_dict)) class ResourceTemplate(models.Model): """ |