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.
- {holado-0.11.2.dist-info → holado-0.11.3.dist-info}/METADATA +2 -2
- {holado-0.11.2.dist-info → holado-0.11.3.dist-info}/RECORD +37 -4
- holado_tools/__init__.py +38 -0
- holado_tools/scripts/execute_persisted_post_processes/execute_persisted_post_processes.py +36 -0
- holado_tools/scripts/execute_persisted_post_processes/execute_persisted_post_processes.sh +6 -0
- holado_tools/scripts/execute_persisted_post_processes/initialize_holado.py +62 -0
- holado_tools/tests/behave/steps/__init__.py +16 -0
- holado_tools/tests/behave/steps/tools/host_controller/client_steps.py +97 -0
- holado_tools/tools/host_controller/client/rest/host_controller_client.py +146 -0
- holado_tools/tools/host_controller/server/Dockerfile +60 -0
- holado_tools/tools/host_controller/server/grpc/README +2 -0
- holado_tools/tools/host_controller/server/grpc/__init__.py +26 -0
- holado_tools/tools/host_controller/server/grpc/proto/compile_proto.py +60 -0
- holado_tools/tools/host_controller/server/grpc/proto/definitions/docker_controler.proto +63 -0
- holado_tools/tools/host_controller/server/requirements.txt +2 -0
- holado_tools/tools/host_controller/server/rest/README +2 -0
- holado_tools/tools/host_controller/server/rest/api/__init__.py +24 -0
- holado_tools/tools/host_controller/server/rest/api/config.py +57 -0
- holado_tools/tools/host_controller/server/rest/api/docker/__init__.py +40 -0
- holado_tools/tools/host_controller/server/rest/api/docker/container.py +55 -0
- holado_tools/tools/host_controller/server/rest/api/os.py +47 -0
- holado_tools/tools/host_controller/server/rest/initialize_holado.py +72 -0
- holado_tools/tools/host_controller/server/rest/openapi.yaml +265 -0
- holado_tools/tools/host_controller/server/rest/run.py +31 -0
- holado_tools/tools/host_controller/server/run_host_controller_in_docker.sh +107 -0
- holado_tools/tools/host_viewer/client/rest/host_viewer_client.py +96 -0
- holado_tools/tools/host_viewer/server/Dockerfile +60 -0
- holado_tools/tools/host_viewer/server/requirements.txt +2 -0
- holado_tools/tools/host_viewer/server/rest/README +2 -0
- holado_tools/tools/host_viewer/server/rest/api/__init__.py +22 -0
- holado_tools/tools/host_viewer/server/rest/api/docker/__init__.py +40 -0
- holado_tools/tools/host_viewer/server/rest/initialize_holado.py +72 -0
- holado_tools/tools/host_viewer/server/rest/openapi.yaml +102 -0
- holado_tools/tools/host_viewer/server/rest/run.py +31 -0
- holado_tools/tools/host_viewer/server/run_host_viewer_in_docker.sh +107 -0
- {holado-0.11.2.dist-info → holado-0.11.3.dist-info}/WHEEL +0 -0
- {holado-0.11.2.dist-info → holado-0.11.3.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package docker_controler;
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
// DockerControlerService represents the querying service provided by docker controler.
|
|
7
|
+
service DockerControlerService {
|
|
8
|
+
// Get all container names.
|
|
9
|
+
rpc GetAllContainerNames(GetAllContainerNamesRequest) returns (GetAllContainerNamesResponse) {};
|
|
10
|
+
|
|
11
|
+
// Start a container.
|
|
12
|
+
rpc StartContainer(StartContainerRequest) returns (StartContainerResponse) {};
|
|
13
|
+
|
|
14
|
+
// Stop a container.
|
|
15
|
+
rpc StopContainer(StopContainerRequest) returns (StopContainerResponse) {};
|
|
16
|
+
|
|
17
|
+
// Restart a container.
|
|
18
|
+
rpc RestartContainer(RestartContainerRequest) returns (RestartContainerResponse) {};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
// Request and Response of DockerControlerService.GetAllContainerNames.
|
|
23
|
+
message GetAllContainerNamesRequest {
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
message GetAllContainerNamesResponse {
|
|
27
|
+
// List of names of containers existing on server.
|
|
28
|
+
repeated string container_names = 1;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Request and Response of DockerControlerService.StartContainer.
|
|
32
|
+
message StartContainerRequest {
|
|
33
|
+
// Container name.
|
|
34
|
+
string name = 1;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
message StartContainerResponse {
|
|
38
|
+
// Container status after request
|
|
39
|
+
string container_status = 1;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Request and Response of DockerControlerService.StopContainer.
|
|
43
|
+
message StopContainerRequest {
|
|
44
|
+
// Container name.
|
|
45
|
+
string name = 1;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
message StopContainerResponse {
|
|
49
|
+
// Container status after request
|
|
50
|
+
string container_status = 1;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Request and Response of DockerControlerService.RestartContainer.
|
|
54
|
+
message RestartContainerRequest {
|
|
55
|
+
// Container name.
|
|
56
|
+
string name = 1;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
message RestartContainerResponse {
|
|
60
|
+
// Container status after request
|
|
61
|
+
string container_status = 1;
|
|
62
|
+
}
|
|
63
|
+
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
|
|
@@ -0,0 +1,57 @@
|
|
|
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
|
+
from holado_yaml.yaml.yaml_manager import YAMLManager
|
|
16
|
+
|
|
17
|
+
def _get_session_context():
|
|
18
|
+
return SessionContext.instance()
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class YamlFileView(MethodView):
|
|
22
|
+
|
|
23
|
+
def get(self, body: dict):
|
|
24
|
+
file_path = body['file_path']
|
|
25
|
+
|
|
26
|
+
with open(file_path, 'rt') as fin:
|
|
27
|
+
res = fin.read()
|
|
28
|
+
|
|
29
|
+
return res
|
|
30
|
+
|
|
31
|
+
def patch(self, body: dict):
|
|
32
|
+
file_path = body['file_path']
|
|
33
|
+
yaml_string = body['yaml_string']
|
|
34
|
+
with_backup = body['with_backup']
|
|
35
|
+
backup_extension = body['backup_extension']
|
|
36
|
+
|
|
37
|
+
data = YAMLManager.load_string(yaml_string)
|
|
38
|
+
res = YAMLManager.update_file(file_path, data, with_backup=with_backup, backup_extension=backup_extension)
|
|
39
|
+
|
|
40
|
+
return res
|
|
41
|
+
|
|
42
|
+
def put(self, body: list):
|
|
43
|
+
action = body['action']
|
|
44
|
+
file_path = body['file_path']
|
|
45
|
+
backup_extension = body['backup_extension']
|
|
46
|
+
|
|
47
|
+
if action == 'restore':
|
|
48
|
+
res = YAMLManager.restore_file(file_path, backup_extension=backup_extension)
|
|
49
|
+
else:
|
|
50
|
+
return f"Unmanaged action '{action}'", 400
|
|
51
|
+
|
|
52
|
+
return res
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
@@ -0,0 +1,40 @@
|
|
|
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
|
|
@@ -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", 410
|
|
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, all_=True):
|
|
33
|
+
return f"Container '{name}' doesn't exist", 410
|
|
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", 410
|
|
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", 410
|
|
52
|
+
|
|
53
|
+
res = _get_session_context().docker_client.get_container(name).wait()
|
|
54
|
+
return res
|
|
55
|
+
|
|
@@ -0,0 +1,47 @@
|
|
|
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
|
+
|
|
@@ -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,265 @@
|
|
|
1
|
+
openapi: "3.0.0"
|
|
2
|
+
info:
|
|
3
|
+
version: "1"
|
|
4
|
+
title: "Host Controller API"
|
|
5
|
+
description: |
|
|
6
|
+
API to process some host actions from anywhere on the network.
|
|
7
|
+
In a microservice architecture, the host-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
|
+
/docker/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
|
+
/docker/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
|
+
/docker/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
|
+
/docker/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
|
+
/docker/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
|
+
/docker/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
|
+
|
|
@@ -0,0 +1,31 @@
|
|
|
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':'host_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)
|