Bug 1641991 - "oc get --ignore-not-found" stops after the first missing object
Summary: "oc get --ignore-not-found" stops after the first missing object
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: oc
Version: 3.9.0
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: ---
: 4.1.0
Assignee: Maciej Szulik
QA Contact: Xingxing Xia
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-10-23 10:27 UTC by Mahesh Taru
Modified: 2019-06-04 10:40 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: --ignore-not-found flag was ignored when processing results. Consequence: oc get stopped on first not found object. Fix: Properly interpret value of --ignore-not-found flag. Result: Command works as expected when --ignore-not-found flag is passed.
Clone Of:
Environment:
Last Closed: 2019-06-04 10:40:48 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2019:0758 None None None 2019-06-04 10:40:56 UTC

Description Mahesh Taru 2018-10-23 10:27:00 UTC
Description of problem:
The "oc get" command has an "--ignore-not-found" option. Based on its description one would expect that all existing objects with the given names would be listed while no error would be produced for non-existent objects. What happens instead is that only objects until the first non-existent object are listed.

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


How reproducible:
Always

Steps to Reproduce:
1. On OCP 3.9 cluster create few PV's for ex: ruby, gluster.
2. Try to list PV's

$ oc get pv -o name --ignore-not-found ruby gluster
persistentvolume/ruby
persistentvolume/gluster

This will show these PV's as both are present on cluster.

3. Now try same command by adding name of PV's which no more exist on cluster.
For ex:

$ oc get pv -o name --ignore-not-found ruby nfs gluster ignoreme
persistentvolume/ruby

In this case nfs and ignoreme PV's are not present on cluster.

Actual results:
Only objects until the first non-existent object are listed.

Expected results:
Should list all existent objects.

Additional info:
Issue is specific to option --ignore-not-found. Same behaviour observed with pods.

i.e oc get pods -o name --ignore-not-found <pod-names>

Comment 2 Juan Vallejo 2018-10-26 22:49:15 UTC
Origin PR: https://github.com/openshift/origin/pull/21369

Comment 3 Juan Vallejo 2018-10-26 22:49:48 UTC
Kubernetes PR: https://github.com/kubernetes/kubernetes/pull/70311

Comment 4 Juan Vallejo 2018-10-30 13:30:53 UTC
Origin and Upstream PRs have merged. Moving to MODIFIED. This fix will be released as part of 4.0

Comment 6 Xingxing Xia 2018-12-03 07:24:26 UTC
Verified in v4.0.0-0.80.0
[root@ip-172-18-0-211 ~]# oc get pv my-pv non-exist-1 non-exist-2 regpv-volume  --ignore-not-found
NAME           CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS    CLAIM                  STORAGECLASS   REASON    AGE
my-pv          10G        RWX            Retain           Bound     xxia-proj/my-claim-2                            58m
NAME           CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS    CLAIM                  STORAGECLASS   REASON    AGE
regpv-volume   17G        RWX            Retain           Bound     default/regpv-claim                             5h

Comment 10 errata-xmlrpc 2019-06-04 10:40:48 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, 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/RHBA-2019:0758


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