Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1939845

Summary: Creating manifests API should not allow folder in the "file_name"
Product: OpenShift Container Platform Reporter: Constantin Vultur <cvultur>
Component: assisted-installerAssignee: Moti Asayag <masayag>
assisted-installer sub component: assisted-service QA Contact: Yuri Obshansky <yobshans>
Status: CLOSED CURRENTRELEASE Docs Contact:
Severity: medium    
Priority: medium CC: aos-bugs, lgamliel, sasha
Version: 4.8   
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: OCP-Metal-v1.0.18.1 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-08-28 08:45:59 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:
Embargoed:

Description Constantin Vultur 2021-03-17 08:37:30 UTC
Description of problem:
Creating manifests that include folder name in the "file_name" parameter will encounter install problems

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


How reproducible:


Steps to Reproduce:
1. Using https://github.com/openshift/assisted-service/blob/master/docs/user-guide/install-customization.md#manifests create a manifest
2. In my case the filename was: 99-openshift-machineconfig-master-registry.yaml
3. Start cluster installation


Actual results:
Installation fails with 
Failed generating kubeconfig files for cluster 6c648ad3-f6a5-4c18-abd4-99bca732aa7a: open /data/6c648ad3-f6a5-4c18-abd4-99bca732aa7a/manifests/openshift/99-openshift-machineconfig-master-registry.yaml: no such file or directory.
Reset the installation process to return to the configuration and try again. Some hosts may need to be re-registered by rebooting into the Discovery ISO.

In the service logs :
Failed to download manifest 6c648ad3-f6a5-4c18-abd4-99bca732aa7a/manifests/manifests/openshift/99-openshift-machineconfig-master-registry.yaml to working dir for cluster 6c648ad3-f6a5-4c18-abd4-99bca732aa7a" func="github.com/openshift/assisted-service/internal/ignition.(*installerGenerator).Generate" file="/go/src/github.com/openshift/origin/internal/ignition/ignition.go:196" error="open /data/6c648ad3-f6a5-4c18-abd4-99bca732aa7a/manifests/openshift/99-openshift-machineconfig-master-registry.yaml: no such file or directory

Expected results:
Installation to work fine.

Additional info:
Investigation with developer revealed that the correct API call should have been:

file=99-openshift-machineconfig-master-registry.yaml

curl \
    --header "Content-Type: application/json" \
    --header "Authorization: Bearer $TOKEN" \
    --request POST \
    --data "{\"file_name\":\"$file\", \"folder\": \"openshift\", \"content\":\"$content\"}" \

The API call should include "folder" property

This bug is to fix the API, so that folder should not be allowed in the file_name. I will open another doc bug for correcting the documentation

Comment 1 Constantin Vultur 2021-03-31 21:50:15 UTC
Verified:

Now API properly denies folder name in "file_name" param

    "json": {
        "code": 605,
        "message": "file_name in body should match '^[^/]*\\.(yaml|yml|json)$'"
    },