atomicshop 3.1.12__py3-none-any.whl → 3.1.13__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of atomicshop might be problematic. Click here for more details.
- atomicshop/__init__.py +1 -1
- atomicshop/wrappers/dockerw/dockerw.py +23 -4
- {atomicshop-3.1.12.dist-info → atomicshop-3.1.13.dist-info}/METADATA +1 -1
- {atomicshop-3.1.12.dist-info → atomicshop-3.1.13.dist-info}/RECORD +7 -7
- {atomicshop-3.1.12.dist-info → atomicshop-3.1.13.dist-info}/LICENSE.txt +0 -0
- {atomicshop-3.1.12.dist-info → atomicshop-3.1.13.dist-info}/WHEEL +0 -0
- {atomicshop-3.1.12.dist-info → atomicshop-3.1.13.dist-info}/top_level.txt +0 -0
atomicshop/__init__.py
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import threading
|
|
2
|
+
|
|
1
3
|
import docker
|
|
2
4
|
from docker.models.containers import Container
|
|
3
5
|
from docker import DockerClient
|
|
@@ -177,14 +179,31 @@ def stop_remove_containers_by_image_name(image_name: str):
|
|
|
177
179
|
:param image_name: str, the name of the image.
|
|
178
180
|
:return:
|
|
179
181
|
"""
|
|
182
|
+
|
|
183
|
+
def stop_remove_containers(container_instance: Container):
|
|
184
|
+
"""
|
|
185
|
+
Stop and remove a container instance.
|
|
186
|
+
:param container_instance: Container, the docker container object.
|
|
187
|
+
"""
|
|
188
|
+
if container_instance.status == "running":
|
|
189
|
+
print_api(f"Stopping container: [{container_instance.name}]. Short ID: [{container_instance.short_id}]")
|
|
190
|
+
container_instance.stop()
|
|
191
|
+
print_api(f"Removing container: [{container_instance.name}]. Short ID: [{container_instance.short_id}]")
|
|
192
|
+
container_instance.remove()
|
|
193
|
+
print_api(f"Container removed: [{container_instance.name}]. Short ID: [{container_instance.short_id}]", color='green')
|
|
194
|
+
|
|
195
|
+
|
|
180
196
|
client = docker.from_env()
|
|
181
197
|
all_containers = client.containers.list(all=True)
|
|
198
|
+
|
|
199
|
+
containers_to_remove: list[Container] = []
|
|
182
200
|
for container in all_containers:
|
|
183
201
|
if any(image_name in tag for tag in container.image.tags):
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
202
|
+
containers_to_remove.append(container)
|
|
203
|
+
|
|
204
|
+
for removing_container in containers_to_remove:
|
|
205
|
+
threading.Thread(target=stop_remove_containers, args=(removing_container,), daemon=True).start()
|
|
206
|
+
|
|
188
207
|
client.close()
|
|
189
208
|
|
|
190
209
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
atomicshop/__init__.py,sha256=
|
|
1
|
+
atomicshop/__init__.py,sha256=m7-cUoalFlb_P0L7dq5ZKqms-k_BdzctCtwbbLtMGyQ,123
|
|
2
2
|
atomicshop/_basics_temp.py,sha256=6cu2dd6r2dLrd1BRNcVDKTHlsHs_26Gpw8QS6v32lQ0,3699
|
|
3
3
|
atomicshop/_create_pdf_demo.py,sha256=Yi-PGZuMg0RKvQmLqVeLIZYadqEZwUm-4A9JxBl_vYA,3713
|
|
4
4
|
atomicshop/_patch_import.py,sha256=ENp55sKVJ0e6-4lBvZnpz9PQCt3Otbur7F6aXDlyje4,6334
|
|
@@ -224,7 +224,7 @@ atomicshop/wrappers/ctyping/msi_windows_installer/cabs.py,sha256=htzwb2ROYI8yyc8
|
|
|
224
224
|
atomicshop/wrappers/ctyping/msi_windows_installer/extract_msi_main.py,sha256=AEkjnqEhfCbCUcYaulv3uba5hZjTB03xm-puAINsZGM,5488
|
|
225
225
|
atomicshop/wrappers/ctyping/msi_windows_installer/tables.py,sha256=tHsu0YfBgzuIk9L-PyqLgU_IzyVbCfy8L1EqelNnvWk,17674
|
|
226
226
|
atomicshop/wrappers/dockerw/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
227
|
-
atomicshop/wrappers/dockerw/dockerw.py,sha256=
|
|
227
|
+
atomicshop/wrappers/dockerw/dockerw.py,sha256=DIhn3RTG3m7bJ-NTevoF1s1EeGHgi2y-m07oY5xJ_ls,10640
|
|
228
228
|
atomicshop/wrappers/dockerw/install_docker.py,sha256=7NTMxCPBesr0QcqB0RZ5YU0I8FDPtNux_mYAX28wI0I,9982
|
|
229
229
|
atomicshop/wrappers/elasticsearchw/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
230
230
|
atomicshop/wrappers/elasticsearchw/config_basic.py,sha256=fDujtrjEjbWiYh_WQ3OcYp_8mXhXPYeKLy4wSPL5qM0,1177
|
|
@@ -337,8 +337,8 @@ atomicshop/wrappers/socketw/statistics_csv.py,sha256=WcNyaqEZ82S5-f3kzqi1nllNT2N
|
|
|
337
337
|
atomicshop/wrappers/winregw/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
338
338
|
atomicshop/wrappers/winregw/winreg_installed_software.py,sha256=Qzmyktvob1qp6Tjk2DjLfAqr_yXV0sgWzdMW_9kwNjY,2345
|
|
339
339
|
atomicshop/wrappers/winregw/winreg_network.py,sha256=ih0BVNwByLvf9F_Lac4EdmDYYJA3PzMvmG0PieDZrsE,9905
|
|
340
|
-
atomicshop-3.1.
|
|
341
|
-
atomicshop-3.1.
|
|
342
|
-
atomicshop-3.1.
|
|
343
|
-
atomicshop-3.1.
|
|
344
|
-
atomicshop-3.1.
|
|
340
|
+
atomicshop-3.1.13.dist-info/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
|
|
341
|
+
atomicshop-3.1.13.dist-info/METADATA,sha256=5LMH6VMuu4OhGpNqI2y4YObNGBe0k0ZU-GeGaqZl-xM,10671
|
|
342
|
+
atomicshop-3.1.13.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
343
|
+
atomicshop-3.1.13.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
|
|
344
|
+
atomicshop-3.1.13.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|