diff options
-rw-r--r-- | src/api/models.py | 6 | ||||
-rw-r--r-- | src/booking/quick_deployer.py | 2 | ||||
-rw-r--r-- | src/resource_inventory/models.py | 5 |
3 files changed, 7 insertions, 6 deletions
diff --git a/src/api/models.py b/src/api/models.py index ec163a1..1f03deb 100644 --- a/src/api/models.py +++ b/src/api/models.py @@ -378,17 +378,17 @@ class GeneratedCloudConfig(models.Model): """ user_array = ["default"] users = list(self.booking.collaborators.all()) - users.append(self.booking.owner.userprofile) + users.append(self.booking.owner) for collaborator in users: userdict = {} # TODO: validate if usernames are valid as linux usernames (and provide an override potentially) - userdict['name'] = self._normalize_username(collaborator.user.username) + userdict['name'] = self._normalize_username(collaborator.username) userdict['groups'] = "sudo" userdict['sudo'] = "ALL=(ALL) NOPASSWD:ALL" - userdict['ssh_authorized_keys'] = [self._get_ssh_string(collaborator.user.username)] + userdict['ssh_authorized_keys'] = [self._get_ssh_string(collaborator.username)] user_array.append(userdict) diff --git a/src/booking/quick_deployer.py b/src/booking/quick_deployer.py index 1fd6a9c..2ab18a6 100644 --- a/src/booking/quick_deployer.py +++ b/src/booking/quick_deployer.py @@ -269,7 +269,7 @@ def create_from_form(form, request): booking.pdf = PDFTemplater.makePDF(booking) for collaborator in users_field: # list of Users (not UserProfile) - booking.collaborators.add(collaborator) + booking.collaborators.add(collaborator.user) booking.save() diff --git a/src/resource_inventory/models.py b/src/resource_inventory/models.py index 941c38f..71046a8 100644 --- a/src/resource_inventory/models.py +++ b/src/resource_inventory/models.py @@ -170,7 +170,8 @@ class CloudInitFile(models.Model): @classmethod def create(cls, text="", priority=0): prepended_text = "#cloud-config\n" - prepended_text = prepended_text + yaml.dump(CloudInitFile.merge_strategy()) + "\n" + mstrat = CloudInitFile.merge_strategy() + prepended_text = prepended_text + yaml.dump({"merge_strategy": mstrat}) + "\n" print("in cloudinitfile create") text = prepended_text + text cloud_dict = { @@ -184,7 +185,7 @@ class CloudInitFile(models.Model): }, "datasource_list": ["None"], } - return CloudInitFile.objects.create(priority=priority, text=json.dumps(cloud_dict)) + return CloudInitFile.objects.create(priority=priority, text=yaml.dump(cloud_dict)) class ResourceTemplate(models.Model): """ |