mirror of
https://github.com/thegeeklab/docker-tidy.git
synced 2024-11-28 23:20:36 +00:00
Port from 'docker-py' library to renamed 'docker' library.
Use docker.APIClient as object to interface with.
This commit is contained in:
parent
c904aa1d61
commit
814b64c11e
@ -66,7 +66,7 @@ def main():
|
|||||||
stream=sys.stdout)
|
stream=sys.stdout)
|
||||||
|
|
||||||
opts = get_opts()
|
opts = get_opts()
|
||||||
client = docker.Client(version='auto', timeout=opts.timeout)
|
client = docker.APIClient(version='auto', timeout=opts.timeout)
|
||||||
|
|
||||||
matcher = build_container_matcher(opts.prefix)
|
matcher = build_container_matcher(opts.prefix)
|
||||||
stop_containers(client, opts.max_run_time, matcher, opts.dry_run)
|
stop_containers(client, opts.max_run_time, matcher, opts.dry_run)
|
||||||
|
@ -220,7 +220,7 @@ def main():
|
|||||||
stream=sys.stdout)
|
stream=sys.stdout)
|
||||||
|
|
||||||
args = get_args()
|
args = get_args()
|
||||||
client = docker.Client(version='auto', timeout=args.timeout)
|
client = docker.APIClient(version='auto', timeout=args.timeout)
|
||||||
|
|
||||||
if args.max_container_age:
|
if args.max_container_age:
|
||||||
cleanup_containers(client, args.max_container_age, args.dry_run)
|
cleanup_containers(client, args.max_container_age, args.dry_run)
|
||||||
|
2
setup.py
2
setup.py
@ -14,7 +14,7 @@ setup(
|
|||||||
include_package_data=True,
|
include_package_data=True,
|
||||||
install_requires=[
|
install_requires=[
|
||||||
'python-dateutil',
|
'python-dateutil',
|
||||||
'docker-py >= 0.5',
|
'docker',
|
||||||
'pytimeparse',
|
'pytimeparse',
|
||||||
],
|
],
|
||||||
license="Apache License 2.0",
|
license="Apache License 2.0",
|
||||||
|
@ -48,6 +48,6 @@ def later_time():
|
|||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def mock_client():
|
def mock_client():
|
||||||
client = mock.create_autospec(docker.Client)
|
client = mock.create_autospec(docker.APIClient)
|
||||||
client._version = '1.17'
|
client._version = '1.21'
|
||||||
return client
|
return client
|
||||||
|
@ -466,7 +466,7 @@ def test_build_exclude_set_empty():
|
|||||||
|
|
||||||
def test_main(mock_client):
|
def test_main(mock_client):
|
||||||
with mock.patch(
|
with mock.patch(
|
||||||
'docker_custodian.docker_gc.docker.Client',
|
'docker_custodian.docker_gc.docker.APIClient',
|
||||||
return_value=mock_client):
|
return_value=mock_client):
|
||||||
|
|
||||||
with mock.patch(
|
with mock.patch(
|
||||||
|
Loading…
Reference in New Issue
Block a user