mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
cloudinit: Clean up create_metadata and create_userdata functions from unused/unwanted arguments
Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti@gmail.com>
This commit is contained in:
committed by
Cole Robinson
parent
0bbfc80b68
commit
0e5b1b3048
@@ -10,31 +10,21 @@ 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":
|
||||
|
||||
Reference in New Issue
Block a user