Skip to content

Commit

Permalink
Retry on ssl.SSLError in vm_util - this resolves test flakiness (kube…
Browse files Browse the repository at this point in the history
…flow#987)

* Handle ssl.SSLError in vm_util

This causes test flakiness

* Update
  • Loading branch information
Ankush Agarwal authored and k8s-ci-robot committed Jun 13, 2018
1 parent e27bb2f commit 3eb2e2a
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions testing/vm_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import datetime
import logging
import os
import ssl
import subprocess
import time
import uuid
Expand Down Expand Up @@ -37,13 +38,16 @@ def wait_for_operation(client,
"""
endtime = datetime.datetime.now() + timeout
while True:
if zone:
op = client.zoneOperations().get(
project=project, zone=zone, operation=op_id).execute()
else:
op = client.globalOperations().get(project=project,
operation=op_id).execute()

try:
if zone:
op = client.zoneOperations().get(
project=project, zone=zone, operation=op_id).execute()
else:
op = client.globalOperations().get(project=project,
operation=op_id).execute()
except ssl.SSLError as e:
logging.error("Ignoring error %s", e)
continue
status = op.get("status", "")
# Need to handle other status's
if status == "DONE":
Expand Down Expand Up @@ -97,4 +101,4 @@ def execute_script(project, zone, vm, script):
script, target, "--zone=" + zone])

util.run(["gcloud", "compute", "--project=" + project, "ssh",
"--zone=" + zone, vm, "--", "chmod a+rx " + target_path + " && " + target_path])
"--zone=" + zone, vm, "--", "chmod a+rx " + target_path + " && " + target_path])

0 comments on commit 3eb2e2a

Please sign in to comment.