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
fc481c4c
Kaydet (Commit)
fc481c4c
authored
Eyl 16, 2016
tarafından
Joffrey F
Kaydeden (comit)
GitHub
Eyl 16, 2016
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge pull request #1220 from docker/1.10.3-release
1.10.3 release
üst
e8338815
64fba723
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
86 additions
and
18 deletions
+86
-18
auth.py
docker/auth/auth.py
+12
-1
client.py
docker/client.py
+11
-4
constants.py
docker/constants.py
+1
-0
npipeconn.py
docker/transport/npipeconn.py
+6
-4
unixconn.py
docker/transport/unixconn.py
+13
-7
version.py
docker/version.py
+1
-1
change_log.md
docs/change_log.md
+17
-0
auth_test.py
tests/unit/auth_test.py
+25
-1
No files found.
docker/auth/auth.py
Dosyayı görüntüle @
fc481c4c
...
...
@@ -174,6 +174,15 @@ def parse_auth(entries, raise_on_error=False):
'Invalid configuration for registry {0}'
.
format
(
registry
)
)
return
{}
if
'identitytoken'
in
entry
:
log
.
debug
(
'Found an IdentityToken entry for registry {0}'
.
format
(
registry
))
conf
[
registry
]
=
{
'IdentityToken'
:
entry
[
'identitytoken'
]
}
continue
# Other values are irrelevant if we have a token, skip.
if
'auth'
not
in
entry
:
# Starting with engine v1.11 (API 1.23), an empty dictionary is
# a valid value in the auths config.
...
...
@@ -182,13 +191,15 @@ def parse_auth(entries, raise_on_error=False):
'Auth data for {0} is absent. Client might be using a '
'credentials store instead.'
)
return
{}
conf
[
registry
]
=
{}
continue
username
,
password
=
decode_auth
(
entry
[
'auth'
])
log
.
debug
(
'Found entry (registry={0}, username={1})'
.
format
(
repr
(
registry
),
repr
(
username
))
)
conf
[
registry
]
=
{
'username'
:
username
,
'password'
:
password
,
...
...
docker/client.py
Dosyayı görüntüle @
fc481c4c
...
...
@@ -40,7 +40,8 @@ class Client(
api
.
VolumeApiMixin
):
def
__init__
(
self
,
base_url
=
None
,
version
=
None
,
timeout
=
constants
.
DEFAULT_TIMEOUT_SECONDS
,
tls
=
False
,
user_agent
=
constants
.
DEFAULT_USER_AGENT
):
user_agent
=
constants
.
DEFAULT_USER_AGENT
,
num_pools
=
constants
.
DEFAULT_NUM_POOLS
):
super
(
Client
,
self
)
.
__init__
()
if
tls
and
not
base_url
:
...
...
@@ -58,7 +59,9 @@ class Client(
base_url
,
constants
.
IS_WINDOWS_PLATFORM
,
tls
=
bool
(
tls
)
)
if
base_url
.
startswith
(
'http+unix://'
):
self
.
_custom_adapter
=
UnixAdapter
(
base_url
,
timeout
)
self
.
_custom_adapter
=
UnixAdapter
(
base_url
,
timeout
,
num_pools
=
num_pools
)
self
.
mount
(
'http+docker://'
,
self
.
_custom_adapter
)
self
.
_unmount
(
'http://'
,
'https://'
)
self
.
base_url
=
'http+docker://localunixsocket'
...
...
@@ -68,7 +71,9 @@ class Client(
'The npipe:// protocol is only supported on Windows'
)
try
:
self
.
_custom_adapter
=
NpipeAdapter
(
base_url
,
timeout
)
self
.
_custom_adapter
=
NpipeAdapter
(
base_url
,
timeout
,
num_pools
=
num_pools
)
except
NameError
:
raise
errors
.
DockerException
(
'Install pypiwin32 package to enable npipe:// support'
...
...
@@ -80,7 +85,9 @@ class Client(
if
isinstance
(
tls
,
TLSConfig
):
tls
.
configure_client
(
self
)
elif
tls
:
self
.
_custom_adapter
=
ssladapter
.
SSLAdapter
()
self
.
_custom_adapter
=
ssladapter
.
SSLAdapter
(
num_pools
=
num_pools
)
self
.
mount
(
'https://'
,
self
.
_custom_adapter
)
self
.
base_url
=
base_url
...
...
docker/constants.py
Dosyayı görüntüle @
fc481c4c
...
...
@@ -15,3 +15,4 @@ INSECURE_REGISTRY_DEPRECATION_WARNING = \
IS_WINDOWS_PLATFORM
=
(
sys
.
platform
==
'win32'
)
DEFAULT_USER_AGENT
=
"docker-py/{0}"
.
format
(
version
)
DEFAULT_NUM_POOLS
=
25
docker/transport/npipeconn.py
Dosyayı görüntüle @
fc481c4c
import
six
import
requests.adapters
from
..
import
constants
from
.npipesocket
import
NpipeSocket
if
six
.
PY3
:
...
...
@@ -33,9 +34,9 @@ class NpipeHTTPConnection(httplib.HTTPConnection, object):
class
NpipeHTTPConnectionPool
(
urllib3
.
connectionpool
.
HTTPConnectionPool
):
def
__init__
(
self
,
npipe_path
,
timeout
=
60
):
def
__init__
(
self
,
npipe_path
,
timeout
=
60
,
maxsize
=
10
):
super
(
NpipeHTTPConnectionPool
,
self
)
.
__init__
(
'localhost'
,
timeout
=
timeout
'localhost'
,
timeout
=
timeout
,
maxsize
=
maxsize
)
self
.
npipe_path
=
npipe_path
self
.
timeout
=
timeout
...
...
@@ -47,11 +48,12 @@ class NpipeHTTPConnectionPool(urllib3.connectionpool.HTTPConnectionPool):
class
NpipeAdapter
(
requests
.
adapters
.
HTTPAdapter
):
def
__init__
(
self
,
base_url
,
timeout
=
60
):
def
__init__
(
self
,
base_url
,
timeout
=
60
,
num_pools
=
constants
.
DEFAULT_NUM_POOLS
):
self
.
npipe_path
=
base_url
.
replace
(
'npipe://'
,
''
)
self
.
timeout
=
timeout
self
.
pools
=
RecentlyUsedContainer
(
10
,
dispose_func
=
lambda
p
:
p
.
close
()
num_pools
,
dispose_func
=
lambda
p
:
p
.
close
()
)
super
(
NpipeAdapter
,
self
)
.
__init__
()
...
...
docker/transport/unixconn.py
Dosyayı görüntüle @
fc481c4c
...
...
@@ -2,6 +2,8 @@ import six
import
requests.adapters
import
socket
from
..
import
constants
if
six
.
PY3
:
import
http.client
as
httplib
else
:
...
...
@@ -12,6 +14,7 @@ try:
except
ImportError
:
import
urllib3
RecentlyUsedContainer
=
urllib3
.
_collections
.
RecentlyUsedContainer
...
...
@@ -32,28 +35,31 @@ class UnixHTTPConnection(httplib.HTTPConnection, object):
class
UnixHTTPConnectionPool
(
urllib3
.
connectionpool
.
HTTPConnectionPool
):
def
__init__
(
self
,
base_url
,
socket_path
,
timeout
=
60
):
def
__init__
(
self
,
base_url
,
socket_path
,
timeout
=
60
,
maxsize
=
10
):
super
(
UnixHTTPConnectionPool
,
self
)
.
__init__
(
'localhost'
,
timeout
=
timeout
'localhost'
,
timeout
=
timeout
,
maxsize
=
maxsize
)
self
.
base_url
=
base_url
self
.
socket_path
=
socket_path
self
.
timeout
=
timeout
def
_new_conn
(
self
):
return
UnixHTTPConnection
(
self
.
base_url
,
self
.
socket_path
,
self
.
timeout
)
return
UnixHTTPConnection
(
self
.
base_url
,
self
.
socket_path
,
self
.
timeout
)
class
UnixAdapter
(
requests
.
adapters
.
HTTPAdapter
):
def
__init__
(
self
,
socket_url
,
timeout
=
60
):
def
__init__
(
self
,
socket_url
,
timeout
=
60
,
num_pools
=
constants
.
DEFAULT_NUM_POOLS
):
socket_path
=
socket_url
.
replace
(
'http+unix://'
,
''
)
if
not
socket_path
.
startswith
(
'/'
):
socket_path
=
'/'
+
socket_path
self
.
socket_path
=
socket_path
self
.
timeout
=
timeout
self
.
pools
=
RecentlyUsedContainer
(
10
,
dispose_func
=
lambda
p
:
p
.
close
())
self
.
pools
=
RecentlyUsedContainer
(
num_pools
,
dispose_func
=
lambda
p
:
p
.
close
()
)
super
(
UnixAdapter
,
self
)
.
__init__
()
def
get_connection
(
self
,
url
,
proxies
=
None
):
...
...
docker/version.py
Dosyayı görüntüle @
fc481c4c
version
=
"1.10.
2
"
version
=
"1.10.
3
"
version_info
=
tuple
([
int
(
d
)
for
d
in
version
.
split
(
"-"
)[
0
]
.
split
(
"."
)])
docs/change_log.md
Dosyayı görüntüle @
fc481c4c
Change Log
==========
1.
10.3
------
[
List of PRs / issues for this release
](
https://github.com/docker/docker-py/issues?q=milestone%3A1.10.3+is%3Aclosed
)
### Bugfixes
*
Fixed an issue where identity tokens in configuration files weren't handled
by the library.
### Miscellaneous
*
Increased the default number of connection pools from 10 to 25. This number
can now be configured using the
`num_pools`
parameter in the
`Client`
constructor.
1.10.2
------
...
...
tests/unit/auth_test.py
Dosyayı görüntüle @
fc481c4c
...
...
@@ -460,4 +460,28 @@ class LoadConfigTest(base.Cleanup, base.BaseTestCase):
json
.
dump
(
config
,
f
)
cfg
=
auth
.
load_config
(
dockercfg_path
)
assert
cfg
==
{}
assert
cfg
==
{
'scarlet.net'
:
{}}
def
test_load_config_identity_token
(
self
):
folder
=
tempfile
.
mkdtemp
()
registry
=
'scarlet.net'
token
=
'1ce1cebb-503e-7043-11aa-7feb8bd4a1ce'
self
.
addCleanup
(
shutil
.
rmtree
,
folder
)
dockercfg_path
=
os
.
path
.
join
(
folder
,
'config.json'
)
auth_entry
=
encode_auth
({
'username'
:
'sakuya'
})
.
decode
(
'ascii'
)
config
=
{
'auths'
:
{
registry
:
{
'auth'
:
auth_entry
,
'identitytoken'
:
token
}
}
}
with
open
(
dockercfg_path
,
'w'
)
as
f
:
json
.
dump
(
config
,
f
)
cfg
=
auth
.
load_config
(
dockercfg_path
)
assert
registry
in
cfg
cfg
=
cfg
[
registry
]
assert
'IdentityToken'
in
cfg
assert
cfg
[
'IdentityToken'
]
==
token
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