← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~jtv/maas/reconcile-imports-enum-from-models into lp:maas

 

Jeroen T. Vermeulen has proposed merging lp:~jtv/maas/reconcile-imports-enum-from-models into lp:maas.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~jtv/maas/reconcile-imports-enum-from-models/+merge/103051

The module that implements the “reconcile” command imports maasserver.models and then uses models.Node & models.ARCHITECTURE.  Of those, the latter has moved to maasserver.enum.  This branch imports them separately, and removes the qualifying module names from the references in reconcile.py.

Jeroen
-- 
https://code.launchpad.net/~jtv/maas/reconcile-imports-enum-from-models/+merge/103051
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jtv/maas/reconcile-imports-enum-from-models into lp:maas.
=== modified file 'src/maastesting/management/commands/reconcile.py'
--- src/maastesting/management/commands/reconcile.py	2012-04-16 10:00:51 +0000
+++ src/maastesting/management/commands/reconcile.py	2012-04-23 07:51:21 +0000
@@ -29,16 +29,15 @@
     ]
 
 from django.core.management.base import NoArgsCommand
-from maasserver import (
-    models,
-    provisioning,
-    )
+from maasserver import provisioning
+from maasserver.enum import ARCHITECTURE
+from maasserver.models import Node
 
 
 ARCHITECTURE_GUESSES = {
-    "i386": models.ARCHITECTURE.i386,
-    "amd64": models.ARCHITECTURE.amd64,
-    "x86_64": models.ARCHITECTURE.amd64,
+    "i386": ARCHITECTURE.i386,
+    "amd64": ARCHITECTURE.amd64,
+    "x86_64": ARCHITECTURE.amd64,
     }
 
 
@@ -56,7 +55,7 @@
 
 def reconcile():
     papi = provisioning.get_provisioning_api_proxy()
-    nodes_local = {node.system_id: node for node in models.Node.objects.all()}
+    nodes_local = {node.system_id: node for node in Node.objects.all()}
     nodes_remote = papi.get_nodes()
 
     missing_local = set(nodes_remote).difference(nodes_local)
@@ -64,7 +63,7 @@
     for name in missing_local:
         print("remote:", name)
         remote_node = nodes_remote[name]
-        local_node = models.Node(
+        local_node = Node(
             system_id=remote_node["name"],
             architecture=(
                 guess_architecture_from_profile(remote_node["profile"])),