atomicshop 3.1.2__py3-none-any.whl → 3.1.3__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 CHANGED
@@ -1,4 +1,4 @@
1
1
  """Atomic Basic functions and classes to make developer life easier"""
2
2
 
3
3
  __author__ = "Den Kras"
4
- __version__ = '3.1.2'
4
+ __version__ = '3.1.3'
@@ -172,16 +172,6 @@ def add_execution_permissions_for_file(image_id_or_name: str, file_path: str, pr
172
172
 
173
173
 
174
174
  def stop_remove_containers_by_image_name(image_name: str):
175
- def stop_remove_container(container: Container):
176
- """
177
- Stop and remove a container.
178
- :param container: Container, the docker container object.
179
- :return:
180
- """
181
- if container.status == "running":
182
- print_api(f"Stopping container: [{container.name}]. Short ID: [{container.short_id}]")
183
- container.stop()
184
- container.remove()
185
175
  """
186
176
  Remove all containers by image name.
187
177
  :param image_name: str, the name of the image.
@@ -189,8 +179,8 @@ def stop_remove_containers_by_image_name(image_name: str):
189
179
  """
190
180
  client = docker.from_env()
191
181
  all_containers = client.containers.list(all=True)
192
- for current_container in all_containers:
193
- if any(image_name in tag for tag in current_container.image.tags):
182
+ for container in all_containers:
183
+ if any(image_name in tag for tag in container.image.tags):
194
184
  if container.status == "running":
195
185
  print_api(f"Stopping container: [{container.name}]. Short ID: [{container.short_id}]")
196
186
  container.stop()
@@ -241,7 +231,7 @@ def start_container_without_stop(
241
231
  return client, container
242
232
 
243
233
 
244
- def run_command_in_running_container(container: Container, command: list) -> tuple[int, str]:
234
+ def run_command_in_running_container(container: Container, command: list) -> tuple[int, bytes, str]:
245
235
  """
246
236
  Run a command in a running container.
247
237
  :param container: Container, the docker container object.
@@ -250,8 +240,22 @@ def run_command_in_running_container(container: Container, command: list) -> tup
250
240
  """
251
241
 
252
242
  # Run the command inside the already running container
253
- status_code, output_bytes = container.exec_run(cmd=command, stdout=True, stderr=True)
243
+ exec_result = container.exec_run(cmd=command, stdout=True, stderr=True)
254
244
  # Capture logs
255
- output_text = output_bytes.decode("utf-8", errors="replace")
256
-
257
- return status_code, output_text
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,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: atomicshop
3
- Version: 3.1.2
3
+ Version: 3.1.3
4
4
  Summary: Atomic functions and classes to make developer life easier
5
5
  Author: Denis Kras
6
6
  License: MIT License
@@ -1,4 +1,4 @@
1
- atomicshop/__init__.py,sha256=9FkiqXkoIc84EfZfIhFK47xqfKhRhJsieqicu4tjeJE,122
1
+ atomicshop/__init__.py,sha256=iecTS2GszzrWWXhhrFgck5TiMcZTtx_WUNY90_aJA6k,122
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
@@ -223,7 +223,7 @@ atomicshop/wrappers/ctyping/msi_windows_installer/cabs.py,sha256=htzwb2ROYI8yyc8
223
223
  atomicshop/wrappers/ctyping/msi_windows_installer/extract_msi_main.py,sha256=AEkjnqEhfCbCUcYaulv3uba5hZjTB03xm-puAINsZGM,5488
224
224
  atomicshop/wrappers/ctyping/msi_windows_installer/tables.py,sha256=tHsu0YfBgzuIk9L-PyqLgU_IzyVbCfy8L1EqelNnvWk,17674
225
225
  atomicshop/wrappers/dockerw/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
226
- atomicshop/wrappers/dockerw/dockerw.py,sha256=cVLUiMetBDlvFVNnX9wzVsUO1ylJxQfEwEw8FOEg37w,9659
226
+ atomicshop/wrappers/dockerw/dockerw.py,sha256=mwQT8d1aUrn8FbMCwcmUjoP35UWexl8DztNSuJAHJQo,9865
227
227
  atomicshop/wrappers/dockerw/install_docker.py,sha256=7NTMxCPBesr0QcqB0RZ5YU0I8FDPtNux_mYAX28wI0I,9982
228
228
  atomicshop/wrappers/elasticsearchw/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
229
229
  atomicshop/wrappers/elasticsearchw/config_basic.py,sha256=fDujtrjEjbWiYh_WQ3OcYp_8mXhXPYeKLy4wSPL5qM0,1177
@@ -336,8 +336,8 @@ atomicshop/wrappers/socketw/statistics_csv.py,sha256=WcNyaqEZ82S5-f3kzqi1nllNT2N
336
336
  atomicshop/wrappers/winregw/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
337
337
  atomicshop/wrappers/winregw/winreg_installed_software.py,sha256=Qzmyktvob1qp6Tjk2DjLfAqr_yXV0sgWzdMW_9kwNjY,2345
338
338
  atomicshop/wrappers/winregw/winreg_network.py,sha256=3Ts1sVqSUiCDsHRHwJCbiZ9EYvv2ELGxF0Y_pibGU4k,9596
339
- atomicshop-3.1.2.dist-info/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
340
- atomicshop-3.1.2.dist-info/METADATA,sha256=3K-v2aK-rRo1shq8oR83WC2o6im2elEruEBAgdXDjb4,10653
341
- atomicshop-3.1.2.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
342
- atomicshop-3.1.2.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
343
- atomicshop-3.1.2.dist-info/RECORD,,
339
+ atomicshop-3.1.3.dist-info/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
340
+ atomicshop-3.1.3.dist-info/METADATA,sha256=j8iedLkgbjssGczhijWtmc-mcil_AE8Z-LLIuJm_U4I,10653
341
+ atomicshop-3.1.3.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
342
+ atomicshop-3.1.3.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
343
+ atomicshop-3.1.3.dist-info/RECORD,,