Jeroen T. Vermeulen has proposed merging lp:~jtv/maas/prep-nodeuserdata into
lp:maas.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~jtv/maas/prep-nodeuserdata/+merge/110459
As per the migration plan. This prepares for the first model migration for
metadataserver. I hadn't updated its models to use DefaultMeta for their Meta
classes yet, so here I do that for all metadataserver models in one go.
And as with the maasserver migration, I'm keeping the largest and most actively
maintained model for last, so that it can be moved by renaming the file which
minimizes bzr conflicts. That would probably be NodeCommissionResult. I'm not
entirely sure, but I'm fairly sure it's not NodeUserData. So that one goes
first.
Finally, also as per the plan, I converted a ForeignKey to use the name of the
model class it refers to, rather than the actual model class it refers to.
This helps reduce the risk of circular imports in a place where we can't just
defer the import until runtime. This is a change I didn't make for all classes
in one go, because especially with more model migrations ahead, it's nice to
keep the early validity check of an actual class reference for as long as we
can.
Jeroen
--
https://code.launchpad.net/~jtv/maas/prep-nodeuserdata/+merge/110459
Your team Launchpad code reviewers is requested to review the proposed merge of
lp:~jtv/maas/prep-nodeuserdata into lp:maas.
=== modified file 'src/metadataserver/models/__init__.py'
--- src/metadataserver/models/__init__.py 2012-06-14 06:53:15 +0000
+++ src/metadataserver/models/__init__.py 2012-06-15 05:45:24 +0000
@@ -29,6 +29,7 @@
from maasserver.models import Node
from maasserver.models.cleansave import CleanSave
from maasserver.models.user import create_auth_token
+from metadataserver import DefaultMeta
from metadataserver.fields import (
Bin,
BinaryField,
@@ -124,6 +125,9 @@
to the maas-init-node user.
"""
+ class Meta(DefaultMeta):
+ """Needed for South to recognize this model."""
+
objects = NodeKeyManager()
node = ForeignKey(Node, null=False, editable=False, unique=True)
@@ -132,6 +136,7 @@
max_length=KEY_SIZE, null=False, editable=False, unique=True)
+# Scheduled for model migration on 2012-06-22
class NodeUserDataManager(Manager):
"""Utility for the collection of NodeUserData items."""
@@ -167,6 +172,7 @@
self.filter(node=node).delete()
+# Scheduled for model migration on 2012-06-22
class NodeUserData(CleanSave, Model):
"""User-data portion of a node's metadata.
@@ -178,9 +184,13 @@
:ivar data: base64-encoded data.
"""
+ class Meta(DefaultMeta):
+ """Needed for South to recognize this model."""
+
objects = NodeUserDataManager()
- node = ForeignKey(Node, null=False, editable=False, unique=True)
+ node = ForeignKey(
+ 'maasserver.Node', null=False, editable=False, unique=True)
data = BinaryField(null=False)
@@ -223,5 +233,5 @@
name = CharField(max_length=100, unique=False, editable=False)
data = CharField(max_length=1024 * 1024, editable=True)
- class Meta:
+ class Meta(DefaultMeta):
unique_together = ('node', 'name')
_______________________________________________
Mailing list: https://launchpad.net/~launchpad-reviewers
Post to : [email protected]
Unsubscribe : https://launchpad.net/~launchpad-reviewers
More help : https://help.launchpad.net/ListHelp