Jeroen T. Vermeulen has proposed merging lp:~jtv/maas/migrate-macaddress into 
lp:maas.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~jtv/maas/migrate-macaddress/+merge/109093

As per the migration plan.  This brings us very close to completion of the 
maasserver migration; after this it's just a matter of moving the User-related 
helpers and then we can rename __init__.py to node.py, moving the remainder 
into a new __init__.py with minimal risk of conflicts.  After that, it's 
metadataserver's turn to migrate.

You may notice one small slipup: I had neglected in my prep branch to pass 
"Node" (string containing model name) to the ForeignKey constructor for 
MACAddress.node, so it still used Node (model class reference) instead.  Apart 
from that, all you see here is code being moved, and expected boilerplate.


Jeroen
-- 
https://code.launchpad.net/~jtv/maas/migrate-macaddress/+merge/109093
Your team Launchpad code reviewers is requested to review the proposed merge of 
lp:~jtv/maas/migrate-macaddress into lp:maas.
=== modified file 'src/maasserver/models/__init__.py'
--- src/maasserver/models/__init__.py	2012-06-05 08:25:44 +0000
+++ src/maasserver/models/__init__.py	2012-06-07 09:42:22 +0000
@@ -32,7 +32,6 @@
 
 from logging import getLogger
 import os
-import re
 from string import whitespace
 from uuid import uuid1
 
@@ -66,14 +65,14 @@
     NODE_STATUS_CHOICES_DICT,
     )
 from maasserver.exceptions import NodeStateViolation
-from maasserver.fields import (
-    JSONObjectField,
-    MACAddressField,
-    )
+from maasserver.fields import JSONObjectField
 from maasserver.models.cleansave import CleanSave
 from maasserver.models.config import Config
 from maasserver.models.filestorage import FileStorage
+from maasserver.models.macaddress import MACAddress
 from maasserver.models.nodegroup import NodeGroup
+
+
 NodeGroup
 from maasserver.models.sshkey import SSHKey
 from maasserver.models.timestampedmodel import TimestampedModel
@@ -628,36 +627,6 @@
         self.save()
 
 
-# Scheduled for model migration on 2012-06-07
-mac_re = re.compile(r'^([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$')
-
-
-# Scheduled for model migration on 2012-06-07
-class MACAddress(CleanSave, TimestampedModel):
-    """A `MACAddress` represents a `MAC address
-    <http://en.wikipedia.org/wiki/MAC_address>`_ attached to a :class:`Node`.
-
-    :ivar mac_address: The MAC address.
-    :ivar node: The `Node` related to this `MACAddress`.
-
-    """
-    mac_address = MACAddressField(unique=True)
-    node = ForeignKey(Node, editable=False)
-
-    class Meta(DefaultMeta):
-        verbose_name = "MAC address"
-        verbose_name_plural = "MAC addresses"
-
-    def __unicode__(self):
-        return self.mac_address
-
-    def unique_error_message(self, model_class, unique_check):
-        if unique_check == ('mac_address',):
-                return "This MAC address is already registered."
-        return super(
-            MACAddress, self).unique_error_message(model_class, unique_check)
-
-
 # Scheduled for model migration on 2012-06-13
 GENERIC_CONSUMER = 'MAAS consumer'
 

=== added file 'src/maasserver/models/macaddress.py'
--- src/maasserver/models/macaddress.py	1970-01-01 00:00:00 +0000
+++ src/maasserver/models/macaddress.py	2012-06-07 09:42:22 +0000
@@ -0,0 +1,52 @@
+# Copyright 2012 Canonical Ltd.  This software is licensed under the
+# GNU Affero General Public License version 3 (see the file LICENSE).
+
+"""MACAddress model and friends."""
+
+from __future__ import (
+    absolute_import,
+    print_function,
+    unicode_literals,
+    )
+
+__metaclass__ = type
+__all__ = [
+    'MACAddress',
+    ]
+
+
+import re
+
+from django.db.models import ForeignKey
+from maasserver import DefaultMeta
+from maasserver.fields import MACAddressField
+from maasserver.models.cleansave import CleanSave
+from maasserver.models.timestampedmodel import TimestampedModel
+
+
+mac_re = re.compile(r'^([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$')
+
+
+class MACAddress(CleanSave, TimestampedModel):
+    """A `MACAddress` represents a `MAC address
+    <http://en.wikipedia.org/wiki/MAC_address>`_ attached to a :class:`Node`.
+
+    :ivar mac_address: The MAC address.
+    :ivar node: The `Node` related to this `MACAddress`.
+
+    """
+    mac_address = MACAddressField(unique=True)
+    node = ForeignKey('Node', editable=False)
+
+    class Meta(DefaultMeta):
+        verbose_name = "MAC address"
+        verbose_name_plural = "MAC addresses"
+
+    def __unicode__(self):
+        return self.mac_address
+
+    def unique_error_message(self, model_class, unique_check):
+        if unique_check == ('mac_address',):
+                return "This MAC address is already registered."
+        return super(
+            MACAddress, self).unique_error_message(model_class, unique_check)

_______________________________________________
Mailing list: https://launchpad.net/~launchpad-reviewers
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~launchpad-reviewers
More help   : https://help.launchpad.net/ListHelp

Reply via email to