← Back to team overview

sts-sponsors team mailing list archive

[Merge] ~adam-collard/maas:3.3-architecture-wildcard-constraint into maas:3.3

 

Adam Collard has proposed merging ~adam-collard/maas:3.3-architecture-wildcard-constraint into maas:3.3.

Commit message:
wildcard architectures returns a list, use .extend() not .append()


Requested reviews:
  MAAS Maintainers (maas-maintainers)

For more details, see:
https://code.launchpad.net/~adam-collard/maas/+git/maas/+merge/434362
-- 
Your team MAAS Maintainers is requested to review the proposed merge of ~adam-collard/maas:3.3-architecture-wildcard-constraint into maas:3.3.
diff --git a/src/maasserver/node_constraint_filter_forms.py b/src/maasserver/node_constraint_filter_forms.py
index 53e5ccd..12dce7f 100644
--- a/src/maasserver/node_constraint_filter_forms.py
+++ b/src/maasserver/node_constraint_filter_forms.py
@@ -1025,7 +1025,7 @@ class FilterNodeForm(forms.Form):
             elif value in architecture_wildcards:
                 # Try to expand 'arch' to all available 'arch/subarch'
                 # matches.
-                arches.append(*architecture_wildcards[value])
+                arches.extend(architecture_wildcards[value])
             else:
                 set_form_error(
                     self,
diff --git a/src/maasserver/tests/test_node_constraint_filter_forms.py b/src/maasserver/tests/test_node_constraint_filter_forms.py
index 0f5ac2c..1222323 100644
--- a/src/maasserver/tests/test_node_constraint_filter_forms.py
+++ b/src/maasserver/tests/test_node_constraint_filter_forms.py
@@ -1444,6 +1444,11 @@ class TestFilterNodeForm(MAASServerTestCase, FilterConstraintsMixin):
             [node_big], {"arch": arch, "tags": ["big"]}
         )
 
+    def test_wildcard_arch_constraint(self):
+        patch_usable_architectures(self, ["foo/bar", "foo/baz"])
+        form = FilterNodeForm(data={"arch": "foo"})
+        self.assertTrue(form.is_valid())
+
     def test_invalid_combined_constraints(self):
         form = FilterNodeForm(data={"tags": ["unknown"], "arch": "invalid"})
         self.assertEqual(

Follow ups