holado 0.10.1__py3-none-any.whl → 0.11.0__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 (61) hide show
  1. holado/common/context/session_context.py +1 -1
  2. {holado-0.10.1.dist-info → holado-0.11.0.dist-info}/METADATA +1 -1
  3. {holado-0.10.1.dist-info → holado-0.11.0.dist-info}/RECORD +33 -59
  4. holado_core/common/tools/path_manager.py +2 -2
  5. holado_docker/tests/behave/steps/__init__.py +1 -1
  6. holado_python/standard_library/ssl/resources/certificates/tcpbin.crt +16 -16
  7. holado_python/standard_library/ssl/resources/certificates/tcpbin.key +26 -26
  8. holado_report/campaign/campaign_manager.py +2 -2
  9. holado_report/report/builders/failure_report_builder.py +1 -1
  10. holado_report/report/builders/short_scenario_failed_report_builder.py +1 -1
  11. holado_report/report/builders/summary_scenario_by_category_report_builder.py +87 -0
  12. holado_report/report/builders/summary_scenario_failed_report_builder.py +1 -1
  13. holado_report/report/builders/summary_scenario_report_builder.py +1 -1
  14. holado_report/report/report_manager.py +40 -10
  15. holado_test/__init__.py +1 -1
  16. holado_test/{test_server → tools/test_server}/server/Dockerfile +6 -16
  17. holado_test/{test_server → tools/test_server}/server/core/server_context.py +1 -1
  18. holado_test/{test_server → tools/test_server}/server/rest/run.py +1 -1
  19. test_holado/features/Test/test_host_controller.feature +13 -0
  20. test_holado/logging.conf +1 -1
  21. holado_docker/tests/behave/steps/tools/docker_controller/client_steps.py +0 -97
  22. holado_docker/tools/docker_controller/client/rest/docker_controller_client.py +0 -143
  23. holado_docker/tools/docker_controller/server/Dockerfile +0 -70
  24. holado_docker/tools/docker_controller/server/grpc/README +0 -2
  25. holado_docker/tools/docker_controller/server/grpc/__init__.py +0 -26
  26. holado_docker/tools/docker_controller/server/grpc/proto/compile_proto.py +0 -60
  27. holado_docker/tools/docker_controller/server/grpc/proto/definitions/docker_controler.proto +0 -63
  28. holado_docker/tools/docker_controller/server/requirements.txt +0 -2
  29. holado_docker/tools/docker_controller/server/rest/README +0 -2
  30. holado_docker/tools/docker_controller/server/rest/api/__init__.py +0 -40
  31. holado_docker/tools/docker_controller/server/rest/api/config.py +0 -57
  32. holado_docker/tools/docker_controller/server/rest/api/container.py +0 -55
  33. holado_docker/tools/docker_controller/server/rest/api/os.py +0 -47
  34. holado_docker/tools/docker_controller/server/rest/openapi.yaml +0 -265
  35. holado_docker/tools/docker_controller/server/rest/run.py +0 -31
  36. holado_docker/tools/docker_controller/server/run_docker_controller_in_docker.sh +0 -102
  37. holado_docker/tools/docker_viewer/client/rest/docker_viewer_client.py +0 -40
  38. holado_docker/tools/docker_viewer/docker_viewer_manager.py +0 -44
  39. holado_docker/tools/docker_viewer/server/Dockerfile +0 -70
  40. holado_docker/tools/docker_viewer/server/requirements.txt +0 -2
  41. holado_docker/tools/docker_viewer/server/rest/README +0 -2
  42. holado_docker/tools/docker_viewer/server/rest/api/__init__.py +0 -40
  43. holado_docker/tools/docker_viewer/server/rest/initialize_holado.py +0 -72
  44. holado_docker/tools/docker_viewer/server/rest/openapi.yaml +0 -58
  45. holado_docker/tools/docker_viewer/server/rest/run.py +0 -31
  46. holado_docker/tools/docker_viewer/server/run_docker_viewer_in_docker.sh +0 -101
  47. holado_test/test_server/server/rest/initialize_holado.py +0 -72
  48. test_holado/features/Test/test_docker_controller.feature +0 -13
  49. {holado-0.10.1.dist-info → holado-0.11.0.dist-info}/WHEEL +0 -0
  50. {holado-0.10.1.dist-info → holado-0.11.0.dist-info}/licenses/LICENSE +0 -0
  51. /holado_test/{test_server → tools/test_server}/client/rest/test_server_client.py +0 -0
  52. /holado_test/{test_server → tools/test_server}/server/core/server_manager.py +0 -0
  53. /holado_test/{test_server → tools/test_server}/server/requirements.txt +0 -0
  54. /holado_test/{test_server → tools/test_server}/server/rest/README +0 -0
  55. /holado_test/{test_server → tools/test_server}/server/rest/api/__init__.py +0 -0
  56. /holado_test/{test_server → tools/test_server}/server/rest/api/campaign/__init__.py +0 -0
  57. /holado_test/{test_server → tools/test_server}/server/rest/api/campaign/scenario.py +0 -0
  58. {holado_docker/tools/docker_controller → holado_test/tools/test_server}/server/rest/initialize_holado.py +0 -0
  59. /holado_test/{test_server → tools/test_server}/server/rest/logging.conf +0 -0
  60. /holado_test/{test_server → tools/test_server}/server/rest/openapi.yaml +0 -0
  61. /holado_test/{test_server → tools/test_server}/server/run_test_server_in_docker.sh +0 -0
