[virt-tools-list] [virt-manager PATCH v3] Introduction of cloud-init configuration in virt-install

Daniel P. Berrangé berrange at redhat.com
Tue Jul 2 09:10:20 UTC 2019


On Fri, Jun 28, 2019 at 07:05:18PM +0300, Athina Plaskasoviti wrote:
> Usage:
> --cloud-init
> 
> Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti at gmail.com>
> ---
>  virt-install                        |  5 +++
>  virtinst/cli.py                     | 25 +++++++++++++
>  virtinst/install/cloudinit.py       | 57 +++++++++++++++++++++++++++++
>  virtinst/install/installer.py       | 17 +++++++++
>  virtinst/install/installerinject.py | 20 +++++-----
>  5 files changed, 115 insertions(+), 9 deletions(-)
>  create mode 100644 virtinst/install/cloudinit.py


> +def create_userdata(scratchdir, cloudinit_data, username=None, password=None):
> +    if not password:
> +        password = ""
> +        for dummy in range(16):
> +            password += random.choice(string.ascii_letters + string.digits)
> +    content = "#cloud-config\n"
> +    if username:
> +        content += "name: %s\n" % username
> +    if cloudinit_data.root_password == "generate":
> +        pass
> +    else:
> +        content += "password: %s\n" % password
> +        log.debug("Generated password for first boot: \n%s", password)
> +        time.sleep(20)

Sleeping to let the user see it is nice, but we should allow the user
to press enter to continue the operation instead of forcing them to
wait the full 20 seconds.

Also, never put passwds into log messages - log files are frequently
uploaded to public bug trackers, so having passwds in there will
violate users' privacy / security.


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the virt-tools-list mailing list