Bug 1999619

Summary: cloudinit is malformatted if a user sets a password during VM creation flow
Product: OpenShift Container Platform Reporter: Ruth Netser <rnetser>
Component: Console Kubevirt PluginAssignee: Matan Schatzman <mschatzm>
Status: CLOSED ERRATA QA Contact: Leon Kladnitsky <lkladnit>
Severity: urgent Docs Contact:
Priority: medium    
Version: 4.9CC: aos-bugs, gouyang, lkladnit, yzamir
Target Milestone: ---   
Target Release: 4.10.0   
Hardware: Unspecified   
OS: Unspecified   
Fixed In Version: Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-03-10 16:06:30 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 2023285    

Description Ruth Netser 2021-08-31 12:54:39 UTC
Description of problem:
Setting a password during VM creation in the customization flow will result in a malformed cloudinit section; password will not be set.

Version-Release number of selected component (if applicable):
OCP 4.9.0-fc.0, CNV 4.9.0

How reproducible:

Steps to Reproduce:
1. Create a VM from template
2. Select the customize flow
3. Set a password in the cloudinit screen

Actual results:
- `#cloud-config` line is removed.
- When the VM is started, the following error appears:
2021-08-31 08:32:02,407 - __init__.py[WARNING]: Unhandled non-multipart (text/x-not-multipart) userdata: 'user: cloud-user\npasswor...'
- It is impossible to login with the selected password.

Expected results:
cloudinit should be well formatted.

Additional info:
==== Wrong format - VM created with customization ====
        - cloudInitNoCloud:
            userData: |
              user: fedora
              password: fedora
                expire: false
                - ''

==== Good format - VM created without customization ====

        - cloudInitNoCloud:
            userData: |-
              user: fedora
              password: fyl3-q66d-p3ik
              chpasswd: { expire: False }
          name: cloudinitdisk

Comment 4 errata-xmlrpc 2022-03-10 16:06:30 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: OpenShift Container Platform 4.10.3 security update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.