Revert "Bug 2217 fixed: modified the cloud-init merge configs and defined the default... 14/14314/3
authorgarciadeblas <gerardo.garciadeblas@telefonica.com>
Tue, 9 Apr 2024 08:15:45 +0000 (10:15 +0200)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Tue, 9 Apr 2024 08:40:08 +0000 (10:40 +0200)
This reverts commit 98740c03567ff8c5a22f06fd3f049248a9e5f98d.

Change-Id: Ia137e1cbb92fa83c40a3b0b8ac9f05d3485f8a42
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
RO-plugin/osm_ro_plugin/vimconn.py
releasenotes/notes/revert_fix_bug2217-b3ad0d1867b37f66.yaml [new file with mode: 0644]

index 66fe190..d0162cc 100644 (file)
@@ -300,32 +300,13 @@ class VimConnector:
         userdata = None
         userdata_list = []
 
-        # For more information, check https://cloudinit.readthedocs.io/en/latest/reference/merging.html
-        # Basically, with this, we don't override the provider's cloud config
-        merge_how = yaml.safe_dump(
-            {
-                "merge_how": [
-                    {
-                        "name": "list",
-                        "settings": ["append", "recurse_dict", "recurse_list"],
-                    },
-                    {
-                        "name": "dict",
-                        "settings": ["no_replace", "recurse_list", "recurse_dict"],
-                    },
-                ]
-            },
-            indent=4,
-            default_flow_style=False,
-        )
-
         if isinstance(cloud_config, dict):
             if cloud_config.get("user-data"):
                 if isinstance(cloud_config["user-data"], str):
-                    userdata_list.append(cloud_config["user-data"] + f"\n{merge_how}")
+                    userdata_list.append(cloud_config["user-data"])
                 else:
                     for u in cloud_config["user-data"]:
-                        userdata_list.append(u + f"\n{merge_how}")
+                        userdata_list.append(u)
 
             if cloud_config.get("boot-data-drive") is not None:
                 config_drive = cloud_config["boot-data-drive"]
@@ -340,12 +321,12 @@ class VimConnector:
                 # default user
                 if cloud_config.get("key-pairs"):
                     userdata_dict["ssh-authorized-keys"] = cloud_config["key-pairs"]
-                    userdata_dict["system_info"] = {
-                        "default_user": {
-                            "ssh_authorized_keys": cloud_config["key-pairs"],
+                    userdata_dict["users"] = [
+                        {
+                            "default": None,
+                            "ssh-authorized-keys": cloud_config["key-pairs"],
                         }
-                    }
-                    userdata_dict["users"] = ["default"]
+                    ]
 
                 if cloud_config.get("users"):
                     if "users" not in userdata_dict:
@@ -384,7 +365,6 @@ class VimConnector:
                 userdata_list.append(
                     "#cloud-config\n"
                     + yaml.safe_dump(userdata_dict, indent=4, default_flow_style=False)
-                    + f"\n{merge_how}"
                 )
             userdata = self._create_mimemultipart(userdata_list)
             self.logger.debug("userdata: %s", userdata)
diff --git a/releasenotes/notes/revert_fix_bug2217-b3ad0d1867b37f66.yaml b/releasenotes/notes/revert_fix_bug2217-b3ad0d1867b37f66.yaml
new file mode 100644 (file)
index 0000000..4cd384b
--- /dev/null
@@ -0,0 +1,25 @@
+#######################################################################################
+# Copyright ETSI Contributors and Others.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#######################################################################################
+---
+prelude: >
+    This change reverts the fix of bug 2217, because it breaks the creation of
+    virtual machines with a config drive.
+fixes:
+  - |
+    The merge_how dictionary is wrongly appended to the user data, leading to
+    failures in the bootstrap of the VM.
+