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
208fb036
Kaydet (Commit)
208fb036
authored
Eyl 10, 2013
tarafından
shin-
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Use pseudo-constant for index URL
üst
26933543
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
6 deletions
+7
-6
auth.py
docker/auth.py
+5
-4
test.py
tests/test.py
+2
-2
No files found.
docker/auth.py
Dosyayı görüntüle @
208fb036
...
@@ -18,6 +18,7 @@ import os
...
@@ -18,6 +18,7 @@ import os
import
six
import
six
INDEX_URL
=
'https://index.docker.io/v1/'
def
swap_protocol
(
url
):
def
swap_protocol
(
url
):
if
url
.
startswith
(
'http://'
):
if
url
.
startswith
(
'http://'
):
...
@@ -43,7 +44,7 @@ def resolve_repository_name(repo_name):
...
@@ -43,7 +44,7 @@ def resolve_repository_name(repo_name):
parts
=
repo_name
.
split
(
'/'
,
1
)
parts
=
repo_name
.
split
(
'/'
,
1
)
if
not
'.'
in
parts
[
0
]
and
not
':'
in
parts
[
0
]
and
parts
[
0
]
!=
'localhost'
:
if
not
'.'
in
parts
[
0
]
and
not
':'
in
parts
[
0
]
and
parts
[
0
]
!=
'localhost'
:
# This is a docker index repo (ex: foo/bar or ubuntu)
# This is a docker index repo (ex: foo/bar or ubuntu)
return
'https://index.docker.io/v1/'
,
repo_name
return
INDEX_URL
,
repo_name
if
len
(
parts
)
<
2
:
if
len
(
parts
)
<
2
:
raise
ValueError
(
'Invalid repository name ({0})'
.
format
(
repo_name
))
raise
ValueError
(
'Invalid repository name ({0})'
.
format
(
repo_name
))
...
@@ -55,9 +56,9 @@ def resolve_repository_name(repo_name):
...
@@ -55,9 +56,9 @@ def resolve_repository_name(repo_name):
def
resolve_authconfig
(
authconfig
,
registry
):
def
resolve_authconfig
(
authconfig
,
registry
):
if
registry
==
'https://index.docker.io/v1/'
or
registry
==
''
:
if
registry
==
INDEX_URL
or
registry
==
''
:
# default to the index server
# default to the index server
return
authconfig
[
'Configs'
][
'https://index.docker.io/v1/'
]
return
authconfig
[
'Configs'
][
INDEX_URL
]
# if its not the index server there are three cases:
# if its not the index server there are three cases:
#
#
# 1. this is a full config url -> it should be used as is
# 1. this is a full config url -> it should be used as is
...
@@ -112,7 +113,7 @@ def load_config(root=None):
...
@@ -112,7 +113,7 @@ def load_config(root=None):
if
len
(
buf
)
<
2
:
if
len
(
buf
)
<
2
:
raise
Exception
(
"The Auth config file is empty"
)
raise
Exception
(
"The Auth config file is empty"
)
user
,
pwd
=
decode_auth
(
buf
[
0
])
user
,
pwd
=
decode_auth
(
buf
[
0
])
config_file
[
'Configs'
][
'https://index.docker.io/v1/'
]
=
{
config_file
[
'Configs'
][
INDEX_URL
]
=
{
'Username'
:
user
,
'Username'
:
user
,
'Password'
:
pwd
,
'Password'
:
pwd
,
'Email'
:
buf
[
1
]
'Email'
:
buf
[
1
]
...
...
tests/test.py
Dosyayı görüntüle @
208fb036
...
@@ -383,8 +383,8 @@ class TestLoadConfig(BaseTestCase):
...
@@ -383,8 +383,8 @@ class TestLoadConfig(BaseTestCase):
f
.
write
(
'email = sakuya@scarlet.net'
)
f
.
write
(
'email = sakuya@scarlet.net'
)
f
.
close
()
f
.
close
()
cfg
=
docker
.
auth
.
load_config
(
folder
)
cfg
=
docker
.
auth
.
load_config
(
folder
)
self
.
assertNotEqual
(
cfg
[
'Configs'
][
'https://index.docker.io/v1/'
],
None
)
self
.
assertNotEqual
(
cfg
[
'Configs'
][
docker
.
auth
.
INDEX_URL
],
None
)
cfg
=
cfg
[
'Configs'
][
'https://index.docker.io/v1/'
]
cfg
=
cfg
[
'Configs'
][
docker
.
auth
.
INDEX_URL
]
self
.
assertEqual
(
cfg
[
'Username'
],
'sakuya'
)
self
.
assertEqual
(
cfg
[
'Username'
],
'sakuya'
)
self
.
assertEqual
(
cfg
[
'Password'
],
'izayoi'
)
self
.
assertEqual
(
cfg
[
'Password'
],
'izayoi'
)
self
.
assertEqual
(
cfg
[
'Email'
],
'sakuya@scarlet.net'
)
self
.
assertEqual
(
cfg
[
'Email'
],
'sakuya@scarlet.net'
)
...
...
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