kxr / o-must-gather

oc like tool that works with must-gather rather than OpenShift API
GNU General Public License v3.0
161 stars 73 forks source link

add yaml.constructor.ConstructorError capture #85

Open jianzhangbjz opened 2 months ago

jianzhangbjz commented 2 months ago

To solve issue #84

jiazha-mac:o-must-gather jiazha$ omg use ~/must-gather/must-gather-tp3 
WARNING Resource loaded from /Users/jiazha/must-gather/must-gather-tp3/quay-io-openshift-release-dev-ocp-v4-0-art-dev-sha256-2a156a46709ac22dc63b1231c7450db73a2d90aff74d96e2a42cf040f2f8c78f/cluster-scoped-resources/apiextensions.k8s.io/customresourcedefinitions/alertmanagerconfigs.monitoring.rhobs.yaml is not valid
WARNING Resource loaded from /Users/jiazha/must-gather/must-gather-tp3/quay-io-openshift-release-dev-ocp-v4-0-art-dev-sha256-2a156a46709ac22dc63b1231c7450db73a2d90aff74d96e2a42cf040f2f8c78f/cluster-scoped-resources/apiextensions.k8s.io/customresourcedefinitions/alertmanagerconfigs.monitoring.coreos.com.yaml is not valid
Selected must-gather: /Users/jiazha/must-gather/must-gather-tp3/quay-io-openshift-release-dev-ocp-v4-0-art-dev-sha256*
            Projects: 79
             API URL: ['https://api.qe-daily-417-0906.qe.devcluster.openshift.com:6443']
            Platform: ['AWS']
          Cluster ID: ['e640061f-6221-4c53-a21c-e40da567c34c']
     Desired Version: ['4.17.0-0.nightly-2024-09-05-082755']

     Current Project: openshift-catalogd

jiazha-mac:o-must-gather jiazha$ omg get clustercatalog
No resources found
jianzhangbjz commented 2 months ago
             # yaml load/parse failed
             # try skipping lines from the bottom
             # Until we are able to load the yaml file
             # We will try until > 1 lines are left

I commented the above code since it runs slow and is not much help. It's better to skip the whole file and pop a waring.

ERROR lines_skipped 6637, lines_total 6800
ERROR Skipped 6638/6800 lines from the end of /Users/jiazha/must-gather/must-gather-tp3/quay-io-openshift-release-dev-ocp-v4-0-art-dev-sha256-2a156a46709ac22dc63b1231c7450db73a2d90aff74d96e2a42cf040f2f8c78f/cluster-scoped-resources/apiextensions.k8s.io/customresourcedefinitions/alertmanagerconfigs.monitoring.rhobs.yaml to the load the yaml file properly
...
ERROR lines_skipped 6601, lines_total 13288
ERROR lines_skipped 6602, lines_total 13288
ERROR lines_skipped 6603, lines_total 13288
^C
Aborted!
jianzhangbjz commented 2 months ago

Hi @kxr , could you help have a review when you get a chance? Thanks!