From fd444edeab74d400380ab6879fcef5d265e930f4 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Apr 23 2019 20:43:19 +0000 Subject: import python-docker-py-1.10.6-9.el7_6 --- diff --git a/SOURCES/backport-init-and-init_path-to-create_host_config.patch b/SOURCES/backport-init-and-init_path-to-create_host_config.patch new file mode 100644 index 0000000..9958de6 --- /dev/null +++ b/SOURCES/backport-init-and-init_path-to-create_host_config.patch @@ -0,0 +1,89 @@ +From b1ec2f7d35ac1ba825eef2167ac7a59964ff47fe Mon Sep 17 00:00:00 2001 +From: Tomas Tomecek +Date: Fri, 22 Mar 2019 11:17:28 +0100 +Subject: [PATCH] backport init and init_path to create_host_config + +Resolves #1687227 + +Signed-off-by: Tomas Tomecek +--- + docker/utils/utils.py | 6 ++++++ + docs/hostconfig.md | 2 ++ + tests/unit/container_test.py | 24 ++++++++++++++++++++++++ + 3 files changed, 32 insertions(+) + +diff --git a/docker/utils/utils.py b/docker/utils/utils.py +index 2a183a0..9053889 100644 +--- a/docker/utils/utils.py ++++ b/docker/utils/utils.py +@@ -610,6 +610,7 @@ def create_host_config(binds=None, port_bindings=None, lxc_conf=None, + shm_size=None, sysctls=None, version=None, tmpfs=None, + oom_score_adj=None, dns_opt=None, cpu_shares=None, + cpuset_cpus=None, userns_mode=None, pids_limit=None, ++ init=None, init_path=None, + cpu_rt_period=None, cpu_rt_runtime=None): + + host_config = {} +@@ -918,6 +919,11 @@ def create_host_config(binds=None, port_bindings=None, lxc_conf=None, + ) + host_config['CPURealtimeRuntime'] = cpu_rt_runtime + ++ if init is not None: ++ host_config['Init'] = init ++ if init_path is not None: ++ host_config['InitPath'] = init_path ++ + return host_config + + +diff --git a/docs/hostconfig.md b/docs/hostconfig.md +index c39a02c..b452a91 100644 +--- a/docs/hostconfig.md ++++ b/docs/hostconfig.md +@@ -132,6 +132,8 @@ for example: + * pids_limit (int): Tune a container’s pids limit. Set -1 for unlimited. + * cpu_rt_runtime (int): Limit the CPU real-time runtime in microseconds. + * cpu_rt_period (int): Limit the CPU real-time period in microseconds. ++* init (bool): Run an init inside the container that forwards signals and reaps processes. ++* init_path (str): Path to the docker-init binary. + + **Returns** (dict) HostConfig dictionary + +diff --git a/tests/unit/container_test.py b/tests/unit/container_test.py +index 8c7b2c1..137e634 100644 +--- a/tests/unit/container_test.py ++++ b/tests/unit/container_test.py +@@ -360,6 +360,30 @@ class CreateContainerTest(DockerClientTest): + "NetworkMode": "default" + }}''')) + ++ def test_create_container_with_init(self): ++ self.client.create_container( ++ 'busybox', 'ls', host_config=self.client.create_host_config( ++ init=True, init_path="/path/to/docker-init" ++ ) ++ ) ++ ++ args = fake_request.call_args ++ self.assertEqual(args[0][1], ++ url_prefix + 'containers/create') ++ self.assertEqual(json.loads(args[1]['data']), ++ json.loads(''' ++ {"Tty": false, "Image": "busybox", ++ "Cmd": ["ls"], "AttachStdin": false, ++ "AttachStderr": true, ++ "AttachStdout": true, "OpenStdin": false, ++ "StdinOnce": false, ++ "NetworkDisabled": false, ++ "HostConfig": { ++ "Init": true, ++ "InitPath": "/path/to/docker-init", ++ "NetworkMode": "default" ++ }}''')) ++ + @requires_api_version('1.18') + def test_create_container_with_host_config_cpuset(self): + self.client.create_container( +-- +2.20.1 + diff --git a/SPECS/python-docker-py.spec b/SPECS/python-docker-py.spec index 8661a03..8a43d88 100644 --- a/SPECS/python-docker-py.spec +++ b/SPECS/python-docker-py.spec @@ -9,7 +9,7 @@ Name: python-%{project} Version: %{docker_py_version} Epoch: 1 -Release: 8%{?dist} +Release: 9%{?dist} Summary: An API client for docker written in Python License: ASL 2.0 URL: https://github.com/%{owner}/%{project}/ @@ -24,6 +24,8 @@ Patch3: implement-cpu_rt_-switches.patch # the streaming connections, custom protocol of exec/attach and other # socket-related operations Patch4: backport-util-socket-fixes-rhbz1501782.patch +# https://bugzilla.redhat.com/show_bug.cgi?id=1687227 +Patch5: backport-init-and-init_path-to-create_host_config.patch BuildArch: noarch BuildRequires: python2-devel @@ -63,7 +65,8 @@ Python bindings for the docker credentials store API %patch2 -p 1 %patch3 -p 1 %patch4 -p 1 -gzip -dc %{SOURCE1} | tar -xvvf - +%patch5 -p 1 +gzip -dc %{SOURCE1} | tar -xf - %build @@ -93,6 +96,9 @@ popd %changelog +* Fri Mar 22 2019 Tomas Tomecek - 1:1.10.6-9 +- backport init and init_path to create_host_config (#1687227) + * Tue Dec 04 2018 Yaakov Selkowitz - 1:1.10.6-8 - Provides: python-docker for compatibility with old docker-python (#1655833)