From 51d0208c107101b41c0175b0048bf798a133d73d Mon Sep 17 00:00:00 2001 From: XaverStiensmeier Date: Sat, 30 Nov 2024 14:35:38 +0100 Subject: [PATCH] improved exception messages --- bibigrid/core/actions/create.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/bibigrid/core/actions/create.py b/bibigrid/core/actions/create.py index e12af3bd..d9827a43 100644 --- a/bibigrid/core/actions/create.py +++ b/bibigrid/core/actions/create.py @@ -65,8 +65,7 @@ class Create: # pylint: disable=too-many-instance-attributes,too-many-arguments The class Create holds necessary methods to execute the Create-Action """ - def __init__(self, providers, configurations, config_path, log, debug=False, - # pylint: disable=too-many-positional-arguments + def __init__(self, *, providers, configurations, config_path, log, debug=False, cluster_id=None): """ Additionally sets (unique) cluster_id, public_key_commands (to copy public keys to master) and key_name. @@ -379,8 +378,11 @@ def prepare_vpn_or_master_args(self, configuration): instance_type = configuration["vpnInstance"] identifier = VPN_WORKER_IDENTIFIER else: - self.log.warning("Configuration %s has no vpngtw or master and is therefore unreachable.", configuration) - raise KeyError + self.log.warning( + f"Configuration {configuration['cloud_identifier']} " + f"has no vpngtw or master and is therefore unreachable.") + raise ConfigurationException( + f"Configuration {configuration['cloud_identifier']} has neither vpngtw nor masterInstance") return identifier, instance_type def initialize_instances(self):