From 7472b6c1342849744eca997653787dcb196186ce Mon Sep 17 00:00:00 2001 From: rakeshgm Date: Mon, 31 Jul 2023 15:34:55 +0530 Subject: [PATCH] use a global dict for PLATFORM_DEFAULTS Signed-off-by: rakeshgm --- test/drenv/envfile.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/test/drenv/envfile.py b/test/drenv/envfile.py index ae63c7ff8..a2dae2756 100644 --- a/test/drenv/envfile.py +++ b/test/drenv/envfile.py @@ -11,22 +11,18 @@ CONTAINER = "$container" SHARED_NETWORK = "$network" +_PLATFORM_DEFAULTS = { + "__default__": {VM: "", CONTAINER: "", SHARED_NETWORK: ""}, + "linux": {VM: "kvm2", CONTAINER: "docker", SHARED_NETWORK: "default"}, + "darwin": {VM: "hyperkit", CONTAINER: "podman", SHARED_NETWORK: ""}, +} + def platform_defaults(): # By default, use minikube defaults. - d = {VM: "", CONTAINER: "", SHARED_NETWORK: ""} operating_system = platform.system().lower() - if operating_system == "linux": - d[VM] = "kvm2" - d[CONTAINER] = "docker" - d[SHARED_NETWORK] = "default" - elif operating_system == "darwin": - d[VM] = "hyperkit" - d[CONTAINER] = "podman" - d[SHARED_NETWORK] = "" - - return d + return _PLATFORM_DEFAULTS.get(operating_system, _PLATFORM_DEFAULTS["__default__"]) class MissingAddon(Exception):