瀏覽代碼

docker_image_availability: timeout skopeo inspect

Set a 10 second timeout when using skopeo to inspect remote registries,
so that it does not wait for a tcp timeout to fail if they are unreachable.
Luke Meyer 7 年之前
父節點
當前提交
acf014f461
共有 1 個文件被更改,包括 4 次插入1 次删除
  1. 4 1
      roles/openshift_health_checker/openshift_checks/docker_image_availability.py

+ 4 - 1
roles/openshift_health_checker/openshift_checks/docker_image_availability.py

@@ -168,7 +168,10 @@ class DockerImageAvailability(DockerHostMixin, OpenShiftCheck):
             registries = [registry]
 
         for registry in registries:
-            args = {"_raw_params": "skopeo inspect --tls-verify=false docker://{}/{}".format(registry, image)}
+            args = {
+                "_raw_params": "timeout 10 skopeo inspect --tls-verify=false "
+                               "docker://{}/{}".format(registry, image)
+            }
             result = self.execute_module("command", args)
             if result.get("rc", 0) == 0 and not result.get("failed"):
                 return True