From a4269ad13dc7573fa4be7adc7690034f4bb3d5a9 Mon Sep 17 00:00:00 2001 From: Attila Farkas <394097@mail.muni.cz> Date: Wed, 7 Oct 2020 17:05:04 +0200 Subject: [PATCH] create controller machine if windows box is present --- modules/controller.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/modules/controller.py b/modules/controller.py index 3af3946..c0778e0 100644 --- a/modules/controller.py +++ b/modules/controller.py @@ -5,6 +5,8 @@ from netaddr import * from itertools import chain CONTROLLER_NAME = "controller" +CONTROLLER_BOX_NAME = "debian/contrib-stretch64" +CONTROLLER_MEMORY = 512 def _are_controller_parameters_free(definitions): @@ -36,7 +38,18 @@ def _find_available_ip(definitions): def _add_controller(definitions): """Add controller to definitions""" - ip = _find_available_ip(definitions) + controller_ip = _find_available_ip(definitions) + controller = dict() + controller["name"] = CONTROLLER_NAME + controller["base_box"] = dict() + controller["base_box"]["image"] = CONTROLLER_BOX_NAME + controller["memory"] = CONTROLLER_MEMORY + definitions["hosts"].append(controller) + mapping = dict() + mapping["host"] = CONTROLLER_NAME + mapping["network"] = definitions["networks"][0]["name"] + mapping["ip"] = controller_ip + definitions["net_mappings"].append(mapping) def create_controller(definitions): @@ -51,5 +64,4 @@ def create_controller(definitions): "already exists.") _add_controller(definitions) - - return + print(definitions) -- GitLab