Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
docker-py
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
docker-py
Commits
afba52dc
Kaydet (Commit)
afba52dc
authored
Eyl 13, 2013
tarafından
shin-
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Added utils.ping and used to expand registry URL (http VS https)
üst
addecd49
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
4 deletions
+17
-4
auth.py
docker/auth.py
+4
-1
utils.py
docker/utils.py
+13
-3
No files found.
docker/auth.py
Dosyayı görüntüle @
afba52dc
...
@@ -18,6 +18,8 @@ import os
...
@@ -18,6 +18,8 @@ import os
import
six
import
six
import
utils
INDEX_URL
=
'https://index.docker.io/v1/'
INDEX_URL
=
'https://index.docker.io/v1/'
def
swap_protocol
(
url
):
def
swap_protocol
(
url
):
...
@@ -33,7 +35,8 @@ def expand_registry_url(hostname):
...
@@ -33,7 +35,8 @@ def expand_registry_url(hostname):
if
'/'
not
in
hostname
[
9
:]:
if
'/'
not
in
hostname
[
9
:]:
hostname
=
hostname
+
'/v1/'
hostname
=
hostname
+
'/v1/'
return
hostname
return
hostname
#FIXME: ping https then fallback to http
if
utils
.
ping
(
'https://'
+
hostname
+
'_ping'
):
return
'https://'
+
hostname
+
'/v1/'
return
'http://'
+
hostname
+
'/v1/'
return
'http://'
+
hostname
+
'/v1/'
...
...
docker/utils.py
Dosyayı görüntüle @
afba52dc
...
@@ -12,10 +12,12 @@
...
@@ -12,10 +12,12 @@
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
import
six
import
tarfile
import
tarfile
import
tempfile
import
tempfile
import
requests
import
six
if
six
.
PY3
:
if
six
.
PY3
:
from
io
import
StringIO
from
io
import
StringIO
else
:
else
:
...
@@ -44,5 +46,14 @@ def tar(self, path):
...
@@ -44,5 +46,14 @@ def tar(self, path):
f
.
seek
(
0
)
f
.
seek
(
0
)
return
f
return
f
def
compare_version
(
v1
,
v2
):
def
compare_version
(
v1
,
v2
):
return
float
(
v2
)
-
float
(
v1
)
return
float
(
v2
)
-
float
(
v1
)
\ No newline at end of file
def
ping
(
url
):
try
:
res
=
requests
.
get
(
url
)
return
res
.
status
>=
400
except
Exception
:
return
False
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment