Bug 2033167 - oc extract –to option doesn’t create the target directory if it’s not present
Summary: oc extract –to option doesn’t create the target directory if it’s not present
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: oc
Version: 4.10
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: 4.12.0
Assignee: Arda Guclu
QA Contact: zhou ying
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-12-16 05:33 UTC by Yang Yang
Modified: 2023-01-17 19:47 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-01-17 19:46:49 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift oc pull 1248 0 None open Bug 2033167: oc extract: Create target directory if not exist 2022-09-28 10:20:33 UTC
Red Hat Product Errata RHSA-2022:7399 0 None None None 2023-01-17 19:47:09 UTC

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):
4.10.0-0.nightly-2021-12-03-213835


How reproducible:
Always

Steps to Reproduce:
1.
2.
3.

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
/tmp/kkk/.dockerconfigjson
[root@localhost ~]# ls /tmp
kkk
[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.

https://access.redhat.com/errata/RHSA-2022:7399


Note You need to log in before you can comment on or make changes to this bug.