Port from 'docker-py' library to renamed 'docker' library.

Use docker.APIClient as object to interface with.
This commit is contained in:
Sam 2018-03-06 09:42:10 -05:00
parent c904aa1d61
commit 814b64c11e
5 changed files with 6 additions and 6 deletions

View File

@ -66,7 +66,7 @@ def main():
stream=sys.stdout)
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)
stop_containers(client, opts.max_run_time, matcher, opts.dry_run)

View File

@ -220,7 +220,7 @@ def main():
stream=sys.stdout)
args = get_args()
client = docker.Client(version='auto', timeout=args.timeout)
client = docker.APIClient(version='auto', timeout=args.timeout)
if args.max_container_age:
cleanup_containers(client, args.max_container_age, args.dry_run)

View File

@ -14,7 +14,7 @@ setup(
include_package_data=True,
install_requires=[
'python-dateutil',
'docker-py >= 0.5',
'docker',
'pytimeparse',
],
license="Apache License 2.0",

View File

@ -48,6 +48,6 @@ def later_time():
@pytest.fixture
def mock_client():
client = mock.create_autospec(docker.Client)
client._version = '1.17'
client = mock.create_autospec(docker.APIClient)
client._version = '1.21'
return client

View File

@ -466,7 +466,7 @@ def test_build_exclude_set_empty():
def test_main(mock_client):
with mock.patch(
'docker_custodian.docker_gc.docker.Client',
'docker_custodian.docker_gc.docker.APIClient',
return_value=mock_client):
with mock.patch(