Merge ~adam-collard/maas:clone-tweak into maas:master

Proposed by Adam Collard
Status: Rejected
Rejected by: Adam Collard
Proposed branch: ~adam-collard/maas:clone-tweak
Merge into: maas:master
Diff against target: 30 lines (+6/-6)
1 file modified
src/maasserver/forms/clone.py (+6/-6)
Reviewer Review Type Date Requested Status
Björn Tillenius Needs Information
MAAS Lander Approve
Review via email: mp+404589@code.launchpad.net

Commit message

Filter destination machines by status up front in CloneForm

To post a comment you must log in.
Revision history for this message
MAAS Lander (maas-lander) wrote :

UNIT TESTS
-b clone-tweak lp:~adam-collard/maas/+git/maas into -b master lp:~maas-committers/maas

STATUS: FAILED
LOG: http://maas-ci.internal:8080/job/maas/job/branch-tester/10307/console
COMMIT: b071a5bc865b86fb90b4860983e8f0459bddbc10

review: Needs Fixing
Revision history for this message
Adam Collard (adam-collard) wrote :

jenkins: !test

Revision history for this message
MAAS Lander (maas-lander) wrote :

UNIT TESTS
-b clone-tweak lp:~adam-collard/maas/+git/maas into -b master lp:~maas-committers/maas

STATUS: SUCCESS
COMMIT: b071a5bc865b86fb90b4860983e8f0459bddbc10

review: Approve
Revision history for this message
Björn Tillenius (bjornt) wrote :

Hmm. Is there a test that checks this functionality.

It seems that you now changed it not to filter by status, no?

review: Needs Information
Revision history for this message
Adam Collard (adam-collard) wrote :

Abandoned change since mutating the field in __init__ is changing it for all instances (the Field is mutable) and therefore better to instantiate the queryset afresh each time.

Unmerged commits

b071a5b... by Adam Collard

Filter destination machines by status up front

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/src/maasserver/forms/clone.py b/src/maasserver/forms/clone.py
2index 105c19a..d38a957 100644
3--- a/src/maasserver/forms/clone.py
4+++ b/src/maasserver/forms/clone.py
5@@ -28,7 +28,11 @@ class CloneForm(forms.Form):
6 )
7
8 destinations = SimpleArrayField(
9- NodeChoiceField(queryset=Machine.objects.all()),
10+ NodeChoiceField(
11+ queryset=Machine.objects.filter(
12+ status__in={NODE_STATUS.READY, NODE_STATUS.FAILED_TESTING}
13+ )
14+ ),
15 label="Destinations",
16 min_length=1,
17 error_messages={
18@@ -58,11 +62,7 @@ class CloneForm(forms.Form):
19 self.fields[
20 "destinations"
21 ].base_field.queryset = Machine.objects.get_nodes(
22- self.user,
23- NodePermission.admin,
24- from_nodes=Machine.objects.filter(
25- status__in={NODE_STATUS.READY, NODE_STATUS.FAILED_TESTING}
26- ),
27+ self.user, NodePermission.admin
28 )
29
30 def clean(self):

Subscribers

People subscribed via source and target branches