Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Await SSH tunnel init using docker exec + exit code #10

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions docker_push_ssh/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,16 @@ def waitForSshTunnelInit(retries=20, delay=1.0):
for _ in range(retries):
time.sleep(delay)

try:
response = urllib2.urlopen("http://localhost:5000/v2/", timeout=5)
except (socket.error, urllib2.URLError, httplib.BadStatusLine):
continue

if response.getcode() == 200:
sshCheckCommandResult = Command("docker", [
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does wget have a default timeout? Is it possible to match the 5 second timeout as was the previous behavior?

"exec",
"docker-push-ssh-tunnel",
"wget",
"-O", "/dev/null",
"-q",
"http://localhost:5000/v2"
]).environment_dict(os.environ).execute()

if not sshCheckCommandResult.failed():
return True

return False
Expand Down