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

Bug 1641991

Summary: "oc get --ignore-not-found" stops after the first missing object
Product: OpenShift Container Platform Reporter: Mahesh Taru <mtaru>
Component: ocAssignee: Maciej Szulik <maszulik>
Status: CLOSED ERRATA QA Contact: Xingxing Xia <xxia>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.9.0CC: aos-bugs, jokerman, mmccomas, public
Target Milestone: ---   
Target Release: 4.1.0   
Hardware: x86_64   
OS: Linux   
Whiteboard:
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.
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-06-04 10:40:48 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 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