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
b180b877
Kaydet (Commit)
b180b877
authored
Ock 31, 2018
tarafından
Joffrey F
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Remove parameters and methods marked as deprecated
Signed-off-by:
Joffrey F
<
joffrey@docker.com
>
üst
42b2548e
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
10 additions
and
119 deletions
+10
-119
container.py
docker/api/container.py
+0
-35
daemon.py
docker/api/daemon.py
+1
-8
image.py
docker/api/image.py
+8
-22
service.py
docker/api/service.py
+0
-13
containers.py
docker/types/containers.py
+0
-15
__init__.py
docker/utils/__init__.py
+1
-1
utils.py
docker/utils/utils.py
+0
-25
No files found.
docker/api/container.py
Dosyayı görüntüle @
b180b877
import
six
import
six
import
warnings
from
datetime
import
datetime
from
datetime
import
datetime
from
..
import
errors
from
..
import
errors
...
@@ -204,40 +203,6 @@ class ContainerApiMixin(object):
...
@@ -204,40 +203,6 @@ class ContainerApiMixin(object):
x
[
'Id'
]
=
x
[
'Id'
][:
12
]
x
[
'Id'
]
=
x
[
'Id'
][:
12
]
return
res
return
res
@utils.check_resource
(
'container'
)
def
copy
(
self
,
container
,
resource
):
"""
Identical to the ``docker cp`` command. Get files/folders from the
container.
**Deprecated for API version >= 1.20.** Use
:py:meth:`~ContainerApiMixin.get_archive` instead.
Args:
container (str): The container to copy from
resource (str): The path within the container
Returns:
The contents of the file as a string
Raises:
:py:class:`docker.errors.APIError`
If the server returns an error.
"""
if
utils
.
version_gte
(
self
.
_version
,
'1.20'
):
warnings
.
warn
(
'APIClient.copy() is deprecated for API version >= 1.20, '
'please use get_archive() instead'
,
DeprecationWarning
)
res
=
self
.
_post_json
(
self
.
_url
(
"/containers/{0}/copy"
,
container
),
data
=
{
"Resource"
:
resource
},
stream
=
True
)
self
.
_raise_for_status
(
res
)
return
res
.
raw
def
create_container
(
self
,
image
,
command
=
None
,
hostname
=
None
,
user
=
None
,
def
create_container
(
self
,
image
,
command
=
None
,
hostname
=
None
,
user
=
None
,
detach
=
False
,
stdin_open
=
False
,
tty
=
False
,
detach
=
False
,
stdin_open
=
False
,
tty
=
False
,
mem_limit
=
None
,
ports
=
None
,
environment
=
None
,
mem_limit
=
None
,
ports
=
None
,
environment
=
None
,
...
...
docker/api/daemon.py
Dosyayı görüntüle @
b180b877
import
os
import
os
import
warnings
from
datetime
import
datetime
from
datetime
import
datetime
from
..
import
auth
,
utils
from
..
import
auth
,
utils
from
..constants
import
INSECURE_REGISTRY_DEPRECATION_WARNING
class
DaemonApiMixin
(
object
):
class
DaemonApiMixin
(
object
):
...
@@ -90,7 +88,7 @@ class DaemonApiMixin(object):
...
@@ -90,7 +88,7 @@ class DaemonApiMixin(object):
return
self
.
_result
(
self
.
_get
(
self
.
_url
(
"/info"
)),
True
)
return
self
.
_result
(
self
.
_get
(
self
.
_url
(
"/info"
)),
True
)
def
login
(
self
,
username
,
password
=
None
,
email
=
None
,
registry
=
None
,
def
login
(
self
,
username
,
password
=
None
,
email
=
None
,
registry
=
None
,
reauth
=
False
,
insecure_registry
=
False
,
dockercfg_path
=
None
):
reauth
=
False
,
dockercfg_path
=
None
):
"""
"""
Authenticate with a registry. Similar to the ``docker login`` command.
Authenticate with a registry. Similar to the ``docker login`` command.
...
@@ -113,11 +111,6 @@ class DaemonApiMixin(object):
...
@@ -113,11 +111,6 @@ class DaemonApiMixin(object):
:py:class:`docker.errors.APIError`
:py:class:`docker.errors.APIError`
If the server returns an error.
If the server returns an error.
"""
"""
if
insecure_registry
:
warnings
.
warn
(
INSECURE_REGISTRY_DEPRECATION_WARNING
.
format
(
'login()'
),
DeprecationWarning
)
# If we don't have any auth data so far, try reloading the config file
# If we don't have any auth data so far, try reloading the config file
# one more time in case anything showed up in there.
# one more time in case anything showed up in there.
...
...
docker/api/image.py
Dosyayı görüntüle @
b180b877
import
logging
import
logging
import
os
import
os
import
warnings
import
six
import
six
from
..
import
auth
,
errors
,
utils
from
..
import
auth
,
errors
,
utils
from
..constants
import
INSECURE_REGISTRY_DEPRECATION_WARNING
log
=
logging
.
getLogger
(
__name__
)
log
=
logging
.
getLogger
(
__name__
)
...
@@ -321,9 +319,8 @@ class ImageApiMixin(object):
...
@@ -321,9 +319,8 @@ class ImageApiMixin(object):
params
[
'filters'
]
=
utils
.
convert_filters
(
filters
)
params
[
'filters'
]
=
utils
.
convert_filters
(
filters
)
return
self
.
_result
(
self
.
_post
(
url
,
params
=
params
),
True
)
return
self
.
_result
(
self
.
_post
(
url
,
params
=
params
),
True
)
def
pull
(
self
,
repository
,
tag
=
None
,
stream
=
False
,
def
pull
(
self
,
repository
,
tag
=
None
,
stream
=
False
,
auth_config
=
None
,
insecure_registry
=
False
,
auth_config
=
None
,
decode
=
False
,
decode
=
False
,
platform
=
None
):
platform
=
None
):
"""
"""
Pulls an image. Similar to the ``docker pull`` command.
Pulls an image. Similar to the ``docker pull`` command.
...
@@ -331,11 +328,12 @@ class ImageApiMixin(object):
...
@@ -331,11 +328,12 @@ class ImageApiMixin(object):
repository (str): The repository to pull
repository (str): The repository to pull
tag (str): The tag to pull
tag (str): The tag to pull
stream (bool): Stream the output as a generator
stream (bool): Stream the output as a generator
insecure_registry (bool): Use an insecure registry
auth_config (dict): Override the credentials that
auth_config (dict): Override the credentials that
:py:meth:`~docker.api.daemon.DaemonApiMixin.login` has set for
:py:meth:`~docker.api.daemon.DaemonApiMixin.login` has set for
this request. ``auth_config`` should contain the ``username``
this request. ``auth_config`` should contain the ``username``
and ``password`` keys to be valid.
and ``password`` keys to be valid.
decode (bool): Decode the JSON data from the server into dicts.
Only applies with ``stream=True``
platform (str): Platform in the format ``os[/arch[/variant]]``
platform (str): Platform in the format ``os[/arch[/variant]]``
Returns:
Returns:
...
@@ -361,12 +359,6 @@ class ImageApiMixin(object):
...
@@ -361,12 +359,6 @@ class ImageApiMixin(object):
}
}
"""
"""
if
insecure_registry
:
warnings
.
warn
(
INSECURE_REGISTRY_DEPRECATION_WARNING
.
format
(
'pull()'
),
DeprecationWarning
)
if
not
tag
:
if
not
tag
:
repository
,
tag
=
utils
.
parse_repository_tag
(
repository
)
repository
,
tag
=
utils
.
parse_repository_tag
(
repository
)
registry
,
repo_name
=
auth
.
resolve_repository_name
(
repository
)
registry
,
repo_name
=
auth
.
resolve_repository_name
(
repository
)
...
@@ -405,8 +397,8 @@ class ImageApiMixin(object):
...
@@ -405,8 +397,8 @@ class ImageApiMixin(object):
return
self
.
_result
(
response
)
return
self
.
_result
(
response
)
def
push
(
self
,
repository
,
tag
=
None
,
stream
=
False
,
def
push
(
self
,
repository
,
tag
=
None
,
stream
=
False
,
auth_config
=
None
,
insecure_registry
=
False
,
auth_config
=
None
,
decode
=
False
):
decode
=
False
):
"""
"""
Push an image or a repository to the registry. Similar to the ``docker
Push an image or a repository to the registry. Similar to the ``docker
push`` command.
push`` command.
...
@@ -415,12 +407,12 @@ class ImageApiMixin(object):
...
@@ -415,12 +407,12 @@ class ImageApiMixin(object):
repository (str): The repository to push to
repository (str): The repository to push to
tag (str): An optional tag to push
tag (str): An optional tag to push
stream (bool): Stream the output as a blocking generator
stream (bool): Stream the output as a blocking generator
insecure_registry (bool): Use ``http://`` to connect to the
registry
auth_config (dict): Override the credentials that
auth_config (dict): Override the credentials that
:py:meth:`~docker.api.daemon.DaemonApiMixin.login` has set for
:py:meth:`~docker.api.daemon.DaemonApiMixin.login` has set for
this request. ``auth_config`` should contain the ``username``
this request. ``auth_config`` should contain the ``username``
and ``password`` keys to be valid.
and ``password`` keys to be valid.
decode (bool): Decode the JSON data from the server into dicts.
Only applies with ``stream=True``
Returns:
Returns:
(generator or str): The output from the server.
(generator or str): The output from the server.
...
@@ -439,12 +431,6 @@ class ImageApiMixin(object):
...
@@ -439,12 +431,6 @@ class ImageApiMixin(object):
...
...
"""
"""
if
insecure_registry
:
warnings
.
warn
(
INSECURE_REGISTRY_DEPRECATION_WARNING
.
format
(
'push()'
),
DeprecationWarning
)
if
not
tag
:
if
not
tag
:
repository
,
tag
=
utils
.
parse_repository_tag
(
repository
)
repository
,
tag
=
utils
.
parse_repository_tag
(
repository
)
registry
,
repo_name
=
auth
.
resolve_repository_name
(
repository
)
registry
,
repo_name
=
auth
.
resolve_repository_name
(
repository
)
...
...
docker/api/service.py
Dosyayı görüntüle @
b180b877
import
warnings
from
..
import
auth
,
errors
,
utils
from
..
import
auth
,
errors
,
utils
from
..types
import
ServiceMode
from
..types
import
ServiceMode
...
@@ -123,12 +122,6 @@ class ServiceApiMixin(object):
...
@@ -123,12 +122,6 @@ class ServiceApiMixin(object):
:py:class:`docker.errors.APIError`
:py:class:`docker.errors.APIError`
If the server returns an error.
If the server returns an error.
"""
"""
if
endpoint_config
is
not
None
:
warnings
.
warn
(
'endpoint_config has been renamed to endpoint_spec.'
,
DeprecationWarning
)
endpoint_spec
=
endpoint_config
_check_api_features
(
_check_api_features
(
self
.
_version
,
task_template
,
update_config
,
endpoint_spec
self
.
_version
,
task_template
,
update_config
,
endpoint_spec
...
@@ -370,12 +363,6 @@ class ServiceApiMixin(object):
...
@@ -370,12 +363,6 @@ class ServiceApiMixin(object):
:py:class:`docker.errors.APIError`
:py:class:`docker.errors.APIError`
If the server returns an error.
If the server returns an error.
"""
"""
if
endpoint_config
is
not
None
:
warnings
.
warn
(
'endpoint_config has been renamed to endpoint_spec.'
,
DeprecationWarning
)
endpoint_spec
=
endpoint_config
_check_api_features
(
_check_api_features
(
self
.
_version
,
task_template
,
update_config
,
endpoint_spec
self
.
_version
,
task_template
,
update_config
,
endpoint_spec
...
...
docker/types/containers.py
Dosyayı görüntüle @
b180b877
import
six
import
six
import
warnings
from
..
import
errors
from
..
import
errors
from
..utils.utils
import
(
from
..utils.utils
import
(
...
@@ -542,13 +541,6 @@ class ContainerConfig(dict):
...
@@ -542,13 +541,6 @@ class ContainerConfig(dict):
raise
errors
.
InvalidVersion
(
raise
errors
.
InvalidVersion
(
'labels were only introduced in API version 1.18'
'labels were only introduced in API version 1.18'
)
)
else
:
if
cpuset
is
not
None
or
cpu_shares
is
not
None
:
warnings
.
warn
(
'The cpuset_cpus and cpu_shares options have been moved to'
' host_config in API version 1.18, and will be removed'
,
DeprecationWarning
)
if
version_lt
(
version
,
'1.19'
):
if
version_lt
(
version
,
'1.19'
):
if
volume_driver
is
not
None
:
if
volume_driver
is
not
None
:
...
@@ -575,13 +567,6 @@ class ContainerConfig(dict):
...
@@ -575,13 +567,6 @@ class ContainerConfig(dict):
raise
errors
.
InvalidVersion
(
raise
errors
.
InvalidVersion
(
'stop_signal was only introduced in API version 1.21'
'stop_signal was only introduced in API version 1.21'
)
)
else
:
if
volume_driver
is
not
None
:
warnings
.
warn
(
'The volume_driver option has been moved to'
' host_config in API version 1.21, and will be removed'
,
DeprecationWarning
)
if
stop_timeout
is
not
None
and
version_lt
(
version
,
'1.25'
):
if
stop_timeout
is
not
None
and
version_lt
(
version
,
'1.25'
):
raise
errors
.
InvalidVersion
(
raise
errors
.
InvalidVersion
(
...
...
docker/utils/__init__.py
Dosyayı görüntüle @
b180b877
...
@@ -5,7 +5,7 @@ from .utils import (
...
@@ -5,7 +5,7 @@ from .utils import (
compare_version
,
convert_port_bindings
,
convert_volume_binds
,
compare_version
,
convert_port_bindings
,
convert_volume_binds
,
mkbuildcontext
,
parse_repository_tag
,
parse_host
,
mkbuildcontext
,
parse_repository_tag
,
parse_host
,
kwargs_from_env
,
convert_filters
,
datetime_to_timestamp
,
kwargs_from_env
,
convert_filters
,
datetime_to_timestamp
,
create_host_config
,
parse_bytes
,
p
ing_registry
,
p
arse_env_file
,
version_lt
,
create_host_config
,
parse_bytes
,
parse_env_file
,
version_lt
,
version_gte
,
decode_json_header
,
split_command
,
create_ipam_config
,
version_gte
,
decode_json_header
,
split_command
,
create_ipam_config
,
create_ipam_pool
,
parse_devices
,
normalize_links
,
convert_service_networks
,
create_ipam_pool
,
parse_devices
,
normalize_links
,
convert_service_networks
,
format_environment
,
create_archive
,
format_extra_hosts
format_environment
,
create_archive
,
format_extra_hosts
...
...
docker/utils/utils.py
Dosyayı görüntüle @
b180b877
...
@@ -6,11 +6,9 @@ import json
...
@@ -6,11 +6,9 @@ import json
import
shlex
import
shlex
import
tarfile
import
tarfile
import
tempfile
import
tempfile
import
warnings
from
distutils.version
import
StrictVersion
from
distutils.version
import
StrictVersion
from
datetime
import
datetime
from
datetime
import
datetime
import
requests
import
six
import
six
from
..
import
constants
from
..
import
constants
...
@@ -158,29 +156,6 @@ def version_gte(v1, v2):
...
@@ -158,29 +156,6 @@ def version_gte(v1, v2):
return
not
version_lt
(
v1
,
v2
)
return
not
version_lt
(
v1
,
v2
)
def
ping_registry
(
url
):
warnings
.
warn
(
'The `ping_registry` method is deprecated and will be removed.'
,
DeprecationWarning
)
return
ping
(
url
+
'/v2/'
,
[
401
])
or
ping
(
url
+
'/v1/_ping'
)
def
ping
(
url
,
valid_4xx_statuses
=
None
):
try
:
res
=
requests
.
get
(
url
,
timeout
=
3
)
except
Exception
:
return
False
else
:
# We don't send yet auth headers
# and a v2 registry will respond with status 401
return
(
res
.
status_code
<
400
or
(
valid_4xx_statuses
and
res
.
status_code
in
valid_4xx_statuses
)
)
def
_convert_port_binding
(
binding
):
def
_convert_port_binding
(
binding
):
result
=
{
'HostIp'
:
''
,
'HostPort'
:
''
}
result
=
{
'HostIp'
:
''
,
'HostPort'
:
''
}
if
isinstance
(
binding
,
tuple
):
if
isinstance
(
binding
,
tuple
):
...
...
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