Skip to content

Commit 2e64668

Browse files
authored
Python 3 support (refs brthor#10)
1 parent 603c78f commit 2e64668

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

docker_push_ssh/cli.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,8 @@
1616
import socket
1717
import sys
1818
import time
19-
import urllib2
20-
import httplib
2119

22-
from command import Command
20+
from .command import Command
2321

2422

2523
def getLocalIp():
@@ -38,12 +36,16 @@ def waitForSshTunnelInit(retries=20, delay=1.0):
3836
for _ in range(retries):
3937
time.sleep(delay)
4038

41-
try:
42-
response = urllib2.urlopen("http://localhost:5000/v2/", timeout=5)
43-
except (socket.error, urllib2.URLError, httplib.BadStatusLine):
44-
continue
39+
sshCheckCommandResult = Command("docker", [
40+
"exec",
41+
"docker-push-ssh-tunnel",
42+
"wget",
43+
"-O", "/dev/null",
44+
"-q",
45+
"http://localhost:5000/v2"
46+
]).environment_dict(os.environ).execute()
4547

46-
if response.getcode() == 200:
48+
if not sshCheckCommandResult.failed():
4749
return True
4850

4951
return False

0 commit comments

Comments
 (0)