+ if not new_cloud_config["users"]:
+ del new_cloud_config["users"]
+
+ #boot-data-drive
+ if cloud_config and cloud_config.get("boot-data-drive") != None:
+ new_cloud_config["boot-data-drive"] = cloud_config["boot-data-drive"]
+ if cloud_config_preserve and cloud_config_preserve.get("boot-data-drive") != None:
+ new_cloud_config["boot-data-drive"] = cloud_config_preserve["boot-data-drive"]
+
+ # user-data
+ if cloud_config and cloud_config.get("user-data") != None:
+ new_cloud_config["user-data"] = cloud_config["user-data"]
+ if cloud_config_preserve and cloud_config_preserve.get("user-data") != None:
+ new_cloud_config["user-data"] = cloud_config_preserve["user-data"]
+
+ # config files
+ new_cloud_config["config-files"] = []
+ if cloud_config and cloud_config.get("config-files") != None:
+ new_cloud_config["config-files"] += cloud_config["config-files"]
+ if cloud_config_preserve:
+ for file in cloud_config_preserve.get("config-files", ()):
+ for index in range(0, len(new_cloud_config["config-files"])):
+ if new_cloud_config["config-files"][index]["dest"] == file["dest"]:
+ new_cloud_config["config-files"][index] = file
+ break
+ else:
+ new_cloud_config["config-files"].append(file)
+ if not new_cloud_config["config-files"]:
+ del new_cloud_config["config-files"]
+ return new_cloud_config
+
+