atomicshop 2.18.25__py3-none-any.whl → 2.18.26__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 +41 -4
- {atomicshop-2.18.25.dist-info → atomicshop-2.18.26.dist-info}/METADATA +1 -1
- {atomicshop-2.18.25.dist-info → atomicshop-2.18.26.dist-info}/RECORD +7 -7
- {atomicshop-2.18.25.dist-info → atomicshop-2.18.26.dist-info}/LICENSE.txt +0 -0
- {atomicshop-2.18.25.dist-info → atomicshop-2.18.26.dist-info}/WHEEL +0 -0
- {atomicshop-2.18.25.dist-info → atomicshop-2.18.26.dist-info}/top_level.txt +0 -0
atomicshop/__init__.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import docker
|
|
2
2
|
from docker.models.containers import Container
|
|
3
|
+
from docker import DockerClient
|
|
3
4
|
|
|
4
5
|
from ...print_api import print_api
|
|
5
6
|
|
|
@@ -187,14 +188,20 @@ def stop_remove_containers_by_image_name(image_name: str):
|
|
|
187
188
|
client.close()
|
|
188
189
|
|
|
189
190
|
|
|
190
|
-
def start_container_without_stop(
|
|
191
|
+
def start_container_without_stop(
|
|
192
|
+
image_name: str,
|
|
193
|
+
client: DockerClient = None,
|
|
194
|
+
**kwargs) -> tuple[DockerClient, Container]:
|
|
191
195
|
"""
|
|
192
196
|
Start a container in detached mode, this container will not run the entry point, but will run the infinite sleep.
|
|
193
197
|
This way the container will continue running, you can execute commands in it and stop it manually when needed.
|
|
194
198
|
:param image_name: str, the name of the image.
|
|
195
|
-
:
|
|
199
|
+
:param client: docker.DockerClient, the docker client. If not provided, it will use the default client.
|
|
200
|
+
:return: Container, the docker container object.
|
|
196
201
|
"""
|
|
197
|
-
|
|
202
|
+
|
|
203
|
+
if client is None:
|
|
204
|
+
client = docker.from_env()
|
|
198
205
|
|
|
199
206
|
kwargs.setdefault('detach', True)
|
|
200
207
|
kwargs.setdefault('mem_limit', '512m')
|
|
@@ -221,4 +228,34 @@ def start_container_without_stop(image_name: str, **kwargs) -> Container:
|
|
|
221
228
|
|
|
222
229
|
print_api(f"Started container: [{container.name}]. Short ID: [{container.short_id}]")
|
|
223
230
|
|
|
224
|
-
return container
|
|
231
|
+
return client, container
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
def run_command_in_running_container(container: Container, command: list) -> tuple[int, bytes, str]:
|
|
235
|
+
"""
|
|
236
|
+
Run a command in a running container.
|
|
237
|
+
:param container: Container, the docker container object.
|
|
238
|
+
:param command: list, the command to run.
|
|
239
|
+
:return: tuple of (exit_code, output, string_output).
|
|
240
|
+
"""
|
|
241
|
+
|
|
242
|
+
# Run the command inside the already running container
|
|
243
|
+
exec_result = container.exec_run(cmd=command, stdout=True, stderr=True)
|
|
244
|
+
# Capture logs
|
|
245
|
+
output_text = exec_result.output.decode("utf-8", errors="replace")
|
|
246
|
+
execution_result_message: str = str()
|
|
247
|
+
if output_text:
|
|
248
|
+
execution_result_message = f"Container execution result:\n{output_text}"
|
|
249
|
+
|
|
250
|
+
if exec_result.exit_code != 0:
|
|
251
|
+
# logging.warning(f"Extraction command returned code {exec_result.exit_code} for '{filename}'")
|
|
252
|
+
code_message = f"Extraction command returned code {exec_result.exit_code}"
|
|
253
|
+
else:
|
|
254
|
+
code_message = "Extraction succeeded"
|
|
255
|
+
|
|
256
|
+
if execution_result_message:
|
|
257
|
+
execution_result_message += f"\n{code_message}"
|
|
258
|
+
else:
|
|
259
|
+
execution_result_message = code_message
|
|
260
|
+
|
|
261
|
+
return exec_result.exit_code, exec_result.output, execution_result_message
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
atomicshop/__init__.py,sha256=
|
|
1
|
+
atomicshop/__init__.py,sha256=bhazsvVh5VR5g-yOQejRoBGt1q11o68HYHVYAVxKpXc,124
|
|
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
|
|
@@ -211,7 +211,7 @@ atomicshop/wrappers/ctyping/msi_windows_installer/cabs.py,sha256=htzwb2ROYI8yyc8
|
|
|
211
211
|
atomicshop/wrappers/ctyping/msi_windows_installer/extract_msi_main.py,sha256=AEkjnqEhfCbCUcYaulv3uba5hZjTB03xm-puAINsZGM,5488
|
|
212
212
|
atomicshop/wrappers/ctyping/msi_windows_installer/tables.py,sha256=tHsu0YfBgzuIk9L-PyqLgU_IzyVbCfy8L1EqelNnvWk,17674
|
|
213
213
|
atomicshop/wrappers/dockerw/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
214
|
-
atomicshop/wrappers/dockerw/dockerw.py,sha256=
|
|
214
|
+
atomicshop/wrappers/dockerw/dockerw.py,sha256=mwQT8d1aUrn8FbMCwcmUjoP35UWexl8DztNSuJAHJQo,9865
|
|
215
215
|
atomicshop/wrappers/dockerw/install_docker.py,sha256=7NTMxCPBesr0QcqB0RZ5YU0I8FDPtNux_mYAX28wI0I,9982
|
|
216
216
|
atomicshop/wrappers/elasticsearchw/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
217
217
|
atomicshop/wrappers/elasticsearchw/config_basic.py,sha256=fDujtrjEjbWiYh_WQ3OcYp_8mXhXPYeKLy4wSPL5qM0,1177
|
|
@@ -321,8 +321,8 @@ atomicshop/wrappers/socketw/statistics_csv.py,sha256=fgMzDXI0cybwUEqAxprRmY3lqbh
|
|
|
321
321
|
atomicshop/wrappers/winregw/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
322
322
|
atomicshop/wrappers/winregw/winreg_installed_software.py,sha256=Qzmyktvob1qp6Tjk2DjLfAqr_yXV0sgWzdMW_9kwNjY,2345
|
|
323
323
|
atomicshop/wrappers/winregw/winreg_network.py,sha256=AENV88H1qDidrcpyM9OwEZxX5svfi-Jb4N6FkS1xtqA,8851
|
|
324
|
-
atomicshop-2.18.
|
|
325
|
-
atomicshop-2.18.
|
|
326
|
-
atomicshop-2.18.
|
|
327
|
-
atomicshop-2.18.
|
|
328
|
-
atomicshop-2.18.
|
|
324
|
+
atomicshop-2.18.26.dist-info/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
|
|
325
|
+
atomicshop-2.18.26.dist-info/METADATA,sha256=PCGI4liQF8srGPeqAAiOEuUZE0z0r4Fv7oYEdd8FnGk,10631
|
|
326
|
+
atomicshop-2.18.26.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
327
|
+
atomicshop-2.18.26.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
|
|
328
|
+
atomicshop-2.18.26.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|