@@ -1,47 +0,0 @@
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
- from flask.views import MethodView
14
- from holado.common.context.session_context import SessionContext
15
- import os
16
-
17
- def _get_session_context():
18
- return SessionContext.instance()
19
-
20
-
21
- class EnvView(MethodView):
22
-
23
- def get(self, body: list):
24
- res = [os.getenv(name) for name in body]
25
- return res
26
-
27
-
28
- class LsView(MethodView):
29
-
30
- def get(self, body: dict):
31
- dir_path = body['path']
32
- extension = body.get('extension', None)
33
-
34
- if not os.path.exists(dir_path) or not os.path.isdir(dir_path):
35
- return f"Directory '{dir_path}' doesn't exist", 406
36
-
37
- res = []
38
- for filename in os.listdir(dir_path):
39
- if extension is not None and not filename.endswith(extension):
40
- continue
41
- if os.path.isfile(os.path.join(dir_path, filename)):
42
- res.append(filename)
43
-
44
- return res
45
-
46
-
47
-
@@ -1,265 +0,0 @@
1
- openapi: "3.0.0"
2
- info:
3
- version: "1"
4
- title: "Docker Controller API"
5
- description: |
6
- API to process some docker actions from anywhere on the network.
7
- In a microservice architecture, the docker controller can be run in a docker with special privileges,
8
- whereas all other microservices have user privileges.
9
- For example, it is usefull for a testing solution needing to restart a microservice of the SUT (System Under Test),
10
- but the testing solution docker image has not the privileges to do it.
11
- paths:
12
- /os/env:
13
- get:
14
- description: "Get environment variable values"
15
- requestBody:
16
- content:
17
- application/json:
18
- schema:
19
- type: "array"
20
- items:
21
- type: "string"
22
- responses:
23
- 200:
24
- description: "Environment variable values"
25
- content:
26
- application/json:
27
- schema:
28
- type: "array"
29
- items:
30
- type: "object"
31
-
32
- /os/ls:
33
- get:
34
- description: "List directory filenames"
35
- requestBody:
36
- content:
37
- application/json:
38
- schema:
39
- type: "object"
40
- properties:
41
- path:
42
- type: string
43
- extension:
44
- type: string
45
- nullable: true
46
- responses:
47
- 200:
48
- description: "Directory filenames"
49
- content:
50
- application/json:
51
- schema:
52
- type: "array"
53
- items:
54
- type: "string"
55
-
56
- /container:
57
- get:
58
- description: "List containers and their status"
59
- parameters:
60
- - in: "query"
61
- name: "all"
62
- description: "if set to 'true', list all containers, not only running ones"
63
- schema:
64
- type: "boolean"
65
- default: false
66
- responses:
67
- 200:
68
- description: "List of container names with their status"
69
- content:
70
- application/json:
71
- schema:
72
- type: "array"
73
- items:
74
- type: "string"
75
- /container/{name}:
76
- get:
77
- description: "Display all information of a container"
78
- parameters:
79
- - in: "path"
80
- name: "name"
81
- description: "Container name"
82
- required: true
83
- schema:
84
- type: "string"
85
- - in: "query"
86
- name: "all"
87
- description: "if set to 'true', search container in all containers, not only running ones"
88
- schema:
89
- type: "boolean"
90
- default: false
91
- responses:
92
- 200:
93
- description: "Container information"
94
- content:
95
- application/json:
96
- schema:
97
- type: "string"
98
- /container/{name}/restart:
99
- put:
100
- description: "Restart a container"
101
- parameters:
102
- - in: "path"
103
- name: "name"
104
- description: "Container name"
105
- required: true
106
- schema:
107
- type: "string"
108
- requestBody:
109
- content:
110
- application/json:
111
- schema:
112
- type: "object"
113
- nullable: true
114
- responses:
115
- 200:
116
- description: ""
117
- content:
118
- application/json:
119
- schema:
120
- type: "string"
121
- /container/{name}/start:
122
- put:
123
- description: "Start a container"
124
- parameters:
125
- - in: "path"
126
- name: "name"
127
- description: "Container name"
128
- required: true
129
- schema:
130
- type: "string"
131
- requestBody:
132
- content:
133
- application/json:
134
- schema:
135
- type: "object"
136
- nullable: true
137
- responses:
138
- 200:
139
- description: ""
140
- content:
141
- application/json:
142
- schema:
143
- type: "string"
144
- /container/{name}/stop:
145
- put:
146
- description: "Stop a container"
147
- parameters:
148
- - in: "path"
149
- name: "name"
150
- description: "Container name"
151
- required: true
152
- schema:
153
- type: "string"
154
- requestBody:
155
- content:
156
- application/json:
157
- schema:
158
- type: "object"
159
- nullable: true
160
- responses:
161
- 200:
162
- description: ""
163
- content:
164
- application/json:
165
- schema:
166
- type: "string"
167
- /container/{name}/wait:
168
- put:
169
- description: "Wait until a container is stopped"
170
- parameters:
171
- - in: "path"
172
- name: "name"
173
- description: "Container name"
174
- required: true
175
- schema:
176
- type: "string"
177
- requestBody:
178
- content:
179
- application/json:
180
- schema:
181
- type: "object"
182
- nullable: true
183
- responses:
184
- 200:
185
- description: ""
186
- content:
187
- application/json:
188
- schema:
189
- type: "string"
190
-
191
- /config/yaml_file:
192
- get:
193
- description: "Get content of a YAML file"
194
- requestBody:
195
- content:
196
- application/json:
197
- schema:
198
- type: "object"
199
- properties:
200
- file_path:
201
- type: string
202
- responses:
203
- 200:
204
- description: ""
205
- content:
206
- application/text:
207
- schema:
208
- type: "string"
209
- patch:
210
- description: "Update a YAML file"
211
- requestBody:
212
- content:
213
- application/json:
214
- schema:
215
- type: "object"
216
- properties:
217
- file_path:
218
- type: string
219
- yaml_string:
220
- type: string
221
- with_backup:
222
- type: "boolean"
223
- default: false
224
- backup_extension:
225
- type: string
226
- default: '.bak'
227
- responses:
228
- 200:
229
- description: ""
230
- content:
231
- application/json:
232
- schema:
233
- type: "string"
234
- put:
235
- description: "Replace a YAML file"
236
- requestBody:
237
- content:
238
- application/json:
239
- schema:
240
- type: "object"
241
- properties:
242
- action:
243
- description: "Action to perform"
244
- type: string
245
- enum:
246
- - "restore"
247
- file_path:
248
- type: string
249
- backup_extension:
250
- type: string
251
- default: '.bak'
252
- responses:
253
- 200:
254
- description: ""
255
- content:
256
- application/json:
257
- schema:
258
- type: "string"
259
-
260
- components:
261
- securitySchemes: {}
262
- schemas:
263
- DockerControler:
264
- properties: {}
265
-
@@ -1,31 +0,0 @@
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 connexion
14
- from connexion.resolver import MethodViewResolver
15
-
16
- # For debug with HolAdo sources, insert HolAdo source paths
17
- from initialize_holado import insert_holado_source_paths # @UnresolvedImport
18
- insert_holado_source_paths(with_test_behave=False)
19
-
20
- # Initialize HolAdo
21
- from holado import initialize
22
- initialize(TSessionContext=None, use_holado_logger=True, logging_config_file_path=None,
23
- log_level=None, log_time_in_utc=None, log_on_console=True, log_in_file=False,
24
- config_kwargs={'application_group':'docker_controller'},
25
- garbage_collector_periodicity=None)
26
-
27
-
28
- app = connexion.FlaskApp(__name__, pythonic_params=True)
29
- app.add_api('openapi.yaml',
30
- resolver=MethodViewResolver('api'), resolver_error=501,
31
- pythonic_params=True)
@@ -1,102 +0,0 @@
1
- #!/bin/bash
2
-
3
- # Script to launch Docker Controller as a docker image.
4
- #
5
- # Docker Controller exposes a REST API for some docker commands.
6
- # It is accessible on localhost, and also on a docker network if HOLADO_NETWORK is defined.
7
- # On all networks, API is accessible on same port (HOLADO_DOCKER_CONTROLLER_PORT or 8000).
8
- #
9
- # REST API specification is in file rest/openapi.yaml.
10
- #
11
- # REQUIREMENTS:
12
- # Have access to any HolAdo registry.
13
- #
14
- # Optionally, define in .profile the following variables
15
- # - HOLADO_DOCKER_CONTROLLER_HOST: host name or name of the container
16
- # - HOLADO_DOCKER_CONTROLLER_PORT: REST API port to use (default: 51231)
17
- # - HOLADO_IMAGE_REGISTRY: docker image registry to use (default: holado/docker_controller)
18
- # - HOLADO_IMAGE_TAG: docker image tag to use (default: latest)
19
- # - HOLADO_OUTPUT_BASEDIR: absolute path to base output directory (default: [HOME]/.holado/output)
20
- # - HOLADO_USE_LOCALHOST: force the container network to 'host'.
21
- # - HOLADO_NETWORK: specify on which network the docker is run.
22
- #
23
-
24
-
25
- WORK_DIR="$(pwd)"
26
-
27
- if [[ -z "$HOLADO_IMAGE_REGISTRY" ]]; then
28
- HOLADO_IMAGE_REGISTRY=holado/docker_controller
29
- fi
30
- if [[ -z "$HOLADO_IMAGE_TAG" ]]; then
31
- HOLADO_IMAGE_TAG=latest
32
- fi
33
- CONTROLLER_IMAGE=${HOLADO_IMAGE_REGISTRY}:${HOLADO_IMAGE_TAG}
34
-
35
- # Update docker image
36
- echo "Updating docker image ${CONTROLLER_IMAGE}..."
37
- docker pull ${CONTROLLER_IMAGE}
38
-
39
- # Define test output directory
40
- if [[ ! -z "$HOLADO_OUTPUT_BASEDIR" ]]; then
41
- OUTPUT_DIR=${HOLADO_OUTPUT_BASEDIR}
42
- else
43
- OUTPUT_DIR=${HOME}/.holado/output
44
- fi
45
- echo "Output directory: $OUTPUT_DIR"
46
-
47
- # Define test resources directory
48
- if [[ ! -z "$HOLADO_LOCAL_RESOURCES_BASEDIR" ]]; then
49
- RESOURCES_DIR=${HOLADO_LOCAL_RESOURCES_BASEDIR}
50
- else
51
- RESOURCES_DIR=${HOME}/.holado/resources
52
- fi
53
- echo "Resources directory: $RESOURCES_DIR"
54
-
55
- # Make dirs
56
- if [ ! -d ${OUTPUT_DIR} ]; then
57
- echo "Create output directory: ${OUTPUT_DIR}"
58
- mkdir -p ${OUTPUT_DIR}
59
- fi
60
- if [ ! -d ${RESOURCES_DIR} ]; then
61
- echo "Create resources directory: ${RESOURCES_DIR}"
62
- mkdir -p ${RESOURCES_DIR}
63
- fi
64
-
65
- # Define container network
66
- if [ "$HOLADO_USE_LOCALHOST" = True ]; then
67
- NETWORK_DEF_COMMAND="--network=host"
68
- else
69
- if [[ ! -z "$HOLADO_NETWORK" ]]; then
70
- NETWORK_DEF_COMMAND="--network $HOLADO_NETWORK"
71
- else
72
- NETWORK_DEF_COMMAND=""
73
- fi
74
- fi
75
-
76
- # Define port to use
77
- if [[ -z "$HOLADO_DOCKER_CONTROLLER_PORT" ]]; then
78
- HOLADO_DOCKER_CONTROLLER_PORT=51231
79
- fi
80
-
81
-
82
- # Docker run
83
- if [[ -z "$HOLADO_DOCKER_CONTROLLER_NAME" ]]; then
84
- HOLADO_DOCKER_CONTROLLER_NAME=holado_docker_controller
85
- fi
86
-
87
- echo
88
- echo "Running Docker Controller (docker name: ${HOLADO_DOCKER_CONTROLLER_NAME})..."
89
- echo " port: ${HOLADO_DOCKER_CONTROLLER_PORT}"
90
- #echo " NETWORK_DEF_COMMAND=${NETWORK_DEF_COMMAND}"
91
- echo
92
- docker run --rm --user root --name ${HOLADO_DOCKER_CONTROLLER_NAME} \
93
- --privileged -v $(docker info | grep -i rootless > /dev/null && echo -n "/run/user/$(id -u ${USER})/docker.sock" || echo -n "/var/run/docker.sock"):/var/run/docker.sock \
94
- -v "${OUTPUT_DIR}":/output \
95
- -v "${RESOURCES_DIR}":/resources \
96
- -e HOLADO_OUTPUT_BASEDIR=/output \
97
- -e HOLADO_LOCAL_RESOURCES_BASEDIR=/resources \
98
- -e HOLADO_DOCKER_CONTROLLER_PORT=${HOLADO_DOCKER_CONTROLLER_PORT} \
99
- ${NETWORK_DEF_COMMAND} \
100
- -p ${HOLADO_DOCKER_CONTROLLER_PORT}:${HOLADO_DOCKER_CONTROLLER_PORT} \
101
- ${CONTROLLER_IMAGE}
102
-
@@ -1,40 +0,0 @@
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
-
17
- logger = logging.getLogger(__name__)
18
-
19
-
20
- class DockerViewerClient(RestClient):
21
-
22
- def __init__(self, name, url, headers=None):
23
- super().__init__(name, url, headers)
24
-
25
- def get_containers_status(self, all_=False):
26
- if all_:
27
- response = self.get("container?all=true")
28
- else:
29
- response = self.get("container")
30
- return self.response_result(response, status_ok=[200,204])
31
-
32
- def get_container_info(self, name, all_=False):
33
- if all_:
34
- response = self.get(f"container/{name}?all=true")
35
- else:
36
- response = self.get(f"container/{name}")
37
- return self.response_result(response, status_ok=[200,204])
38
-
39
-
40
-
@@ -1,44 +0,0 @@
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_core.common.tools.converters.converter import Converter
16
- import os
17
- from holado_rest.api.rest.rest_manager import RestManager
18
- from holado_docker.tools.docker_viewer.client.rest.docker_viewer_client import DockerViewerClient
19
-
20
- logger = logging.getLogger(__name__)
21
-
22
-
23
- class DockerViewerManager(object):
24
-
25
- @classmethod
26
- def new_client(cls, **kwargs):
27
- if 'name' not in kwargs:
28
- kwargs['name'] = None
29
- if 'url' not in kwargs:
30
- env_use = os.getenv("HOLADO_USE_LOCALHOST", False)
31
- use_localhost = Converter.is_boolean(env_use) and Converter.to_boolean(env_use)
32
-
33
- host = "localhost" if use_localhost else os.getenv("HOLADO_DOCKER_VIEWER_NAME", "holado_docker_viewer")
34
- port = os.getenv("HOLADO_DOCKER_VIEWER_PORT", 8000)
35
- kwargs['url'] = f"http://{host}:{port}"
36
-
37
- manager = RestManager(default_client_class=DockerViewerClient)
38
- res = manager.new_client(**kwargs)
39
-
40
- return res
41
-
42
-
43
-
44
-
@@ -1,70 +0,0 @@
1
- ### Build
2
-
3
- #FROM python:3.12.9-alpine3.21 AS build
4
- FROM python:3.12.11-alpine3.22 AS build
5
-
6
- # Install to build python requirements
7
- RUN apk update \
8
- && apk --no-cache --update add build-base \
9
- && apk --update add alpine-sdk \
10
- && apk add libffi-dev \
11
- && apk add postgresql-dev gcc python3-dev musl-dev \
12
- && apk add protobuf-dev
13
-
14
- # Add tools
15
- RUN apk --no-cache add bash \
16
- && apk --no-cache add nano \
17
- && apk --no-cache add curl
18
-
19
- # Create user
20
- RUN addgroup appuser \
21
- && adduser -G appuser -s /bin/bash -D appuser
22
-
23
- # Create /code folder
24
- RUN mkdir /code \
25
- && chown -R appuser:appuser /code
26
-
27
- # Switch to user appuser
28
- USER appuser
29
-
30
- # Create python venv and install requirements
31
- COPY --chown=appuser ./requirements.txt /code/docker_viewer/requirements.txt
32
- WORKDIR /code/docker_viewer
33
- RUN python -m venv /code/env \
34
- && source /code/env/bin/activate \
35
- && pip install -r requirements.txt
36
-
37
-
38
-
39
- ### Runtime
40
-
41
- #FROM python:3.12.9-alpine3.21 AS runtime
42
- FROM python:3.12.11-alpine3.22 AS runtime
43
-
44
- # Install for python requirements
45
- #RUN apk update \
46
- # && apk --no-cache add libstdc++ \
47
- # && apk --no-cache add postgresql-dev gcc python3-dev musl-dev
48
-
49
- # Add tools
50
- RUN apk --no-cache add bash \
51
- && apk --no-cache add nano \
52
- && apk --no-cache add curl
53
-
54
- # Create and switch to user appuser as in build
55
- RUN addgroup appuser \
56
- && adduser -G appuser -s /bin/bash -D appuser
57
- USER appuser
58
-
59
- # Copy /code from build
60
- COPY --chown=appuser --from=build /code /code
61
-
62
- # Copy docker viewer sources
63
- COPY --chown=appuser ./rest /code/docker_viewer
64
-
65
- # Activate permanently python venv
66
- ENV PATH=/code/env/bin:$PATH
67
-
68
- WORKDIR /code/docker_viewer
69
- CMD ["sh", "-c", "uvicorn run:app --host 0.0.0.0 --port $HOLADO_DOCKER_VIEWER_PORT"]
70
-
@@ -1,2 +0,0 @@
1
- # HolAdo framework
2
- holado[api-connexion,docker,ssl,yaml]
@@ -1,2 +0,0 @@
1
- REST API specification is described in openapi.yaml.
2
- If Docker Viewer is running, the specification can be displayed with path /ui (ex: http://127.0.0.1:8000/ui).
@@ -1,40 +0,0 @@
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
- from flask.views import MethodView
14
- from holado.common.context.session_context import SessionContext
15
- import logging
16
-
17
- logger = logging.getLogger(__name__)
18
-
19
-
20
-
21
- def _get_session_context():
22
- return SessionContext.instance()
23
-
24
- class ContainerView(MethodView):
25
-
26
- def get(self, name=None, all_=False, limit=100):
27
- _get_session_context().docker_client.update_containers(all_=all_)
28
- if name is not None:
29
- if not _get_session_context().docker_client.has_container(name, in_list=False, all_=all_, reset_if_removed=False):
30
- if all_:
31
- return f"Container '{name}' doesn't exist", 406
32
- else:
33
- return f"Container '{name}' is not running (try with '?all=true' to get information on existing but not running containers)", 406
34
-
35
- cont = _get_session_context().docker_client.get_container(name, all_=all_)
36
- res = cont.information
37
- else:
38
- names = _get_session_context().docker_client.get_container_names(in_list=False, all_=all_)
39
- res = [{'name':n, 'status':_get_session_context().docker_client.get_container(n, all_=all_).status} for n in names]
40
- return res