Bug 2192577

Summary: Console errors while using a template without "parameters"
Product: Container Native Virtualization (CNV) Reporter: nijin ashok <nashok>
Component: User ExperienceAssignee: Tal Nisan <tnisan>
Status: VERIFIED --- QA Contact: Guohua Ouyang <gouyang>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 4.12.1CC: gouyang, ycui
Target Milestone: ---   
Target Release: 4.14.0   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
error while creating vm from template with no parameters on 4.14 none

Description nijin ashok 2023-05-02 10:57:35 UTC
Description of problem:

Created a template without "parameters":

~~~
oc get template example -n default
NAME      DESCRIPTION           PARAMETERS    OBJECTS
example   VM template example   0 (all set)   1
~~~

Try creating a VM with this template.

Virtualization => Catalog => Select the template => Customize virtual machine

This fails with the error below:

~~~
Oh no! Something went wrong.

Stack trace:
TypeError: Cannot read properties of undefined (reading 'reduce')
    at https://console-openshift-console.apps.ocp4.shiftvirt.com/api/plugins/kubevirt-plugin/exposed-TemplatesCatalog-chunk.js:1385:82
    at jc (https://console-openshift-console.apps.ocp4.shiftvirt.com/static/vendors~main-chunk-d016eb3bffbfe8cee1da.min.js:254:104246)
    at t.unstable_runWithPriority (https://console-openshift-console.apps.ocp4.shiftvirt.com/static/vendors~main-chunk-d016eb3bffbfe8cee1da.min.js:262:3768)
    at Hi (https://console-openshift-console.apps.ocp4.shiftvirt.com/static/vendors~main-chunk-d016eb3bffbfe8cee1da.min.js:254:44551)
    at Ec (https://console-openshift-console.apps.ocp4.shiftvirt.com/static/vendors~main-chunk-d016eb3bffbfe8cee1da.min.js:254:103709)
    at https://console-openshift-console.apps.ocp4.shiftvirt.com/static/vendors~main-chunk-d016eb3bffbfe8cee1da.min.js:254:103620
    at N (https://console-openshift-console.apps.ocp4.shiftvirt.com/static/vendors~main-chunk-d016eb3bffbfe8cee1da.min.js:262:2828)
    at C.port1.onmessage (https://console-openshift-console.apps.ocp4.shiftvirt.com/static/vendors~main-chunk-d016eb3bffbfe8cee1da.min.js:262:1551)
~~~

Also, try templates => click on template => Parameters:

Fails with the error below:

~~~
Oh no! Something went wrong.

Stack trace:
TypeError: Cannot read properties of undefined (reading 'map')
    at TemplateParametersPage (https://console-openshift-console.apps.ocp4.shiftvirt.com/api/plugins/kubevirt-plugin/exposed-TemplateNavPage-chunk.js:4092:28)
    at na (https://console-openshift-console.apps.ocp4.shiftvirt.com/static/vendors~main-chunk-d016eb3bffbfe8cee1da.min.js:254:58879)
    at Hs (https://console-openshift-console.apps.ocp4.shiftvirt.com/static/vendors~main-chunk-d016eb3bffbfe8cee1da.min.js:254:111315)
    at wc (https://console-openshift-console.apps.ocp4.shiftvirt.com/static/vendors~main-chunk-d016eb3bffbfe8cee1da.min.js:254:98327)
    at Cc (https://console-openshift-console.apps.ocp4.shiftvirt.com/static/vendors~main-chunk-d016eb3bffbfe8cee1da.min.js:254:98255)
    at _c (https://console-openshift-console.apps.ocp4.shiftvirt.com/static/vendors~main-chunk-d016eb3bffbfe8cee1da.min.js:254:98118)
    at pc (https://console-openshift-console.apps.ocp4.shiftvirt.com/static/vendors~main-chunk-d016eb3bffbfe8cee1da.min.js:254:95105)
    at https://console-openshift-console.apps.ocp4.shiftvirt.com/static/vendors~main-chunk-d016eb3bffbfe8cee1da.min.js:254:44774
    at t.unstable_runWithPriority (https://console-openshift-console.apps.ocp4.shiftvirt.com/static/vendors~main-chunk-d016eb3bffbfe8cee1da.min.js:262:3768)
    at Hi (https://console-openshift-console.apps.ocp4.shiftvirt.com/static/vendors~main-chunk-d016eb3bffbfe8cee1da.min.js:254:44551)
~~~

 
Version-Release number of selected component (if applicable):

OpenShift Virtualization 4.12.2

How reproducible:

100 % 


Steps to Reproduce:

1. Create a template without parameters. 
2. Navigate to,

Virtualization => Catalog => Select the template => Customize virtual machine

and 

try templates => click on template => Parameters

The console fails with the above errors.

Actual results:

Console errors while using a template without "parameters"

Expected results:

The console shouldn't crash.

Additional info:

Comment 2 Guohua Ouyang 2023-05-15 01:45:09 UTC
Created attachment 1964556 [details]
error while creating vm from template with no parameters on 4.14

Did a test on 4.14 UI:
1. create the template from YAML
2. remove the parameter section in the yaml
3. create vm from this template in catalog
4. it pops up an error on "Customize Template parameters" step

Comment 3 Guohua Ouyang 2023-05-15 07:56:30 UTC
(In reply to Guohua Ouyang from comment #2)
> Created attachment 1964556 [details]
> error while creating vm from template with no parameters on 4.14
> 
> Did a test on 4.14 UI:
> 1. create the template from YAML
> 2. remove the parameter section in the yaml
> 3. create vm from this template in catalog
> 4. it pops up an error on "Customize Template parameters" step

The 'NAME' parameter is a required one, if keep or add the 'NAME' parameter in the template, the VM is created normally.

Comment 4 Guohua Ouyang 2023-08-01 10:16:55 UTC
verified on kubevirt-console-plugin-rhel9:v4.14.0-2359