← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~jtv/maas/prep-nodecommissionresult into lp:maas

 

Jeroen T. Vermeulen has proposed merging lp:~jtv/maas/prep-nodecommissionresult into lp:maas.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~jtv/maas/prep-nodecommissionresult/+merge/112888

As per the migration plan.  I moved the Meta class into the same position it would normally have, and made a ForeignKey to Node (the model class) refer to "maasserver.Node" (the model class name) as per the planned protocol for avoiding circular imports.

The way bzr works gives us one freebie: to minimize conflicts I can either move the NodeCommissionResult code into its own module, or rename the file and move everything else into a new __init__.py.  Renaming a file will not cause any merge conflicts.  Given the ratio of top-of-file boilerplate to class code, however, I went for a standard move-the-class-out-of-the-module choice.

Nearly done now!  This is the last model that needs migration.


Jeroen
-- 
https://code.launchpad.net/~jtv/maas/prep-nodecommissionresult/+merge/112888
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jtv/maas/prep-nodecommissionresult into lp:maas.
=== modified file 'src/metadataserver/models/__init__.py'
--- src/metadataserver/models/__init__.py	2012-06-21 00:51:12 +0000
+++ src/metadataserver/models/__init__.py	2012-06-30 04:51:21 +0000
@@ -141,6 +141,7 @@
 
 
 class NodeCommissionResultManager(Manager):
+# Scheduled for model migration on 2012-07-09
     """Utility to manage a collection of :class:`NodeCommissionResult`s."""
 
     def clear_results(self, node):
@@ -161,6 +162,7 @@
         return ncr.data
 
 
+# Scheduled for model migration on 2012-07-09
 class NodeCommissionResult(CleanSave, Model):
     """Storage for data returned from node commissioning.
 
@@ -173,11 +175,12 @@
     :ivar data: The file's actual data, unicode only.
     """
 
+    class Meta(DefaultMeta):
+        unique_together = ('node', 'name')
+
     objects = NodeCommissionResultManager()
 
-    node = ForeignKey(Node, null=False, editable=False, unique=False)
+    node = ForeignKey(
+        'maasserver.Node', null=False, editable=False, unique=False)
     name = CharField(max_length=100, unique=False, editable=False)
     data = CharField(max_length=1024 * 1024, editable=True)
-
-    class Meta(DefaultMeta):
-        unique_together = ('node', 'name')