holado 0.11.2__py3-none-any.whl → 0.11.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 holado might be problematic. Click here for more details.

Files changed (37) hide show
  1. {holado-0.11.2.dist-info → holado-0.11.3.dist-info}/METADATA +2 -2
  2. {holado-0.11.2.dist-info → holado-0.11.3.dist-info}/RECORD +37 -4
  3. holado_tools/__init__.py +38 -0
  4. holado_tools/scripts/execute_persisted_post_processes/execute_persisted_post_processes.py +36 -0
  5. holado_tools/scripts/execute_persisted_post_processes/execute_persisted_post_processes.sh +6 -0
  6. holado_tools/scripts/execute_persisted_post_processes/initialize_holado.py +62 -0
  7. holado_tools/tests/behave/steps/__init__.py +16 -0
  8. holado_tools/tests/behave/steps/tools/host_controller/client_steps.py +97 -0
  9. holado_tools/tools/host_controller/client/rest/host_controller_client.py +146 -0
  10. holado_tools/tools/host_controller/server/Dockerfile +60 -0
  11. holado_tools/tools/host_controller/server/grpc/README +2 -0
  12. holado_tools/tools/host_controller/server/grpc/__init__.py +26 -0
  13. holado_tools/tools/host_controller/server/grpc/proto/compile_proto.py +60 -0
  14. holado_tools/tools/host_controller/server/grpc/proto/definitions/docker_controler.proto +63 -0
  15. holado_tools/tools/host_controller/server/requirements.txt +2 -0
  16. holado_tools/tools/host_controller/server/rest/README +2 -0
  17. holado_tools/tools/host_controller/server/rest/api/__init__.py +24 -0
  18. holado_tools/tools/host_controller/server/rest/api/config.py +57 -0
  19. holado_tools/tools/host_controller/server/rest/api/docker/__init__.py +40 -0
  20. holado_tools/tools/host_controller/server/rest/api/docker/container.py +55 -0
  21. holado_tools/tools/host_controller/server/rest/api/os.py +47 -0
  22. holado_tools/tools/host_controller/server/rest/initialize_holado.py +72 -0
  23. holado_tools/tools/host_controller/server/rest/openapi.yaml +265 -0
  24. holado_tools/tools/host_controller/server/rest/run.py +31 -0
  25. holado_tools/tools/host_controller/server/run_host_controller_in_docker.sh +107 -0
  26. holado_tools/tools/host_viewer/client/rest/host_viewer_client.py +96 -0
  27. holado_tools/tools/host_viewer/server/Dockerfile +60 -0
  28. holado_tools/tools/host_viewer/server/requirements.txt +2 -0
  29. holado_tools/tools/host_viewer/server/rest/README +2 -0
  30. holado_tools/tools/host_viewer/server/rest/api/__init__.py +22 -0
  31. holado_tools/tools/host_viewer/server/rest/api/docker/__init__.py +40 -0
  32. holado_tools/tools/host_viewer/server/rest/initialize_holado.py +72 -0
  33. holado_tools/tools/host_viewer/server/rest/openapi.yaml +102 -0
  34. holado_tools/tools/host_viewer/server/rest/run.py +31 -0
  35. holado_tools/tools/host_viewer/server/run_host_viewer_in_docker.sh +107 -0
  36. {holado-0.11.2.dist-info → holado-0.11.3.dist-info}/WHEEL +0 -0
  37. {holado-0.11.2.dist-info → holado-0.11.3.dist-info}/licenses/LICENSE +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: holado
3
- Version: 0.11.2
3
+ Version: 0.11.3
4
4
  Summary: HolAdo framework
5
5
  Project-URL: Homepage, https://gitlab.com/holado_framework/python
6
6
  Project-URL: Issues, https://gitlab.com/holado_framework/python/-/issues
@@ -15,7 +15,7 @@ Classifier: Programming Language :: Python :: 3.10
15
15
  Classifier: Programming Language :: Python :: 3.11
16
16
  Classifier: Programming Language :: Python :: 3.12
17
17
  Requires-Python: >=3.10
18
- Requires-Dist: behave==1.2.7.dev6
18
+ Requires-Dist: behave
19
19
  Requires-Dist: psutil
20
20
  Requires-Dist: pypika
21
21
  Requires-Dist: python-dateutil
@@ -494,6 +494,39 @@ holado_test/tools/test_server/server/rest/run.py,sha256=OpDBkjBX_ZoNfwTWc2VV7dIN
494
494
  holado_test/tools/test_server/server/rest/api/__init__.py,sha256=4QcsiWhFX0sGhJYuoqUUfwEYb6ceIDlFFlU1q3ls7Xc,1442
