Browse Source

Merge pull request #9851 from Miciah/sdn-check-ignore-errors-from-oc-version

SDN check: Ignore errors from `oc version`
OpenShift Merge Robot 6 years ago
parent
commit
50f6d45d80
1 changed files with 5 additions and 2 deletions
  1. 5 2
      roles/openshift_health_checker/openshift_checks/sdn.py

+ 5 - 2
roles/openshift_health_checker/openshift_checks/sdn.py

@@ -61,8 +61,11 @@ class SDNCheck(OpenShiftCheck):
                 oc_executable = self.get_var('openshift_client_binary',
                                              default='/bin/oc')
                 oc_executable = self.template_var(oc_executable)
-                self.save_command_output('oc-version', [oc_executable,
-                                                        'version'])
+                # The oc executable is not installed on containerized nodes, so
+                # use "2>&1" to capture any error output (such as "command not
+                # found"), and use "|| :" to ignore the exit code.
+                self.save_command_output('oc-version',
+                                         oc_executable + ' version 2>&1 || :')
                 self.register_file('os-version', None,
                                    '/etc/system-release-cpe')
             except OpenShiftCheckException as exc: