Uploaded image for project: 'OpenShift Bugs'
  1. OpenShift Bugs
  2. OCPBUGS-30960

oc CLI return code for `oc get pod -l <selector>` is 0 when no pod is found

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Normal Normal
    • None
    • 4.13
    • oc
    • None
    • No
    • False
    • Hide

      None

      Show
      None

      Description of problem:

          when running the oc get pod command, and the request pod does not exist, the command will have a RC of 1 if specifying a name but a RC of 0 if specifying a label with the -l option

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

      [lgiorgi@fedora ~]$ oc version
      Client Version: 4.13.0
      Kustomize Version: v4.5.7
      Server Version: 4.12.7
      Kubernetes Version: v1.25.4+18eadca
      

      How reproducible:

          Always

      Steps to Reproduce:

          1.Run `oc get pod -l <non-existing-selector>`
          2.Run `echo $?`
          3.See RC is 0 (incorrect)
          4.Run `oc get pod <non-existing-pod>`
          5.Run `echo $?`
          6.See RC is 1 (correct)     

      Actual results:

          oc get pod -l <selector> returns an RC of 0 when the pod does not exist

      Expected results:

          RC should be 1

      Additional info:

          

            aguclu@redhat.com Arda Guclu
            rhn-support-lgiorgi Luca Giorgi
            Workloads Team Bot Account Workloads Team Bot Account
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: