Bug 2033167

Summary: oc extract –to option doesn’t create the target directory if it’s not present
Product: OpenShift Container Platform Reporter: Yang Yang <yanyang>
Component: ocAssignee: Arda Guclu <aguclu>
oc sub component: oc QA Contact: zhou ying <yinzhou>
Status: CLOSED ERRATA Docs Contact:
Severity: medium    
Priority: medium CC: aguclu, aos-bugs, mfojtik
Version: 4.10   
Target Milestone: ---   
Target Release: 4.12.0   
Hardware: Unspecified   
OS: Unspecified   
Fixed In Version: Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-01-17 19:46:49 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:

Description Yang Yang 2021-12-16 05:33:21 UTC
Description of problem:

1) oc extract –to doesn’t create the target directory if it’s not present
2) oc extract –to doesn’t check if the file provided is a directory

$ oc extract secret/pull-secret -n openshift-config --confirm --to=/tmp/kkk
error: stat /tmp/kkk: no such file or directory

$ touch /tmp/kkk

$ oc extract secret/pull-secret -n openshift-config --confirm --to=/tmp/kkk
error: .dockerconfigjson: open /tmp/kkk/.dockerconfigjson: not a directory

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

How reproducible:

Steps to Reproduce:

Actual results:
The command fails if the target directory is not present

Expected results:
For better user experience, we’d better have oc to create the target directory if it’s not present

Additional info:

Comment 4 zhou ying 2022-10-19 03:00:51 UTC
can't reproduce the issue now:

[root@localhost ~]# ls /tmp
[root@localhost ~]# oc extract secret/pull-secret -n openshift-config --confirm --to=/tmp/kkk
[root@localhost ~]# ls /tmp
[root@localhost ~]# oc version client
Client Version: 4.12.0-0.nightly-2022-10-18-192348
Kustomize Version: v4.5.7
Server Version: 4.12.0-0.nightly-arm64-2022-10-18-153953
Kubernetes Version: v1.25.2+5bf2e1f

Comment 7 errata-xmlrpc 2023-01-17 19:46:49 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.12.0 bug fix and 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.