Hide Forgot
Description of problem: Can't specify the dir by `oc image extract --dir` Version-Release number of selected component (if applicable): Client Version: 4.7.0-202011302220.p0-6775115 Kubernetes Version: v1.11.0+d4cacc0 How reproducible: Always Steps to Reproduce: 1. Current dir is :/home/test 2, Run command `oc image extract --dir=/home/test/1203 registry.redhat.io/openshift4/ose-must-gather:latest --filter-by-os='linux/amd64' -p` Actual results: 2. Will try to extract to current dir, not the --dir specify. error: directory /home/test must be empty, pass --confirm to overwrite contents of directory Expected results: 1. Can specify the directory on disk, and extract to --dir . Additional info:
This bug hasn't had any activity in the last 30 days. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're marking this bug as "LifecycleStale" and decreasing the severity/priority. If you have further information on the current state of the bug, please update it, otherwise this bug can be closed in about 7 days. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. Additionally, you can add LifecycleFrozen into Keywords if you think this bug should never be marked as stale. Please consult with bug assignee before you do that.
The issue still exist.
I'll be looking to resolve this in the upcoming sprint.
From the PR review, (https://github.com/openshift/oc/pull/685) I believe this is another case of confusing flags and better documentation needed. The 'extract' command is always meant to extract to the current directory. The flag description for --dir is confusing at best. '--dir='': The directory on disk that file:// images will be copied under' should be improved. With extract, it's easy to assume --dir would be the directory one would like to extract into. I'll be improving the help for this command, working on it this sprint.
I've determined the '--dir' and '--from-dir' flags are the source of much confusion and in some cases (such as this, with extract) aren't wired properly. I've pushed a change that will be up for review in https://github.com/openshift/oc/pull/729: oc image extract: - remove --dir flag, might add flag to allow to extract into other directory other than current (in a followup PR) oc image info: - the --dir flag should be updated to be `--from-dir` to allow to read from a directory on disk (other than `v2` in current directory) oc image append: - remove the --dir flag - keep the `--from-dir` flag to allow to read from a directory on disk (other than `v2` in current directory) - Add the `--to-dir` flag to replace the `--dir`
*** Bug 1906277 has been marked as a duplicate of this bug. ***
No nightly has been accepted for last 2 days, will check this on monday.
According to the PR i see that the help has been modified, will move the bug to verified state once a nightly build has been accepted.
Verified with the build below and i see that oc image extract help has been updated. Based on that moving bug to verified state. [knarra@knarra openshift-client-linux-4.8.0-0.nightly-2021-02-21-102854]$ ./oc version -o yaml clientVersion: buildDate: "2021-02-20T04:51:51Z" compiler: gc gitCommit: 13f3e4b73df9b0853979e4130adf756784afe96f gitTreeState: clean gitVersion: 4.8.0-202102200123.p0-13f3e4b goVersion: go1.15.5 major: "" minor: "" platform: linux/amd64 openshiftVersion: 4.8.0-0.nightly-2021-02-21-102854 releaseClientVersion: 4.8.0-0.nightly-2021-02-21-102854 serverVersion: buildDate: "2021-02-19T22:50:50Z" compiler: gc gitCommit: 01ab7fd5278756572d4a1dd3101f0a6d5c969824 gitTreeState: clean gitVersion: v1.20.0+01ab7fd goVersion: go1.15.5 major: "1" minor: "20" platform: linux/amd64 Unless the --path flag is passed, image contents will be extracted into the current directory. Pass images to extract as arguments. The --path flag allows you to define multipl Examples: # Extract the busybox image into the current directory oc image extract docker.io/library/busybox:latest # Extract the busybox image into a designated directory (must exist) oc image extract docker.io/library/busybox:latest --path /:/tmp/busybox # Extract the busybox image into the current directory for linux/s390x platform # Note: Wildcard filter is not supported with extract. Pass a single os/arch to extract. oc image extract docker.io/library/busybox:latest --filter-by-os=linux/s390x # Extract a single file from the image into the current directory oc image extract docker.io/library/centos:7 --path /bin/bash:. # Extract all .repo files from the image's /etc/yum.repos.d/ folder into the current directory oc image extract docker.io/library/centos:7 --path /etc/yum.repos.d/*.repo:. # Extract all .repo files from the image's /etc/yum.repos.d/ folder into a designated directory (must exist) # this results in /tmp/yum.repos.d/*.repo on local system oc image extract docker.io/library/centos:7 --path /etc/yum.repos.d/*.repo:/tmp/yum.repos.d # Extract an image stored on disk into the current directory ($(pwd)/v2/busybox/blobs,manifests exists) # --confirm is required because current directory is not empty oc image extract file://busybox:local --confirm # Extract an image stored on disk in a directory other than $(pwd)/v2 into the current directory # --confirm is required because current directory is not empty ($(pwd)/busybox-mirror-dir/v2/busybox exists) oc image extract file://busybox:local --dir busybox-mirror-dir --confirm # Extract an image stored on disk in a directory other than $(pwd)/v2 into a designated directory (must exist) oc image extract file://busybox:local --dir busybox-mirror-dir --path /:/tmp/busybox # Extract the last layer in the image oc image extract docker.io/library/centos:7[-1] # Extract the first three layers of the image oc image extract docker.io/library/centos:7[:3] # Extract the last three layers of the image oc image extract docker.io/library/centos:7[-3:]
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.8.2 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-2021:2438