holado 0.5.3__py3-none-any.whl → 0.6.1__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.
- {holado-0.5.3.dist-info → holado-0.6.1.dist-info}/METADATA +3 -1
- {holado-0.5.3.dist-info → holado-0.6.1.dist-info}/RECORD +41 -25
- holado_db/tools/db/clients/base/db_client.py +4 -3
- holado_docker/sdk/docker/docker_client.py +99 -24
- holado_docker/tests/behave/steps/__init__.py +1 -1
- holado_docker/tests/behave/steps/tools/docker_controller/client_steps.py +94 -0
- holado_docker/tools/docker_controller/client/rest/docker_controller_client.py +48 -0
- holado_docker/tools/docker_controller/docker_controller_manager.py +44 -0
- holado_docker/tools/docker_controller/server/Dockerfile +68 -0
- holado_docker/tools/docker_controller/server/grpc/README +2 -0
- holado_docker/tools/{docker_controler/docker_controler_client.py → docker_controller/server/grpc/docker_controller_client.py} +1 -1
- holado_docker/tools/{docker_controler/docker_controler_server.py → docker_controller/server/grpc/docker_controller_server.py} +3 -3
- holado_docker/tools/docker_controller/server/requirements.txt +3 -0
- holado_docker/tools/docker_controller/server/rest/api/__init__.py +41 -0
- holado_docker/tools/docker_controller/server/rest/api/container.py +55 -0
- holado_docker/tools/docker_controller/server/rest/initialize_holado.py +72 -0
- holado_docker/tools/docker_controller/server/rest/openapi.yaml +134 -0
- holado_docker/tools/docker_controller/server/rest/run.py +28 -0
- holado_docker/tools/docker_controller/server/run_docker_controller_in_docker.sh +101 -0
- holado_grpc/TODO +8 -0
- holado_helper/docker/run_holado_test_nonreg_in_docker.sh +2 -2
- holado_helper/docker/run_terminal_in_docker-with_docker_control.sh +1 -1
- holado_helper/docker/run_terminal_in_docker.sh +1 -1
- holado_python/standard_library/ssl/resources/certificates/tcpbin.crt +16 -16
- holado_python/standard_library/ssl/resources/certificates/tcpbin.key +26 -26
- holado_rest/api/rest/rest_client.py +2 -1
- holado_rest/api/rest/rest_manager.py +9 -3
- holado_rest/tests/behave/steps/private/api/rest_steps.py +0 -1
- holado_swagger/swagger_hub/mockserver/mockserver_manager.py +3 -2
- holado_test/tests/behave/steps/scenario/scenario_steps.py +14 -1
- test_holado/features/Test/test_docker_controller.feature +13 -0
- test_holado/features/Test/test_parameter.feature +15 -0
- test_holado/tools/connexion/api_rest/openapi.yaml +16 -0
- holado_docker/tests/behave/steps/tools/docker_steps.py → test_holado/tools/connexion/api_rest/run.py +5 -19
- {holado-0.5.3.dist-info → holado-0.6.1.dist-info}/WHEEL +0 -0
- {holado-0.5.3.dist-info → holado-0.6.1.dist-info}/licenses/LICENSE +0 -0
- /holado_docker/tools/{docker_controler → docker_controller/server/grpc}/__init__.py +0 -0
- /holado_docker/tools/{docker_controler → docker_controller/server/grpc}/proto/compile_proto.py +0 -0
- /holado_docker/tools/{docker_controler → docker_controller/server/grpc}/proto/definitions/docker_controler.proto +0 -0
- /holado_docker/tools/{docker_controler → docker_controller/server/grpc}/proto/generated/docker_controler_pb2.py +0 -0
- /holado_docker/tools/{docker_controler → docker_controller/server/grpc}/proto/generated/docker_controler_pb2_grpc.py +0 -0
|
@@ -16,10 +16,10 @@ import logging
|
|
|
16
16
|
logger = logging.getLogger(__name__)
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
class
|
|
19
|
+
class DockerControllerService(object):
|
|
20
|
+
pass
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
class DockerControlerServer(object):
|
|
22
|
+
class DockerControllerServer(object):
|
|
23
23
|
|
|
24
24
|
def __init__(self):
|
|
25
25
|
|
|
@@ -0,0 +1,41 @@
|
|
|
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
|
+
|
|
16
|
+
def _get_session_context():
|
|
17
|
+
return SessionContext.instance()
|
|
18
|
+
|
|
19
|
+
class ContainerView(MethodView):
|
|
20
|
+
|
|
21
|
+
# def post(self, body: dict):
|
|
22
|
+
# pass
|
|
23
|
+
#
|
|
24
|
+
# def put(self, container_name, body: dict):
|
|
25
|
+
# pass
|
|
26
|
+
#
|
|
27
|
+
# def delete(self, container_name):
|
|
28
|
+
# pass
|
|
29
|
+
|
|
30
|
+
def get(self, name=None, limit=100):
|
|
31
|
+
if name is not None:
|
|
32
|
+
if not _get_session_context().docker_client.has_container(name):
|
|
33
|
+
return f"Container '{name}' doesn't exist", 406
|
|
34
|
+
|
|
35
|
+
cont = _get_session_context().docker_client.get_container(name)
|
|
36
|
+
cont.container.reload()
|
|
37
|
+
res = cont.container.attrs
|
|
38
|
+
else:
|
|
39
|
+
names = _get_session_context().docker_client.get_all_container_names()
|
|
40
|
+
res = [{'name':n, 'status':_get_session_context().docker_client.get_container(n).status} for n in names]
|
|
41
|
+
return res
|
|
@@ -0,0 +1,55 @@
|
|
|
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
|
+
|
|
16
|
+
def _get_session_context():
|
|
17
|
+
return SessionContext.instance()
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class RestartView(MethodView):
|
|
21
|
+
|
|
22
|
+
def put(self, name, body: dict):
|
|
23
|
+
if not _get_session_context().docker_client.has_container(name):
|
|
24
|
+
return f"Container '{name}' doesn't exist", 406
|
|
25
|
+
|
|
26
|
+
res = _get_session_context().docker_client.restart_container(name, wait_running=False)
|
|
27
|
+
return res
|
|
28
|
+
|
|
29
|
+
class StartView(MethodView):
|
|
30
|
+
|
|
31
|
+
def put(self, name, body: dict):
|
|
32
|
+
if not _get_session_context().docker_client.has_container(name):
|
|
33
|
+
return f"Container '{name}' doesn't exist", 406
|
|
34
|
+
|
|
35
|
+
res = _get_session_context().docker_client.start_container(name, wait_running=False)
|
|
36
|
+
return res
|
|
37
|
+
|
|
38
|
+
class StopView(MethodView):
|
|
39
|
+
|
|
40
|
+
def put(self, name, body: dict):
|
|
41
|
+
if not _get_session_context().docker_client.has_container(name):
|
|
42
|
+
return f"Container '{name}' doesn't exist", 406
|
|
43
|
+
|
|
44
|
+
res = _get_session_context().docker_client.stop_container(name)
|
|
45
|
+
return res
|
|
46
|
+
|
|
47
|
+
class WaitView(MethodView):
|
|
48
|
+
|
|
49
|
+
def put(self, name, body: dict):
|
|
50
|
+
if not _get_session_context().docker_client.has_container(name):
|
|
51
|
+
return f"Container '{name}' doesn't exist", 406
|
|
52
|
+
|
|
53
|
+
res = _get_session_context().docker_client.get_container(name).wait()
|
|
54
|
+
return res
|
|
55
|
+
|
|
@@ -0,0 +1,72 @@
|
|
|
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_sys_paths(list_paths, index=0):
|
|
39
|
+
"""Insert a list of path in sys.path if it doesn't already exists.
|
|
40
|
+
"""
|
|
41
|
+
if list_paths:
|
|
42
|
+
for path in list_paths:
|
|
43
|
+
insert_sys_path(path, index=index)
|
|
44
|
+
|
|
45
|
+
def insert_holado_source_paths(with_test_behave=True):
|
|
46
|
+
"""Insert in sys.path all HolAdo source paths.
|
|
47
|
+
If environment variable HOLADO_PATH is defined with path to HolAdo project, following paths are inserted in sys.path:
|
|
48
|
+
- HOLADO_PATH/src: path to holado modules sources
|
|
49
|
+
- HOLADO_PATH/tests/behave (if with_test_behave==True): path to holado test sources, needed by testing solutions
|
|
50
|
+
"""
|
|
51
|
+
holado_path = os.getenv('HOLADO_PATH')
|
|
52
|
+
if holado_path is None:
|
|
53
|
+
try:
|
|
54
|
+
import holado # @UnusedImport
|
|
55
|
+
except Exception as exc:
|
|
56
|
+
if "No module named" in str(exc):
|
|
57
|
+
raise Exception(f"If environment variable HOLADO_PATH is not defined with path to HolAdo project, 'holado' python package must be installed")
|
|
58
|
+
else:
|
|
59
|
+
raise exc
|
|
60
|
+
else:
|
|
61
|
+
# holado is installed, and all sources are already accessible
|
|
62
|
+
pass
|
|
63
|
+
else:
|
|
64
|
+
print(f"Using HolAdo project installed in '{holado_path}'")
|
|
65
|
+
# import traceback
|
|
66
|
+
# print("".join(traceback.format_list(traceback.extract_stack())))
|
|
67
|
+
# insert_sys_path(holado_path)
|
|
68
|
+
insert_sys_path(os.path.join(holado_path, "src"))
|
|
69
|
+
if with_test_behave:
|
|
70
|
+
insert_sys_path(os.path.join(holado_path, "tests", "behave"))
|
|
71
|
+
|
|
72
|
+
|
|
@@ -0,0 +1,134 @@
|
|
|
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
|
+
/container:
|
|
13
|
+
get:
|
|
14
|
+
description: "List containers and their status"
|
|
15
|
+
parameters: []
|
|
16
|
+
responses:
|
|
17
|
+
200:
|
|
18
|
+
description: ""
|
|
19
|
+
content:
|
|
20
|
+
application/json:
|
|
21
|
+
schema:
|
|
22
|
+
type: "array"
|
|
23
|
+
items:
|
|
24
|
+
type: "string"
|
|
25
|
+
/container/{name}:
|
|
26
|
+
get:
|
|
27
|
+
description: "Display all information of a container"
|
|
28
|
+
parameters:
|
|
29
|
+
- in: "path"
|
|
30
|
+
name: "name"
|
|
31
|
+
required: true
|
|
32
|
+
schema:
|
|
33
|
+
type: "string"
|
|
34
|
+
responses:
|
|
35
|
+
200:
|
|
36
|
+
description: ""
|
|
37
|
+
content:
|
|
38
|
+
application/json:
|
|
39
|
+
schema:
|
|
40
|
+
type: "string"
|
|
41
|
+
/container/{name}/restart:
|
|
42
|
+
put:
|
|
43
|
+
description: "Restart a container"
|
|
44
|
+
parameters:
|
|
45
|
+
- in: "path"
|
|
46
|
+
name: "name"
|
|
47
|
+
required: true
|
|
48
|
+
schema:
|
|
49
|
+
type: "string"
|
|
50
|
+
requestBody:
|
|
51
|
+
content:
|
|
52
|
+
application/json:
|
|
53
|
+
schema:
|
|
54
|
+
type: "object"
|
|
55
|
+
nullable: true
|
|
56
|
+
responses:
|
|
57
|
+
200:
|
|
58
|
+
description: ""
|
|
59
|
+
content:
|
|
60
|
+
application/json:
|
|
61
|
+
schema:
|
|
62
|
+
type: "string"
|
|
63
|
+
/container/{name}/start:
|
|
64
|
+
put:
|
|
65
|
+
description: "Start a container"
|
|
66
|
+
parameters:
|
|
67
|
+
- in: "path"
|
|
68
|
+
name: "name"
|
|
69
|
+
required: true
|
|
70
|
+
schema:
|
|
71
|
+
type: "string"
|
|
72
|
+
requestBody:
|
|
73
|
+
content:
|
|
74
|
+
application/json:
|
|
75
|
+
schema:
|
|
76
|
+
type: "object"
|
|
77
|
+
nullable: true
|
|
78
|
+
responses:
|
|
79
|
+
200:
|
|
80
|
+
description: ""
|
|
81
|
+
content:
|
|
82
|
+
application/json:
|
|
83
|
+
schema:
|
|
84
|
+
type: "string"
|
|
85
|
+
/container/{name}/stop:
|
|
86
|
+
put:
|
|
87
|
+
description: "Stop a container"
|
|
88
|
+
parameters:
|
|
89
|
+
- in: "path"
|
|
90
|
+
name: "name"
|
|
91
|
+
required: true
|
|
92
|
+
schema:
|
|
93
|
+
type: "string"
|
|
94
|
+
requestBody:
|
|
95
|
+
content:
|
|
96
|
+
application/json:
|
|
97
|
+
schema:
|
|
98
|
+
type: "object"
|
|
99
|
+
nullable: true
|
|
100
|
+
responses:
|
|
101
|
+
200:
|
|
102
|
+
description: ""
|
|
103
|
+
content:
|
|
104
|
+
application/json:
|
|
105
|
+
schema:
|
|
106
|
+
type: "string"
|
|
107
|
+
/container/{name}/wait:
|
|
108
|
+
put:
|
|
109
|
+
description: "Wait until a container is stopped"
|
|
110
|
+
parameters:
|
|
111
|
+
- in: "path"
|
|
112
|
+
name: "name"
|
|
113
|
+
required: true
|
|
114
|
+
schema:
|
|
115
|
+
type: "string"
|
|
116
|
+
requestBody:
|
|
117
|
+
content:
|
|
118
|
+
application/json:
|
|
119
|
+
schema:
|
|
120
|
+
type: "object"
|
|
121
|
+
nullable: true
|
|
122
|
+
responses:
|
|
123
|
+
200:
|
|
124
|
+
description: ""
|
|
125
|
+
content:
|
|
126
|
+
application/json:
|
|
127
|
+
schema:
|
|
128
|
+
type: "string"
|
|
129
|
+
components:
|
|
130
|
+
securitySchemes: {}
|
|
131
|
+
schemas:
|
|
132
|
+
DockerControler:
|
|
133
|
+
properties: {}
|
|
134
|
+
|
|
@@ -0,0 +1,28 @@
|
|
|
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_minimal
|
|
22
|
+
initialize_minimal()
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
app = connexion.FlaskApp(__name__, pythonic_params=True)
|
|
26
|
+
app.add_api('openapi.yaml',
|
|
27
|
+
resolver=MethodViewResolver('api'), resolver_error=501,
|
|
28
|
+
pythonic_params=True)
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Script to launch Docker Controler as a docker image.
|
|
4
|
+
#
|
|
5
|
+
# Docker Controler 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_PORT: REST API port to use (default: 8000)
|
|
16
|
+
# - HOLADO_IMAGE_REGISTRY: docker image registry to use (default: holado/docker_controler)
|
|
17
|
+
# - HOLADO_IMAGE_TAG: docker image tag to use (default: main)
|
|
18
|
+
# - HOLADO_OUTPUT_BASEDIR: absolute path to base output directory (default: [HOME]/.holado/output)
|
|
19
|
+
# - HOLADO_USE_LOCALHOST: force the container network to 'host'.
|
|
20
|
+
# - HOLADO_NETWORK: specify on which network the docker is run.
|
|
21
|
+
#
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
WORK_DIR="$(pwd)"
|
|
25
|
+
|
|
26
|
+
if [[ -z "$HOLADO_IMAGE_REGISTRY" ]]; then
|
|
27
|
+
HOLADO_IMAGE_REGISTRY=holado/docker_controler
|
|
28
|
+
fi
|
|
29
|
+
if [[ -z "$HOLADO_IMAGE_TAG" ]]; then
|
|
30
|
+
HOLADO_IMAGE_TAG=main
|
|
31
|
+
fi
|
|
32
|
+
CONTROLLER_IMAGE=${HOLADO_IMAGE_REGISTRY}:${HOLADO_IMAGE_TAG}
|
|
33
|
+
|
|
34
|
+
# Update docker image
|
|
35
|
+
echo "Updating docker image ${CONTROLLER_IMAGE}..."
|
|
36
|
+
docker pull ${CONTROLLER_IMAGE}
|
|
37
|
+
|
|
38
|
+
# Define test output directory
|
|
39
|
+
if [[ ! -z "$HOLADO_OUTPUT_BASEDIR" ]]; then
|
|
40
|
+
OUTPUT_DIR=${HOLADO_OUTPUT_BASEDIR}
|
|
41
|
+
else
|
|
42
|
+
OUTPUT_DIR=${HOME}/.holado/output
|
|
43
|
+
fi
|
|
44
|
+
echo "Output directory: $OUTPUT_DIR"
|
|
45
|
+
|
|
46
|
+
# Define test resources directory
|
|
47
|
+
if [[ ! -z "$HOLADO_LOCAL_RESOURCES_BASEDIR" ]]; then
|
|
48
|
+
RESOURCES_DIR=${HOLADO_LOCAL_RESOURCES_BASEDIR}
|
|
49
|
+
else
|
|
50
|
+
RESOURCES_DIR=${HOME}/.holado/resources
|
|
51
|
+
fi
|
|
52
|
+
echo "Resources directory: $RESOURCES_DIR"
|
|
53
|
+
|
|
54
|
+
# Make dirs
|
|
55
|
+
if [ ! -d ${OUTPUT_DIR} ]; then
|
|
56
|
+
echo "Create output directory: ${OUTPUT_DIR}"
|
|
57
|
+
mkdir -p ${OUTPUT_DIR}
|
|
58
|
+
fi
|
|
59
|
+
if [ ! -d ${RESOURCES_DIR} ]; then
|
|
60
|
+
echo "Create resources directory: ${RESOURCES_DIR}"
|
|
61
|
+
mkdir -p ${RESOURCES_DIR}
|
|
62
|
+
fi
|
|
63
|
+
|
|
64
|
+
# Define container network
|
|
65
|
+
if [ "$HOLADO_USE_LOCALHOST" = True ]; then
|
|
66
|
+
NETWORK_DEF_COMMAND="--network=host"
|
|
67
|
+
else
|
|
68
|
+
if [[ ! -z "$HOLADO_NETWORK" ]]; then
|
|
69
|
+
NETWORK_DEF_COMMAND="--network $HOLADO_NETWORK"
|
|
70
|
+
else
|
|
71
|
+
NETWORK_DEF_COMMAND=""
|
|
72
|
+
fi
|
|
73
|
+
fi
|
|
74
|
+
|
|
75
|
+
# Define port to use
|
|
76
|
+
if [[ -z "$HOLADO_DOCKER_CONTROLLER_PORT" ]]; then
|
|
77
|
+
HOLADO_DOCKER_CONTROLLER_PORT=8000
|
|
78
|
+
fi
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
# Docker run
|
|
82
|
+
if [[ -z "$HOLADO_DOCKER_CONTROLLER_NAME" ]]; then
|
|
83
|
+
HOLADO_DOCKER_CONTROLLER_NAME=holado_docker_controller
|
|
84
|
+
fi
|
|
85
|
+
|
|
86
|
+
echo
|
|
87
|
+
echo "Running Docker Controller (docker name: ${HOLADO_DOCKER_CONTROLLER_NAME})..."
|
|
88
|
+
echo " port: ${HOLADO_DOCKER_CONTROLLER_PORT}"
|
|
89
|
+
#echo " NETWORK_DEF_COMMAND=${NETWORK_DEF_COMMAND}"
|
|
90
|
+
echo
|
|
91
|
+
docker run --rm --user root --name ${HOLADO_DOCKER_CONTROLLER_NAME} \
|
|
92
|
+
--privileged -v /var/run/docker.sock:/var/run/docker.sock \
|
|
93
|
+
-v "${OUTPUT_DIR}":/output \
|
|
94
|
+
-v "${RESOURCES_DIR}":/resources \
|
|
95
|
+
-e HOLADO_OUTPUT_BASEDIR=/output \
|
|
96
|
+
-e HOLADO_LOCAL_RESOURCES_BASEDIR=/resources \
|
|
97
|
+
-e HOLADO_DOCKER_CONTROLLER_PORT=${HOLADO_DOCKER_CONTROLLER_PORT} \
|
|
98
|
+
${NETWORK_DEF_COMMAND} \
|
|
99
|
+
-p ${HOLADO_DOCKER_CONTROLLER_PORT}:${HOLADO_DOCKER_CONTROLLER_PORT} \
|
|
100
|
+
${CONTROLLER_IMAGE}
|
|
101
|
+
|
holado_grpc/TODO
ADDED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
# - HOLADO_OUTPUT_BASEDIR: absolute path to base output directory of testing solution
|
|
17
17
|
# - HOLADO_LOCAL_RESOURCES_BASEDIR: absolute path to base local resources directory of testing solution (where data are stored through campaigns)
|
|
18
18
|
# - optional:
|
|
19
|
-
# - HOLADO_IMAGE_REGISTRY: docker image registry to use (default: "registry.gitlab.com/
|
|
19
|
+
# - HOLADO_IMAGE_REGISTRY: docker image registry to use (default: "registry.gitlab.com/holado_framework/python")
|
|
20
20
|
# - HOLADO_USE_LOCALHOST: force the container network to 'host'.
|
|
21
21
|
# - HOLADO_NETWORK: specify on which network the docker is run.
|
|
22
22
|
# Example:
|
|
@@ -46,7 +46,7 @@ CWD="$(dirname "${BASH_SOURCE[0]}")"
|
|
|
46
46
|
WORK_DIR="$(pwd)"
|
|
47
47
|
|
|
48
48
|
if [[ -z "$HOLADO_IMAGE_REGISTRY" ]]; then
|
|
49
|
-
HOLADO_IMAGE_REGISTRY=registry.gitlab.com/
|
|
49
|
+
HOLADO_IMAGE_REGISTRY=registry.gitlab.com/holado_framework/python
|
|
50
50
|
fi
|
|
51
51
|
TEST_IMAGE=${HOLADO_IMAGE_REGISTRY}:${HOLADO_IMAGE_TAG}
|
|
52
52
|
|
|
@@ -37,7 +37,7 @@ done
|
|
|
37
37
|
WORK_DIR="$(pwd)"
|
|
38
38
|
|
|
39
39
|
if [[ -z "$HOLADO_IMAGE_REGISTRY" ]]; then
|
|
40
|
-
HOLADO_IMAGE_REGISTRY=registry.gitlab.com/
|
|
40
|
+
HOLADO_IMAGE_REGISTRY=registry.gitlab.com/holado_framework/python
|
|
41
41
|
fi
|
|
42
42
|
TEST_IMAGE=${HOLADO_IMAGE_REGISTRY}:${HOLADO_IMAGE_TAG}
|
|
43
43
|
|
|
@@ -37,7 +37,7 @@ done
|
|
|
37
37
|
WORK_DIR="$(pwd)"
|
|
38
38
|
|
|
39
39
|
if [[ -z "$HOLADO_IMAGE_REGISTRY" ]]; then
|
|
40
|
-
HOLADO_IMAGE_REGISTRY=registry.gitlab.com/
|
|
40
|
+
HOLADO_IMAGE_REGISTRY=registry.gitlab.com/holado_framework/python
|
|
41
41
|
fi
|
|
42
42
|
TEST_IMAGE=${HOLADO_IMAGE_REGISTRY}:${HOLADO_IMAGE_TAG}
|
|
43
43
|
|
|
@@ -2,20 +2,20 @@
|
|
|
2
2
|
MIIDZTCCAk2gAwIBAgIBKjANBgkqhkiG9w0BAQsFADCBizELMAkGA1UEBhMCVVMx
|
|
3
3
|
CzAJBgNVBAg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JPpCX8GD3seQvkU0XYcK6NKUjqS9EZvkL6T
|
|
21
|
+
nb72BCLOTYpV+VVfOJjGkteK6dKeuefaoYcYTGnDHTod476AMGL2cGjLawKBgCCk
|
|
22
|
+
/u37UcBFy8VJR+pwMwgs1EyQPmmLub+yk989jyRaeqF5cMRjiDt842ex9XQtVmr1
|
|
23
|
+
atT4FloK9t6jNiZ2WI0BRd3GU/Dcz5XdQY9wMYPxbgCsFJWELX+meoC7xAVWKPji
|
|
24
|
+
BD5ntS0RH8dsrOljqakE1crURTYapeqZgxBMRa3dAoGARc3CFtg97dEF4hoppiUk
|
|
25
|
+
q2+syv9KrBXef2WppvJQSc9H/EW3D32P6ypnEolAxeFYorOuboIJZ/gMwwVS+MxS
|
|
26
|
+
DGe7ECMHAy5lqjVmr7eoIww9uF5TgRr2JLusBNx7yryxGoCVWSx8cCMU7aNEy50a
|
|
27
|
+
WSQlBcP2uB80Va+Ms/NxWQ4=
|
|
28
28
|
-----END PRIVATE KEY-----
|
|
@@ -75,7 +75,8 @@ class RestClient(object):
|
|
|
75
75
|
else:
|
|
76
76
|
res = response.content
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
is_ok = isinstance(status_ok, list) and response.status_code in status_ok or response.status_code == status_ok
|
|
79
|
+
if not is_ok:
|
|
79
80
|
raise FunctionalException(f"[{self.name}] Request failed with status {response.status_code} (expected success status: {status_ok}) on error: {res}")
|
|
80
81
|
|
|
81
82
|
return res
|
|
@@ -16,6 +16,7 @@ from holado_core.common.exceptions.technical_exception import TechnicalException
|
|
|
16
16
|
from holado_core.common.exceptions.functional_exception import FunctionalException
|
|
17
17
|
from holado_core.common.tools.tools import Tools
|
|
18
18
|
from holado_rest.api.rest.rest_client import RestClient
|
|
19
|
+
from holado.common.handlers.undefined import undefined_argument
|
|
19
20
|
|
|
20
21
|
|
|
21
22
|
logger = logging.getLogger(__name__)
|
|
@@ -27,6 +28,9 @@ class RestManager(object):
|
|
|
27
28
|
Manage REST features, agnostic to internal REST library.
|
|
28
29
|
"""
|
|
29
30
|
|
|
31
|
+
def __init__(self, default_client_class=RestClient):
|
|
32
|
+
self.__default_client_class = default_client_class
|
|
33
|
+
|
|
30
34
|
def new_client(self, name, **kwargs):
|
|
31
35
|
if name is None:
|
|
32
36
|
name = f"RestClient({kwargs})"
|
|
@@ -34,10 +38,12 @@ class RestManager(object):
|
|
|
34
38
|
headers = Tools.pop_sub_kwargs(kwargs, "headers.")
|
|
35
39
|
authentication = Tools.pop_sub_kwargs(kwargs, "authentication.")
|
|
36
40
|
ssl_kwargs = Tools.pop_sub_kwargs(kwargs, "ssl.")
|
|
41
|
+
rest_client_kwargs = Tools.pop_sub_kwargs(kwargs, "rest_client.")
|
|
42
|
+
rest_client_class = rest_client_kwargs.pop("class", self.__default_client_class)
|
|
37
43
|
if len(kwargs) > 0:
|
|
38
44
|
raise TechnicalException(f"Unmanaged arguments: {kwargs}")
|
|
39
45
|
|
|
40
|
-
res = self._new_rest_client(name, url, headers)
|
|
46
|
+
res = self._new_rest_client(name, url, headers, client_class=rest_client_class, **rest_client_kwargs)
|
|
41
47
|
|
|
42
48
|
# Manage authentication if needed
|
|
43
49
|
if len(authentication) > 0:
|
|
@@ -60,8 +66,8 @@ class RestManager(object):
|
|
|
60
66
|
|
|
61
67
|
return res
|
|
62
68
|
|
|
63
|
-
def _new_rest_client(self, name, url, headers):
|
|
64
|
-
return
|
|
69
|
+
def _new_rest_client(self, name, url, headers=None, client_class=RestClient, **kwargs):
|
|
70
|
+
return client_class(name, url, headers=headers, **kwargs)
|
|
65
71
|
|
|
66
72
|
|
|
67
73
|
|