495
495
  holado_test/tools/test_server/server/rest/api/campaign/__init__.py,sha256=btZb20N5k7_WbowNAC1C7yYDUkwPnUU5QUmh-jO0bhg,1586
496
496
  holado_test/tools/test_server/server/rest/api/campaign/scenario.py,sha256=4eTIScEGL0GKD7g6aIPHJVvaVbwz487zlEg9mRQv84Y,1737
497
+ holado_tools/__init__.py,sha256=JzUm55NIkeBynu1RieZ3QfZGw8v4NfFDzz6HS-bN7r8,1798
498
+ holado_tools/scripts/execute_persisted_post_processes/execute_persisted_post_processes.py,sha256=mkU6eqfOdwfrqXF2fJv8JT1Izu2B3pCBIy1PmNisqi0,2478
499
+ holado_tools/scripts/execute_persisted_post_processes/execute_persisted_post_processes.sh,sha256=VXgAjwMKkUg4-T4TfTTziep4wzOzEYjFWgAeTYboTNQ,244
500
+ holado_tools/scripts/execute_persisted_post_processes/initialize_holado.py,sha256=IPYH-GYNiHV5-7ZCCH6CFmPpmACsPrTV74TYz3MRjpA,3102
501
+ holado_tools/tests/behave/steps/__init__.py,sha256=SPh47LYMokcxbFhDa_JnlkIlyQav2D-hddf3J1ZlEbQ,1296
502
+ holado_tools/tests/behave/steps/tools/host_controller/client_steps.py,sha256=FOaeQ5xX4KGv7OVvMh2M8U0a-AfHuUNQU5p4av_K8z0,4786
503
+ holado_tools/tools/host_controller/client/rest/host_controller_client.py,sha256=U7btvQf-kodCIrBvG-DHOgY5Hk9A0-H6jYZZ13zdbr0,6432
504
+ holado_tools/tools/host_controller/server/Dockerfile,sha256=wTy-ii7MuJULRiw5_2sUWj8ssw6WUJIhAcLY2KCL0lw,1508
505
+ holado_tools/tools/host_controller/server/requirements.txt,sha256=0RvLV3t2DyBR2FsbAd1WVEcbsVc6FVUN2horQJU4POo,57
506
+ holado_tools/tools/host_controller/server/run_host_controller_in_docker.sh,sha256=KEBTxcxFeViVpixLii1YXBbyZhvJKfmH604jGqBFxHc,3729
507
+ holado_tools/tools/host_controller/server/grpc/README,sha256=og8ClPR9Fu6CY-85IOPAESv4ks-Jebre-Aa78pBiaVw,130
508
+ holado_tools/tools/host_controller/server/grpc/__init__.py,sha256=QBkE1ydbCvARUimeSY2PvBkZ-Jp0bCv6k_l89a_8zNw,1551
509
+ holado_tools/tools/host_controller/server/grpc/proto/compile_proto.py,sha256=NjcStLaAO_zKcSprrcGscq3R_4anh55QeguXLq6SPjo,2191
510
+ holado_tools/tools/host_controller/server/grpc/proto/definitions/docker_controler.proto,sha256=n9bsXaQfnZX-R5HvfquCVt3QjpFtDJSH6p8gnTjm06k,1650
511
+ holado_tools/tools/host_controller/server/rest/README,sha256=10hiIdQw69iXubii8ZYZUrYrs2Q2k5QiTKpBBrBK1bc,165
512
+ holado_tools/tools/host_controller/server/rest/initialize_holado.py,sha256=UxNphXyjs-xraorzMWjDe6-QYw_Q3mtykyY-ENYZB1o,3464
513
+ holado_tools/tools/host_controller/server/rest/openapi.yaml,sha256=u9D5Yt5pwVZujeOF5xhUF4W2tjXi2TODWHMFBEmLJjY,6900
514
+ holado_tools/tools/host_controller/server/rest/run.py,sha256=RQFxhVCH3K3uAHFdCVVKw2MAcVcufSvenVn6f6ABCGA,2009
515
+ holado_tools/tools/host_controller/server/rest/api/__init__.py,sha256=3VgcIa1WhkxMBTNrxKsh4xIqiSMeDxQpbx2cAdME9vg,1459
516
+ holado_tools/tools/host_controller/server/rest/api/config.py,sha256=Ln__1bsigSzJZ-Iy3MQgmiZMnpBxC3TCQE0O72g5cAs,2459
517
+ holado_tools/tools/host_controller/server/rest/api/os.py,sha256=EA3DCxGBCnMd2XJyn9kb6IWmtbaPIyv5UfZypCNzkhY,2123
518
+ holado_tools/tools/host_controller/server/rest/api/docker/__init__.py,sha256=FlLRagAiw1LDxnF0CmW7Y6bVXuj8x6volT8-DuHTTVY,2427
519
+ holado_tools/tools/host_controller/server/rest/api/docker/container.py,sha256=6D612WF4chpDCzr4MBzZXzELxi-yOwrgxCxSBBVMcVo,2673
520
+ holado_tools/tools/host_viewer/client/rest/host_viewer_client.py,sha256=5-XFjImALKJwSG7H4eKL1QOsS5A-D7Y1kXrxONrZWK8,4360
521
+ holado_tools/tools/host_viewer/server/Dockerfile,sha256=dSdSaCAYZAjV4inHcLxjy8JlIqpo1lMNOSveAihvcOw,1484
522
+ holado_tools/tools/host_viewer/server/requirements.txt,sha256=0RvLV3t2DyBR2FsbAd1WVEcbsVc6FVUN2horQJU4POo,57
523
+ holado_tools/tools/host_viewer/server/run_host_viewer_in_docker.sh,sha256=XeJfyjPVj34-rK_9K_6C9iD0EiAZ2WVkoD1L5rvZzw4,3606
524
+ holado_tools/tools/host_viewer/server/rest/README,sha256=1FMg-U_D9pUMBVmZJsirOXHFLTciDL5jB-Yqzp9U6uM,163
525
+ holado_tools/tools/host_viewer/server/rest/initialize_holado.py,sha256=UxNphXyjs-xraorzMWjDe6-QYw_Q3mtykyY-ENYZB1o,3464
526
+ holado_tools/tools/host_viewer/server/rest/openapi.yaml,sha256=XP644LfEcDi7R9IV7_FIbRHpmw9Jlgtlfs-8qsc3DGQ,2788
527
+ holado_tools/tools/host_viewer/server/rest/run.py,sha256=jgJgmFFdppadLBahWU8Yw8-PdA5HJzBTDCPTPHGRzbA,2007
528
+ holado_tools/tools/host_viewer/server/rest/api/__init__.py,sha256=MTjW5ixe0v7jIjWkN_NovDHbHeVlb0VKkJRtC_oWlHc,1456
529
+ holado_tools/tools/host_viewer/server/rest/api/docker/__init__.py,sha256=FlLRagAiw1LDxnF0CmW7Y6bVXuj8x6volT8-DuHTTVY,2427
497
530
  holado_value/__init__.py,sha256=60VyLyWux76dFwn03uH4Fz3R6itf6fqKu0pQUdvwblU,1561
