Merge ~adam-collard/maas:architecture-wildcard-constraint into maas:master

Proposed by Adam Collard
Status: Merged
Approved by: Adam Collard
Approved revision: 1c9a8fc3e9b03c2b7967c6a84bd96aee35e1b11a
Merge reported by: MAAS Lander
Merged at revision: not available
Proposed branch: ~adam-collard/maas:architecture-wildcard-constraint
Merge into: maas:master
Diff against target: 29 lines (+6/-1)
2 files modified
src/maasserver/node_constraint_filter_forms.py (+1/-1)
src/maasserver/tests/test_node_constraint_filter_forms.py (+5/-0)
Reviewer Review Type Date Requested Status
Anton Troyanov Approve
Alexsander de Souza Approve
Review via email: mp+434358@code.launchpad.net

Commit message

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

To post a comment you must log in.
Revision history for this message
Alexsander de Souza (alexsander-souza) wrote :

+1

review: Approve
Revision history for this message
Anton Troyanov (troyanov) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/src/maasserver/node_constraint_filter_forms.py b/src/maasserver/node_constraint_filter_forms.py
2index 53e5ccd..12dce7f 100644
3--- a/src/maasserver/node_constraint_filter_forms.py
4+++ b/src/maasserver/node_constraint_filter_forms.py
5@@ -1025,7 +1025,7 @@ class FilterNodeForm(forms.Form):
6 elif value in architecture_wildcards:
7 # Try to expand 'arch' to all available 'arch/subarch'
8 # matches.
9- arches.append(*architecture_wildcards[value])
10+ arches.extend(architecture_wildcards[value])
11 else:
12 set_form_error(
13 self,
14diff --git a/src/maasserver/tests/test_node_constraint_filter_forms.py b/src/maasserver/tests/test_node_constraint_filter_forms.py
15index 0f5ac2c..1222323 100644
16--- a/src/maasserver/tests/test_node_constraint_filter_forms.py
17+++ b/src/maasserver/tests/test_node_constraint_filter_forms.py
18@@ -1444,6 +1444,11 @@ class TestFilterNodeForm(MAASServerTestCase, FilterConstraintsMixin):
19 [node_big], {"arch": arch, "tags": ["big"]}
20 )
21
22+ def test_wildcard_arch_constraint(self):
23+ patch_usable_architectures(self, ["foo/bar", "foo/baz"])
24+ form = FilterNodeForm(data={"arch": "foo"})
25+ self.assertTrue(form.is_valid())
26+
27 def test_invalid_combined_constraints(self):
28 form = FilterNodeForm(data={"tags": ["unknown"], "arch": "invalid"})
29 self.assertEqual(

Subscribers

People subscribed via source and target branches