From 16ff3718bb85c6b372a03ae795d1c51c865e674d Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Mon, 5 Aug 2024 10:31:18 -0400 Subject: [PATCH] Fix validation of module token in component names --- netbox/dcim/forms/common.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/netbox/dcim/forms/common.py b/netbox/dcim/forms/common.py index 031d4cdf5..4341ec041 100644 --- a/netbox/dcim/forms/common.py +++ b/netbox/dcim/forms/common.py @@ -100,6 +100,8 @@ class ModuleCommonForm(forms.Form): self.instance._disable_replication = True return + module_bays = self._get_module_bay_tree(module_bay) + for templates, component_attribute in [ ("consoleporttemplates", "consoleports"), ("consoleserverporttemplates", "consoleserverports"), @@ -124,7 +126,6 @@ class ModuleCommonForm(forms.Form): _("Cannot install module with placeholder values in a module bay with no position defined.") ) - module_bays = self._get_module_bay_tree(template) if len(module_bays) != template.name.count(MODULE_TOKEN): raise forms.ValidationError( _("Cannot install module with placeholder values in a module bay tree {level} in tree but {tokens} placeholders given.").format(