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

Cole Robinson crobinso at redhat.com
Wed Jul 3 18:05:35 UTC 2019


On 7/3/19 1:37 AM, Athina Plaskasoviti wrote:
> 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):
>  

I dropped the newline here, and pushed this to the cloudinit branch

Thanks,
Cole

>      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":
> 


- Cole




More information about the virt-tools-list mailing list