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

Cole Robinson crobinso at redhat.com
Tue Jul 2 13:45:48 UTC 2019


On 7/2/19 5:10 AM, Daniel P. Berrangé wrote:
> 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.
> 

Yes this piece is not acceptable as is, nor unit testtable. The
reporting and sleeping needs to be handled in 'virt-install' since it's
really a UI issue. Moving it there will take a bit of work which I was
planning on discussing with Athina after some of the simpler issues were
solved.

> 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.

Thanks for pointing this out, it is important to fix

- Cole




More information about the virt-tools-list mailing list