File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -120,18 +120,21 @@ def compare_version(v1, v2):
120
120
121
121
122
122
def ping_registry (url ):
123
- return ping (url + '/v2/' ) or ping (url + '/v1/_ping' )
123
+ return ping (url + '/v2/' , [ 401 ] ) or ping (url + '/v1/_ping' )
124
124
125
125
126
- def ping (url ):
126
+ def ping (url , valid_4xx_statuses = None ):
127
127
try :
128
128
res = requests .get (url , timeout = 3 )
129
129
except Exception :
130
130
return False
131
131
else :
132
132
# We don't send yet auth headers
133
133
# and a v2 registry will respond with status 401
134
- return res .status_code == 401 or res .status_code < 400
134
+ return (
135
+ res .status_code < 400 or
136
+ (valid_4xx_statuses and res .status_code in valid_4xx_statuses )
137
+ )
135
138
136
139
137
140
def _convert_port_binding (binding ):
You can’t perform that action at this time.
0 commit comments