498
531
  holado_value/common/tables/value_table.py,sha256=fJgb-HWdlMwHOAx5CS38sPiVrjGelEiQBbG9HuHqe-A,1726
499
532
  holado_value/common/tables/value_table_cell.py,sha256=vCL8uSTEKOpI9G5f0epgJMArFxQidfWTCRHBZbdrsjc,3344
@@ -646,7 +679,7 @@ test_holado/tools/django/api_rest/api_rest/api1/serializers.py,sha256=o_YxFr-tgC
646
679
  test_holado/tools/django/api_rest/api_rest/api1/tests.py,sha256=mrbGGRNg5jwbTJtWWa7zSKdDyeB4vmgZCRc2nk6VY-g,60
647
680
  test_holado/tools/django/api_rest/api_rest/api1/views.py,sha256=kOt2xT6bxO47_z__5yYR9kcYIWWv4qYzpX0K8Tqonik,758
648
681
  test_holado/tools/django/api_rest/api_rest/api1/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
649
- holado-0.11.2.dist-info/METADATA,sha256=L3DvfWDcA_X7lolqA4a5NnxHE5FvhaSE2_8avKN8k8Y,7672
650
- holado-0.11.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
651
- holado-0.11.2.dist-info/licenses/LICENSE,sha256=IgGmNlcFHnbp7UWrLJqAFvs_HIgjJDTmjCNRircJLsk,1070
652
- holado-0.11.2.dist-info/RECORD,,
682
+ holado-0.11.3.dist-info/METADATA,sha256=WqOxGK8nQl9F-5TCd1mOpqI4VYDpMhStD355pcPKBWI,7660
683
+ holado-0.11.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
684
+ holado-0.11.3.dist-info/licenses/LICENSE,sha256=IgGmNlcFHnbp7UWrLJqAFvs_HIgjJDTmjCNRircJLsk,1070
685
+ holado-0.11.3.dist-info/RECORD,,
@@ -0,0 +1,38 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ #################################################
4
+ # HolAdo (Holistic Automation do)
5
+ #
6
+ # (C) Copyright 2021-2025 by Eric Klumpp
7
+ #
8
+ # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
11
+
12
+ # The Software is provided “as is”, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the Software.
13
+ #################################################
14
+
15
+
16
+ def configure_module():
17
+ """
18
+ Configure this module
19
+ Example: set new attributes in holado.holado_config.Config class
20
+ """
21
+ pass
22
+
23
+ def dependencies():
24
+ """
25
+ Return None or the list of names of modules it depend on
26
+ """
27
+ return None
28
+
29
+ def register():
30
+ """
31
+ Register the services of this module
32
+ """
33
+ # from holado.common.context.session_context import SessionContext
34
+
35
+ # from holado_xxx.xxx import XXXManager
36
+ # SessionContext.instance().services.register_service_type("xxx_manager", XXXManager)
37
+ pass
38
+
@@ -0,0 +1,36 @@
1
+ #################################################
2
+ # HolAdo (Holistic Automation do)
3
+ #
4
+ # (C) Copyright 2021-2025 by Eric Klumpp
5
+ #
6
+ # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
7
+ #
8
+ # The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9
+
10
+ # The Software is provided “as is”, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the Software.
11
+ #################################################
12
+
13
+ import logging
14
+
15
+ # Uncomment next lines to insert holado sources when using a clone of holado project rather than holado package
16
+ # from initialize_holado import insert_holado_source_paths # @UnresolvedImport
17
+ # insert_holado_source_paths()
18
+
19
+ # Initialize HolAdo
20
+ from holado import initialize_for_script
21
+ initialize_for_script(TSessionContext=None, use_holado_logger=True, logging_config_file_path=None,
22
+ log_level=logging.WARNING, log_time_in_utc=None, log_on_console=True, log_in_file=False,
23
+ config_kwargs={'application_group':'configuration'},
24
+ garbage_collector_periodicity=None)
25
+
26
+ # Script content
27
+ from holado.common.context.session_context import SessionContext
28
+ from holado_core.common.resource.persisted_method_to_call_manager import PersistedMethodToCallManager
29
+ from holado.common.handlers.undefined import any_value
30
+
31
+ persisted_method_to_call_manager = PersistedMethodToCallManager(scope_name=any_value)
32
+ persisted_method_to_call_manager.initialize(SessionContext.instance().resource_manager, SessionContext.instance().expression_evaluator)
33
+ if persisted_method_to_call_manager.does_persistent_db_exist():
34
+ persisted_method_to_call_manager.call_functions_and_methods(use="post_process")
35
+
36
+
@@ -0,0 +1,6 @@
1
+ #!/bin/bash
2
+
3
+ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
4
+
5
+ #${SCRIPT_DIR}/../../../run_test.sh -i /Configuration -t execute_persisted_post_processes
6
+ python3 "${SCRIPT_DIR}"/execute_persisted_post_processes.py
@@ -0,0 +1,62 @@
1
+
2
+ #################################################
3
+ # HolAdo (Holistic Automation do)
4
+ #
5
+ # (C) Copyright 2021-2025 by Eric Klumpp
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
8
+ #
9
+ # The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
10
+
11
+ # The Software is provided “as is”, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the Software.
12
+ #################################################
13
+
14
+
15
+ #################################################
16
+ # GOAL: Tools when using a clone of HolAdo project.
17
+ #
18
+ # This file contains methods usefull to initialize environments using a clone of HolAdo project.
19
+ #
20
+ # USAGE:
21
+ # - Copy this file in projects using HolAdo.
22
+ # - Define environment variable HOLADO_PATH with path to cloned HolAdo project.
23
+ # If HOLADO_PATH is defined, sources of cloned HolAdo project are used, else installed holado package is used.
24
+ #################################################
25
+
26
+
27
+
28
+ import os
29
+ import sys
30
+
31
+
32
+ def insert_sys_path(path, index=0):
33
+ """Insert a path in sys.path if it doesn't already exists.
34
+ """
35
+ if path not in sys.path:
36
+ sys.path.insert(index, path)
37
+
38
+ def insert_holado_source_paths(with_test_behave=True):
39
+ """Insert in sys.path all HolAdo source paths.
40
+ If environment variable HOLADO_PATH is defined with path to HolAdo project, following paths are inserted in sys.path:
41
+ - HOLADO_PATH/src: path to holado modules sources
42
+ - HOLADO_PATH/tests/behave (if with_test_behave==True): path to holado test sources, needed by testing solutions
43
+ """
44
+ holado_path = os.getenv('HOLADO_PATH')
45
+ if holado_path is None:
46
+ try:
47
+ import holado # @UnusedImport
48
+ except Exception as exc:
49
+ if "No module named" in str(exc):
50
+ raise Exception(f"If environment variable HOLADO_PATH is not defined with path to HolAdo project, 'holado' python package must be installed")
51
+ else:
52
+ raise exc
53
+ else:
54
+ # holado is installed, and all sources are already accessible
55
+ pass
56
+ else:
57
+ print(f"Using HolAdo project installed in '{holado_path}'")
58
+ insert_sys_path(os.path.join(holado_path, "src"))
59
+ if with_test_behave:
60
+ insert_sys_path(os.path.join(holado_path, "tests", "behave"))
61
+
62
+
@@ -0,0 +1,16 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ #################################################
4
+ # HolAdo (Holistic Automation do)
5
+ #
6
+ # (C) Copyright 2021-2025 by Eric Klumpp
7
+ #
8
+ # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
11
+
12
+ # The Software is provided “as is”, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the Software.
13
+ #################################################
14
+
15
+
16
+ from .tools.host_controller.client_steps import *
@@ -0,0 +1,97 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ #################################################
4
+ # HolAdo (Holistic Automation do)
5
+ #
6
+ # (C) Copyright 2021-2025 by Eric Klumpp
7
+ #
8
+ # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
11
+
12
+ # The Software is provided “as is”, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the Software.
13
+ #################################################
14
+
15
+
16
+ from holado.common.context.session_context import SessionContext
17
+ from holado_test.behave.behave import * # @UnusedWildImport
18
+ import logging
19
+ from holado_test.scenario.step_tools import StepTools
20
+ from holado_test.behave.scenario.behave_step_tools import BehaveStepTools
21
+ from holado_value.common.tables.converters.value_table_converter import ValueTableConverter
22
+ from holado_tools.tools.host_controller.client.rest.host_controller_client import HostControllerClient
23
+
24
+ logger = logging.getLogger(__name__)
25
+
26
+
27
+ def __get_scenario_context():
28
+ return SessionContext.instance().get_scenario_context()
29
+
30
+ def __get_variable_manager():
31
+ return __get_scenario_context().get_variable_manager()
32
+
33
+
34
+ @Given(r"(?P<var_name>{Variable}) = new Host Controller client")
35
+ def step_impl(context, var_name):
36
+ var_name = StepTools.evaluate_variable_name(var_name)
37
+ table = BehaveStepTools.get_step_table(context)
38
+ if table is not None:
39
+ kwargs = ValueTableConverter.convert_name_value_table_2_dict(table)
40
+ else:
41
+ kwargs = {}
42
+
43
+ res = HostControllerClient.new_client(**kwargs)
44
+
45
+ __get_variable_manager().register_variable(var_name, res)
46
+
47
+ @Step(r"(?P<var_name>{Variable}) = list containers \(Host Controller client: (?P<var_client>{Variable})\)")
48
+ def step_impl(context, var_name, var_client):
49
+ var_name = StepTools.evaluate_variable_name(var_name)
50
+ client = StepTools.evaluate_variable_value(var_client)
51
+
52
+ res = client.get_containers_status()
53
+
54
+ __get_variable_manager().register_variable(var_name, res)
55
+
56
+ @Step(r"(?P<var_name>{Variable}) = get information on container (?P<name>{Str}) \(Host Controller client: (?P<var_client>{Variable})\)")
57
+ def step_impl(context, var_name, name, var_client):
58
+ var_name = StepTools.evaluate_variable_name(var_name)
59
+ name = StepTools.evaluate_scenario_parameter(name)
60
+ client = StepTools.evaluate_variable_value(var_client)
61
+
62
+ res = client.get_container_info(name)
63
+
64
+ __get_variable_manager().register_variable(var_name, res)
65
+
66
+ @Step(r"(?:(?P<or_start_str>start or ))?restart container (?P<name>{Str}) \(Host Controller client: (?P<var_client>{Variable})\)")
67
+ def step_impl(context, or_start_str, name, var_client):
68
+ or_start = or_start_str is not None
69
+ name = StepTools.evaluate_scenario_parameter(name)
70
+ client = StepTools.evaluate_variable_value(var_client)
71
+
72
+ client.restart_container(name, start_if_gone=or_start)
73
+
74
+ @Step(r"start container (?P<name>{Str}) \(Host Controller client: (?P<var_client>{Variable})\)")
75
+ def step_impl(context, name, var_client):
76
+ name = StepTools.evaluate_scenario_parameter(name)
77
+ client = StepTools.evaluate_variable_value(var_client)
78
+
79
+ client.start_container(name)
80
+
81
+ @Step(r"stop container (?P<name>{Str})(?:(?P<if_started_str> if started))? \(Host Controller client: (?P<var_client>{Variable})\)")
82
+ def step_impl(context, name, if_started_str, var_client):
83
+ name = StepTools.evaluate_scenario_parameter(name)
84
+ if_started = if_started_str is not None
85
+ client = StepTools.evaluate_variable_value(var_client)
86
+
87
+ client.stop_container(name, raise_if_gone=not if_started)
88
+
89
+ @Step(r"wait container (?P<name>{Str})(?:(?P<if_started_str> if started))? \(Host Controller client: (?P<var_client>{Variable})\)")
90
+ def step_impl(context, name, if_started_str, var_client):
91
+ name = StepTools.evaluate_scenario_parameter(name)
92
+ if_started = if_started_str is not None
93
+ client = StepTools.evaluate_variable_value(var_client)
94
+
95
+ client.wait_container(name, raise_if_gone=not if_started)
96
+
97
+
@@ -0,0 +1,146 @@
1
+
2
+ #################################################
3
+ # HolAdo (Holistic Automation do)
4
+ #
5
+ # (C) Copyright 2021-2025 by Eric Klumpp
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
8
+ #
9
+ # The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
10
+
11
+ # The Software is provided “as is”, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the Software.
12
+ #################################################
13
+
14
+ import logging
15
+ from holado_rest.api.rest.rest_client import RestClient
16
+ from holado.common.handlers.undefined import default_value, undefined_argument,\
17
+ undefined_value
18
+ import os
19
+ from holado_core.common.tools.converters.converter import Converter
20
+ from holado_rest.api.rest.rest_manager import RestManager
21
+
22
+ logger = logging.getLogger(__name__)
23
+
24
+
25
+ class HostControllerClient(RestClient):
26
+
27
+ @classmethod
28
+ def new_client(cls, use_localhost=undefined_argument, **kwargs):
29
+ if 'name' not in kwargs:
30
+ kwargs['name'] = None
31
+ if 'url' not in kwargs:
32
+ if use_localhost is undefined_argument:
33
+ env_use = os.getenv("HOLADO_USE_LOCALHOST", False)
34
+ use_localhost = Converter.is_boolean(env_use) and Converter.to_boolean(env_use)
35
+
36
+ url = os.getenv("HOLADO_HOST_CONTROLLER_URL", undefined_value)
37
+ if url is undefined_value:
38
+ scheme = kwargs.get('scheme', undefined_value)
39
+ if scheme is undefined_value:
40
+ scheme = os.getenv("HOLADO_HOST_CONTROLLER_SCHEME", "http")
41
+ host = kwargs.get('host', undefined_value)
42
+ if host is undefined_value:
43
+ host = "localhost" if use_localhost else os.getenv("HOLADO_HOST_CONTROLLER_HOST", "holado_host_controller")
44
+ port = kwargs.get('port', undefined_value)
45
+ if port is undefined_value:
46
+ if use_localhost:
47
+ port = os.getenv("HOLADO_HOST_CONTROLLER_HOSTPORT", 51231)
48
+ else:
49
+ port = os.getenv("HOLADO_HOST_CONTROLLER_PORT", 51231)
50
+
51
+ if port is None:
52
+ url = f"{scheme}://{host}"
53
+ else:
54
+ url = f"{scheme}://{host}:{port}"
55
+ kwargs['url'] = url
56
+
57
+ manager = RestManager(default_client_class=HostControllerClient)
58
+ res = manager.new_client(**kwargs)
59
+
60
+ return res
61
+
62
+
63
+ def __init__(self, name, url, headers=None):
64
+ super().__init__(name, url, headers)
65
+
66
+ # Common features
67
+
68
+ def get_environment_variable_value(self, var_name):
69
+ data = [var_name]
70
+ response = self.get(f"os/env", json=data)
71
+ return self.response_result(response, status_ok=[200])
72
+
73
+ def get_directory_filenames(self, path, extension='.yml'):
74
+ data = {'path':path, 'extension':extension}
75
+ response = self.get(f"os/ls", json=data)
76
+ return self.response_result(response, status_ok=[200])
77
+
78
+
79
+ # Manage containers
80
+
81
+ def get_containers_status(self, all_=False):
82
+ if all_:
83
+ response = self.get("docker/container?all=true")
84
+ else:
85
+ response = self.get("docker/container")
86
+ return self.response_result(response, status_ok=[200,204])
87
+
88
+ def get_container_info(self, name, all_=False):
89
+ """Get container info
90
+ @return container info if found, else None
91
+ """
92
+ if all_:
93
+ response = self.get(f"docker/container/{name}?all=true")
94
+ else:
95
+ response = self.get(f"docker/container/{name}")
96
+ return self.response_result(response, status_ok=[200,204], result_on_statuses={204:None, default_value:None})
97
+
98
+ def restart_container(self, name, start_if_gone=False):
99
+ response = self.put(f"docker/container/{name}/restart")
100
+ if start_if_gone and response.status_code == 410:
101
+ return self.start_container(name)
102
+ else:
103
+ return self.response_result(response, status_ok=[200,204])
104
+
105
+ def start_container(self, name):
106
+ response = self.put(f"docker/container/{name}/start")
107
+ return self.response_result(response, status_ok=[200,204])
108
+
109
+ def stop_container(self, name, raise_if_gone=True):
110
+ response = self.put(f"docker/container/{name}/stop")
111
+ if not raise_if_gone and response.status_code == 410:
112
+ return None
113
+ else:
114
+ return self.response_result(response, status_ok=[200,204])
115
+
116
+ def wait_container(self, name, raise_if_gone=True):
117
+ response = self.put(f"docker/container/{name}/wait")
118
+ if not raise_if_gone and response.status_code == 410:
119
+ return None
120
+ else:
121
+ return self.response_result(response, status_ok=[200,204])
122
+
123
+
124
+ # Manage configuration
125
+
126
+ def update_yaml_file(self, file_path, text, with_backup=True, backup_extension='.ha_bak'):
127
+ data = {
128
+ 'file_path': file_path,
129
+ 'yaml_string': text,
130
+ 'with_backup': with_backup,
131
+ 'backup_extension': backup_extension
132
+ }
133
+ response = self.patch(f"config/yaml_file", json=data)
134
+ return self.response_result(response, status_ok=[200,204])
135
+
136
+ def restore_yaml_file(self, file_path, backup_extension='.ha_bak'):
137
+ data = {
138
+ 'action': 'restore',
139
+ 'file_path': file_path,
140
+ 'backup_extension': backup_extension
141
+ }
142
+ response = self.put(f"config/yaml_file", json=data)
143
+ return self.response_result(response, status_ok=[200,204])
144
+
145
+
146
+
@@ -0,0 +1,60 @@
1
+ ### Build
2
+
3
+ #FROM python:3.12.9-alpine3.21 AS build
4
+ #FROM python:3.12.11-alpine3.22 AS build
5
+ FROM python:3.12.12-alpine3.22 AS build
6
+
7
+ # Install to build python requirements
8
+ RUN apk update \
9
+ && apk --no-cache --update add build-base \
10
+ && apk --update add alpine-sdk \
11
+ && apk add libffi-dev
12
+
13
+ # Create user
14
+ RUN addgroup appuser \
15
+ && adduser -G appuser -s /bin/bash -D appuser
16
+
17
+ # Create /code folder
18
+ RUN mkdir /code \
19
+ && chown -R appuser:appuser /code
20
+
21
+ # Switch to user appuser
22
+ USER appuser
23
+
24
+ # Create python venv and install requirements
25
+ COPY --chown=appuser ./requirements.txt /code/host_controller/requirements.txt
26
+ WORKDIR /code/host_controller
27
+ RUN python -m venv /code/env \
28
+ && source /code/env/bin/activate \
29
+ && pip install --no-cache-dir -r requirements.txt
30
+
31
+
32
+
33
+ ### Runtime
34
+
35
+ #FROM python:3.12.9-alpine3.21 AS runtime
36
+ #FROM python:3.12.11-alpine3.22 AS runtime
37
+ FROM python:3.12.12-alpine3.22 AS runtime
38
+
39
+ # Add tools
40
+ RUN apk --no-cache add bash \
41
+ && apk --no-cache add nano \
42
+ && apk --no-cache add curl
43
+
44
+ # Create and switch to user appuser as in build
45
+ RUN addgroup appuser \
46
+ && adduser -G appuser -s /bin/bash -D appuser
47
+ USER appuser
48
+
49
+ # Copy /code from build
50
+ COPY --chown=appuser --from=build /code /code
51
+
52
+ # Copy host controller sources
53
+ COPY --chown=appuser ./rest /code/host_controller
54
+
55
+ # Activate permanently python venv
56
+ ENV PATH=/code/env/bin:$PATH
57
+
58
+ WORKDIR /code/host_controller
59
+ CMD ["sh", "-c", "uvicorn run:app --host 0.0.0.0 --port $HOLADO_HOST_CONTROLLER_PORT"]
60
+
@@ -0,0 +1,2 @@
1
+ WARNING: The content of this folder is not working yet
2
+ Use the REST version of Host Controller that is in ../rest folder
@@ -0,0 +1,26 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ #################################################
4
+ # HolAdo (Holistic Automation do)
5
+ #
6
+ # (C) Copyright 2021-2025 by Eric Klumpp
7
+ #
8
+ # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
11
+
12
+ # The Software is provided “as is”, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the Software.
13
+ #################################################
14
+
15
+ import os
16
+ import sys
17
+
18
+
19
+ # Add path to compiled proto files used by docker controler classes
20
+ here = os.path.abspath(os.path.dirname(__file__))
21
+ compiled_proto_path = os.path.normpath(os.path.join(here, "proto", "generated"))
22
+ if compiled_proto_path not in sys.path:
23
+ sys.path.append(compiled_proto_path)
24
+
25
+
26
+
@@ -0,0 +1,60 @@
1
+ import os
2
+ import sys
3
+ import shutil
4
+
5
+ here = os.path.abspath(os.path.dirname(__file__))
6
+
7
+ holado_src_path = os.path.normpath(os.path.join(here, "..", "..", "..", ".."))
8
+ holado_path = os.path.normpath(os.path.join(holado_src_path, ".."))
9
+ sys.path.insert(0, holado_src_path)
10
+ print(f"Inserted path: {holado_src_path}")
11
+
12
+ from holado_core.common.tools.path_manager import PathManager
13
+ # from holado_protobuf.ipc.protobuf.protobuf_compiler import ProtobufCompiler
14
+ from holado_grpc.ipc.rpc.grpc_compiler import GRpcCompiler
15
+
16
+ # def compile_protobuf_proto(remove_destination=True):
17
+ # # Define protoc path
18
+ # protoc_exe_path = os.path.join(holado_path, "dependencies", "protoc", "protoc-23.4-linux-x86_64", "bin", "protoc")
19
+ #
20
+ # # Define proto and generated paths
21
+ # proto_path = os.path.join(here, "definitions")
22
+ # destination_path = os.path.join(here, "generated")
23
+ #
24
+ # # Remove existing destination
25
+ # if remove_destination and os.path.exists(destination_path) and os.path.isdir(destination_path):
26
+ # shutil.rmtree(destination_path)
27
+ #
28
+ # protoc = ProtobufCompiler()
29
+ # protoc.protoc_exe_path = protoc_exe_path
30
+ #
31
+ # protoc.register_proto_path(os.path.join(proto_path, "xxx"), os.path.join(destination_path, "xxx"), os.path.join(proto_path, "xxx", "yyy"))
32
+ #
33
+ # protoc.compile_all_proto()
34
+
35
+ def compile_grpc_proto(remove_destination=True):
36
+ # Define proto and generated paths
37
+ proto_path = os.path.join(here, "definitions")
38
+ destination_path = os.path.join(here, "generated")
39
+
40
+ # Remove existing destination
41
+ if remove_destination and os.path.exists(destination_path) and os.path.isdir(destination_path):
42
+ if destination_path != proto_path:
43
+ shutil.rmtree(destination_path)
44
+ else:
45
+ path_manager = PathManager()
46
+ glob_pattern = os.path.join(destination_path, "*.py")
47
+ path_manager.remove_paths(glob_pattern)
48
+
49
+ protoc = GRpcCompiler()
50
+
51
+ protoc.register_proto_path(proto_path, destination_path)
52
+
53
+ protoc.compile_all_proto()
54
+
55
+ if __name__ == "__main__":
56
+ # compile_protobuf_proto()
57
+ # compile_grpc_proto(remove_destination=False)
58
+ compile_grpc_proto()
59
+
60
+