[virt-tools-list] [virt-manager PATCH] cloudinit: Clean up create_metadata and create_userdata functions from unused/unwanted arguments

Athina Plaskasoviti athina.plaskasoviti at gmail.com
Wed Jul 3 05:37:03 UTC 2019


Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti at gmail.com>
---
 virtinst/install/cloudinit.py | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

diff --git a/virtinst/install/cloudinit.py b/virtinst/install/cloudinit.py
index 3cb13484..8041cc86 100644
--- a/virtinst/install/cloudinit.py
+++ b/virtinst/install/cloudinit.py
@@ -9,31 +9,22 @@ class CloudInitData():
     root_password = None
 
 
-def create_metadata(scratchdir, hostname=None):
-    if hostname:
-        instance = hostname
-    else:
-        hostname = instance = "localhost"
-    content = 'instance-id: %s\n' % instance
-    content += 'hostname: %s\n' % hostname
-    log.debug("Generated cloud-init metadata:\n%s", content)
+def create_metadata(scratchdir):
 
     fileobj = tempfile.NamedTemporaryFile(
             prefix="virtinst-", suffix="-metadata",
             dir=scratchdir, delete=False)
     filename = fileobj.name
 
+    content = ""
     with open(filename, "w") as f:
         f.write(content)
+    log.debug("Generated cloud-init metadata\n%s", content)
     return filename
 
 
-def create_userdata(scratchdir, cloudinit_data, username=None, password=None):
+def create_userdata(scratchdir, cloudinit_data):
     content = "#cloud-config\n"
-    if username:
-        content += "name: %s\n" % username
-    if password:
-        content += "password: %s\n" % password
 
     rootpass = cloudinit_data.root_password
     if rootpass == "generate":
-- 
2.20.1




More information about the virt-tools-list mailing list