Merge lp:~blake-rouse/maas/add-osystem-to-node-migration into lp:~maas-committers/maas/trunk
- add-osystem-to-node-migration
- Merge into trunk
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Blake Rouse | ||||
Approved revision: | no longer in the source branch. | ||||
Merged at revision: | 2320 | ||||
Proposed branch: | lp:~blake-rouse/maas/add-osystem-to-node-migration | ||||
Merge into: | lp:~maas-committers/maas/trunk | ||||
Prerequisite: | lp:~blake-rouse/maas/osystem-registry | ||||
Diff against target: |
383 lines (+285/-8) 8 files modified
src/maasserver/migrations/0076_add_osystem_to_bootimage.py (+2/-2) src/maasserver/migrations/0077_remove_null_for_bootsourceselection_release.py (+2/-2) src/maasserver/migrations/0078_add_osystem_to_node.py (+270/-0) src/maasserver/models/node.py (+8/-2) src/maasserver/testing/factory.py (+0/-1) src/maasserver/testing/osystems.py (+1/-1) src/provisioningserver/boot/tftppath.py (+1/-0) src/provisioningserver/driver/tests/test_os_ubuntu.py (+1/-0) |
||||
To merge this branch: | bzr merge lp:~blake-rouse/maas/add-osystem-to-node-migration | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Raphaël Badin (community) | Approve | ||
Jason Hobbs (community) | Approve | ||
Review via email: mp+219514@code.launchpad.net |
Commit message
Add osystem field to the node model.
Description of the change
This replaces the large merge of add-osystem-
Note: osystem was used throughout the code instead of os, as the python os module would conflict throughout the code base.
Blake Rouse (blake-rouse) wrote : | # |
[1,2] Fixed
[3] Using 20 as that was what was chosen by the core team for the release field in BootImages, whether that is the correct thing, idk.
[4] At this current state in the branch the field is not used for testing. This merge requests uses the field and provides test for it. If you would like to review that, :)
https:/
Jason Hobbs (jason-hobbs) wrote : | # |
[3] Still seems broken to me, but I get now that you're following the same pattern of fields being size 20 in Node and size 255 in BootImages that was there already. I guess this can be fixed later if it turns out to be an issue.
[4] I think we should in general add tests when we add code, but this was a retroactive breakdown, so makes sense.
Thanks!
Raphaël Badin (rvb) wrote : | # |
[0]
As Jason pointed out, it's always best to land tests with the code they test. For new models, a basic test is enough. You also might want to add a make_<my_model> utility in the test factory (src/maasserver
[1]
See my inline comment about using null=True on Charfields.
[2]
As Jason pointed out, don't forget to run:
$ ./utilities/
and
$ make lint
before you submit a branch.
[3]
Please update the Node's docstring.
Julian Edwards (julian-edwards) wrote : | # |
On 15/05/14 00:23, Jason Hobbs wrote:
> Be sure to run 'make format',
> src/maasserver/
> bit by it.
My personal thought on these is that since they are autogenerated, it
really doesn't matter about formatting.
Jason Hobbs (jason-hobbs) wrote : | # |
On Wed, May 14, 2014 at 7:06 PM, Julian Edwards <
<email address hidden>> wrote:
> On 15/05/14 00:23, Jason Hobbs wrote:
> > Be sure to run 'make format',
> > src/maasserver/
> > bit by it.
>
> My personal thought on these is that since they are autogenerated, it
> really doesn't matter about formatting.
They'll get reformatted the next time someone else runs 'make format',
which can be annoying. If we don't care about formatting on them, 'make
format' should ignore them I suppose.
Jason
Julian Edwards (julian-edwards) wrote : | # |
On 15/05/14 10:57, Jason Hobbs wrote:
> On Wed, May 14, 2014 at 7:06 PM, Julian Edwards <
> <email address hidden>> wrote:
>
>> On 15/05/14 00:23, Jason Hobbs wrote:
>>> Be sure to run 'make format',
>>> src/maasserver/
>>> bit by it.
>>
>> My personal thought on these is that since they are autogenerated, it
>> really doesn't matter about formatting.
>
>
> They'll get reformatted the next time someone else runs 'make format',
> which can be annoying. If we don't care about formatting on them, 'make
> format' should ignore them I suppose.
>
> Jason
>
Yes, that's what I was intimating. But someone needs to be bothered to
make that tool ignore migrations.... :)
Preview Diff
1 | === modified file 'src/maasserver/migrations/0076_add_osystem_to_bootimage.py' | |||
2 | --- src/maasserver/migrations/0076_add_osystem_to_bootimage.py 2014-05-02 19:21:43 +0000 | |||
3 | +++ src/maasserver/migrations/0076_add_osystem_to_bootimage.py 2014-05-14 15:21:48 +0000 | |||
4 | @@ -1,8 +1,8 @@ | |||
5 | 1 | from django.db import models | ||
6 | 2 | from south.db import db | ||
7 | 1 | # -*- coding: utf-8 -*- | 3 | # -*- coding: utf-8 -*- |
8 | 2 | from south.utils import datetime_utils as datetime | 4 | from south.utils import datetime_utils as datetime |
9 | 3 | from south.db import db | ||
10 | 4 | from south.v2 import SchemaMigration | 5 | from south.v2 import SchemaMigration |
11 | 5 | from django.db import models | ||
12 | 6 | 6 | ||
13 | 7 | 7 | ||
14 | 8 | class Migration(SchemaMigration): | 8 | class Migration(SchemaMigration): |
15 | 9 | 9 | ||
16 | === modified file 'src/maasserver/migrations/0077_remove_null_for_bootsourceselection_release.py' | |||
17 | --- src/maasserver/migrations/0077_remove_null_for_bootsourceselection_release.py 2014-05-14 08:32:13 +0000 | |||
18 | +++ src/maasserver/migrations/0077_remove_null_for_bootsourceselection_release.py 2014-05-14 15:21:48 +0000 | |||
19 | @@ -1,8 +1,8 @@ | |||
20 | 1 | from django.db import models | ||
21 | 2 | from south.db import db | ||
22 | 1 | # -*- coding: utf-8 -*- | 3 | # -*- coding: utf-8 -*- |
23 | 2 | from south.utils import datetime_utils as datetime | 4 | from south.utils import datetime_utils as datetime |
24 | 3 | from south.db import db | ||
25 | 4 | from south.v2 import SchemaMigration | 5 | from south.v2 import SchemaMigration |
26 | 5 | from django.db import models | ||
27 | 6 | 6 | ||
28 | 7 | 7 | ||
29 | 8 | class Migration(SchemaMigration): | 8 | class Migration(SchemaMigration): |
30 | 9 | 9 | ||
31 | === added file 'src/maasserver/migrations/0078_add_osystem_to_node.py' | |||
32 | --- src/maasserver/migrations/0078_add_osystem_to_node.py 1970-01-01 00:00:00 +0000 | |||
33 | +++ src/maasserver/migrations/0078_add_osystem_to_node.py 2014-05-14 15:21:48 +0000 | |||
34 | @@ -0,0 +1,270 @@ | |||
35 | 1 | from django.db import models | ||
36 | 2 | from south.db import db | ||
37 | 3 | # -*- coding: utf-8 -*- | ||
38 | 4 | from south.utils import datetime_utils as datetime | ||
39 | 5 | from south.v2 import SchemaMigration | ||
40 | 6 | |||
41 | 7 | |||
42 | 8 | class Migration(SchemaMigration): | ||
43 | 9 | |||
44 | 10 | def forwards(self, orm): | ||
45 | 11 | # Adding field 'Node.osystem' | ||
46 | 12 | db.add_column(u'maasserver_node', 'osystem', | ||
47 | 13 | self.gf('django.db.models.fields.CharField')(default=u'', max_length=20, blank=True), | ||
48 | 14 | keep_default=False) | ||
49 | 15 | |||
50 | 16 | |||
51 | 17 | # Changing field 'Node.distro_series' | ||
52 | 18 | db.alter_column(u'maasserver_node', 'distro_series', self.gf('django.db.models.fields.CharField')(max_length=20)) | ||
53 | 19 | |||
54 | 20 | def backwards(self, orm): | ||
55 | 21 | # Deleting field 'Node.osystem' | ||
56 | 22 | db.delete_column(u'maasserver_node', 'osystem') | ||
57 | 23 | |||
58 | 24 | |||
59 | 25 | # Changing field 'Node.distro_series' | ||
60 | 26 | db.alter_column(u'maasserver_node', 'distro_series', self.gf('django.db.models.fields.CharField')(max_length=20, null=True)) | ||
61 | 27 | |||
62 | 28 | models = { | ||
63 | 29 | u'auth.group': { | ||
64 | 30 | 'Meta': {'object_name': 'Group'}, | ||
65 | 31 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
66 | 32 | 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), | ||
67 | 33 | 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) | ||
68 | 34 | }, | ||
69 | 35 | u'auth.permission': { | ||
70 | 36 | 'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'}, | ||
71 | 37 | 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), | ||
72 | 38 | 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}), | ||
73 | 39 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
74 | 40 | 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) | ||
75 | 41 | }, | ||
76 | 42 | u'auth.user': { | ||
77 | 43 | 'Meta': {'object_name': 'User'}, | ||
78 | 44 | 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), | ||
79 | 45 | 'email': ('django.db.models.fields.EmailField', [], {'unique': 'True', 'max_length': '75', 'blank': 'True'}), | ||
80 | 46 | 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), | ||
81 | 47 | 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "u'user_set'", 'blank': 'True', 'to': u"orm['auth.Group']"}), | ||
82 | 48 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
83 | 49 | 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), | ||
84 | 50 | 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), | ||
85 | 51 | 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), | ||
86 | 52 | 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), | ||
87 | 53 | 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), | ||
88 | 54 | 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), | ||
89 | 55 | 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "u'user_set'", 'blank': 'True', 'to': u"orm['auth.Permission']"}), | ||
90 | 56 | 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) | ||
91 | 57 | }, | ||
92 | 58 | u'contenttypes.contenttype': { | ||
93 | 59 | 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, | ||
94 | 60 | 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), | ||
95 | 61 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
96 | 62 | 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), | ||
97 | 63 | 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) | ||
98 | 64 | }, | ||
99 | 65 | u'maasserver.bootimage': { | ||
100 | 66 | 'Meta': {'unique_together': "((u'nodegroup', u'osystem', u'architecture', u'subarchitecture', u'release', u'purpose', u'label'),)", 'object_name': 'BootImage'}, | ||
101 | 67 | 'architecture': ('django.db.models.fields.CharField', [], {'max_length': '255'}), | ||
102 | 68 | 'created': ('django.db.models.fields.DateTimeField', [], {}), | ||
103 | 69 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
104 | 70 | 'label': ('django.db.models.fields.CharField', [], {'default': "u'release'", 'max_length': '255'}), | ||
105 | 71 | 'nodegroup': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['maasserver.NodeGroup']"}), | ||
106 | 72 | 'osystem': ('django.db.models.fields.CharField', [], {'max_length': '255'}), | ||
107 | 73 | 'purpose': ('django.db.models.fields.CharField', [], {'max_length': '255'}), | ||
108 | 74 | 'release': ('django.db.models.fields.CharField', [], {'max_length': '255'}), | ||
109 | 75 | 'subarchitecture': ('django.db.models.fields.CharField', [], {'max_length': '255'}), | ||
110 | 76 | 'updated': ('django.db.models.fields.DateTimeField', [], {}) | ||
111 | 77 | }, | ||
112 | 78 | u'maasserver.bootsource': { | ||
113 | 79 | 'Meta': {'object_name': 'BootSource'}, | ||
114 | 80 | 'cluster': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['maasserver.NodeGroup']", 'null': 'True'}), | ||
115 | 81 | 'created': ('django.db.models.fields.DateTimeField', [], {}), | ||
116 | 82 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
117 | 83 | 'keyring_data': ('django.db.models.fields.BinaryField', [], {'blank': 'True'}), | ||
118 | 84 | 'keyring_filename': ('django.db.models.fields.FilePathField', [], {'max_length': '100', 'blank': 'True'}), | ||
119 | 85 | 'updated': ('django.db.models.fields.DateTimeField', [], {}), | ||
120 | 86 | 'url': ('django.db.models.fields.URLField', [], {'max_length': '200'}) | ||
121 | 87 | }, | ||
122 | 88 | u'maasserver.bootsourceselection': { | ||
123 | 89 | 'Meta': {'object_name': 'BootSourceSelection'}, | ||
124 | 90 | 'arches': ('djorm_pgarray.fields.ArrayField', [], {'default': 'None', 'dbtype': "u'text'", 'null': 'True', 'blank': 'True'}), | ||
125 | 91 | 'boot_source': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['maasserver.BootSource']"}), | ||
126 | 92 | 'created': ('django.db.models.fields.DateTimeField', [], {}), | ||
127 | 93 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
128 | 94 | 'labels': ('djorm_pgarray.fields.ArrayField', [], {'default': 'None', 'dbtype': "u'text'", 'null': 'True', 'blank': 'True'}), | ||
129 | 95 | 'release': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '20', 'blank': 'True'}), | ||
130 | 96 | 'subarches': ('djorm_pgarray.fields.ArrayField', [], {'default': 'None', 'dbtype': "u'text'", 'null': 'True', 'blank': 'True'}), | ||
131 | 97 | 'updated': ('django.db.models.fields.DateTimeField', [], {}) | ||
132 | 98 | }, | ||
133 | 99 | u'maasserver.componenterror': { | ||
134 | 100 | 'Meta': {'object_name': 'ComponentError'}, | ||
135 | 101 | 'component': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '40'}), | ||
136 | 102 | 'created': ('django.db.models.fields.DateTimeField', [], {}), | ||
137 | 103 | 'error': ('django.db.models.fields.CharField', [], {'max_length': '1000'}), | ||
138 | 104 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
139 | 105 | 'updated': ('django.db.models.fields.DateTimeField', [], {}) | ||
140 | 106 | }, | ||
141 | 107 | u'maasserver.config': { | ||
142 | 108 | 'Meta': {'object_name': 'Config'}, | ||
143 | 109 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
144 | 110 | 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}), | ||
145 | 111 | 'value': ('maasserver.fields.JSONObjectField', [], {'null': 'True'}) | ||
146 | 112 | }, | ||
147 | 113 | u'maasserver.dhcplease': { | ||
148 | 114 | 'Meta': {'object_name': 'DHCPLease'}, | ||
149 | 115 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
150 | 116 | 'ip': ('django.db.models.fields.IPAddressField', [], {'unique': 'True', 'max_length': '15'}), | ||
151 | 117 | 'mac': ('maasserver.fields.MACAddressField', [], {}), | ||
152 | 118 | 'nodegroup': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['maasserver.NodeGroup']"}) | ||
153 | 119 | }, | ||
154 | 120 | u'maasserver.downloadprogress': { | ||
155 | 121 | 'Meta': {'object_name': 'DownloadProgress'}, | ||
156 | 122 | 'bytes_downloaded': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), | ||
157 | 123 | 'created': ('django.db.models.fields.DateTimeField', [], {}), | ||
158 | 124 | 'error': ('django.db.models.fields.CharField', [], {'max_length': '1000', 'blank': 'True'}), | ||
159 | 125 | 'filename': ('django.db.models.fields.CharField', [], {'max_length': '255'}), | ||
160 | 126 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
161 | 127 | 'nodegroup': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['maasserver.NodeGroup']"}), | ||
162 | 128 | 'size': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), | ||
163 | 129 | 'updated': ('django.db.models.fields.DateTimeField', [], {}) | ||
164 | 130 | }, | ||
165 | 131 | u'maasserver.filestorage': { | ||
166 | 132 | 'Meta': {'unique_together': "((u'filename', u'owner'),)", 'object_name': 'FileStorage'}, | ||
167 | 133 | 'content': ('metadataserver.fields.BinaryField', [], {'blank': 'True'}), | ||
168 | 134 | 'filename': ('django.db.models.fields.CharField', [], {'max_length': '255'}), | ||
169 | 135 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
170 | 136 | 'key': ('django.db.models.fields.CharField', [], {'default': "u'ab43bb24-db7a-11e3-81cc-bcee7b78dc5b'", 'unique': 'True', 'max_length': '36'}), | ||
171 | 137 | 'owner': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': u"orm['auth.User']", 'null': 'True', 'blank': 'True'}) | ||
172 | 138 | }, | ||
173 | 139 | u'maasserver.macaddress': { | ||
174 | 140 | 'Meta': {'object_name': 'MACAddress'}, | ||
175 | 141 | 'created': ('django.db.models.fields.DateTimeField', [], {}), | ||
176 | 142 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
177 | 143 | 'mac_address': ('maasserver.fields.MACAddressField', [], {'unique': 'True'}), | ||
178 | 144 | 'networks': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['maasserver.Network']", 'symmetrical': 'False', 'blank': 'True'}), | ||
179 | 145 | 'node': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['maasserver.Node']"}), | ||
180 | 146 | 'updated': ('django.db.models.fields.DateTimeField', [], {}) | ||
181 | 147 | }, | ||
182 | 148 | u'maasserver.network': { | ||
183 | 149 | 'Meta': {'object_name': 'Network'}, | ||
184 | 150 | 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}), | ||
185 | 151 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
186 | 152 | 'ip': ('django.db.models.fields.GenericIPAddressField', [], {'unique': 'True', 'max_length': '39'}), | ||
187 | 153 | 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}), | ||
188 | 154 | 'netmask': ('django.db.models.fields.GenericIPAddressField', [], {'max_length': '39'}), | ||
189 | 155 | 'vlan_tag': ('django.db.models.fields.PositiveSmallIntegerField', [], {'unique': 'True', 'null': 'True', 'blank': 'True'}) | ||
190 | 156 | }, | ||
191 | 157 | u'maasserver.node': { | ||
192 | 158 | 'Meta': {'object_name': 'Node'}, | ||
193 | 159 | 'agent_name': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '255', 'null': 'True', 'blank': 'True'}), | ||
194 | 160 | 'architecture': ('django.db.models.fields.CharField', [], {'max_length': '31'}), | ||
195 | 161 | 'cpu_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), | ||
196 | 162 | 'created': ('django.db.models.fields.DateTimeField', [], {}), | ||
197 | 163 | 'distro_series': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '20', 'blank': 'True'}), | ||
198 | 164 | 'error': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '255', 'blank': 'True'}), | ||
199 | 165 | 'hostname': ('django.db.models.fields.CharField', [], {'default': "u''", 'unique': 'True', 'max_length': '255', 'blank': 'True'}), | ||
200 | 166 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
201 | 167 | 'memory': ('django.db.models.fields.IntegerField', [], {'default': '0'}), | ||
202 | 168 | 'netboot': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), | ||
203 | 169 | 'nodegroup': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['maasserver.NodeGroup']", 'null': 'True'}), | ||
204 | 170 | 'osystem': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '20', 'blank': 'True'}), | ||
205 | 171 | 'owner': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': u"orm['auth.User']", 'null': 'True', 'blank': 'True'}), | ||
206 | 172 | 'power_parameters': ('maasserver.fields.JSONObjectField', [], {'default': "u''", 'blank': 'True'}), | ||
207 | 173 | 'power_type': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '10', 'blank': 'True'}), | ||
208 | 174 | 'routers': ('djorm_pgarray.fields.ArrayField', [], {'default': 'None', 'dbtype': "u'macaddr'", 'null': 'True', 'blank': 'True'}), | ||
209 | 175 | 'status': ('django.db.models.fields.IntegerField', [], {'default': '0', 'max_length': '10'}), | ||
210 | 176 | 'storage': ('django.db.models.fields.IntegerField', [], {'default': '0'}), | ||
211 | 177 | 'system_id': ('django.db.models.fields.CharField', [], {'default': "u'node-ab42b030-db7a-11e3-81cc-bcee7b78dc5b'", 'unique': 'True', 'max_length': '41'}), | ||
212 | 178 | 'tags': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['maasserver.Tag']", 'symmetrical': 'False'}), | ||
213 | 179 | 'token': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['piston.Token']", 'null': 'True'}), | ||
214 | 180 | 'updated': ('django.db.models.fields.DateTimeField', [], {}), | ||
215 | 181 | 'zone': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['maasserver.Zone']", 'on_delete': 'models.SET_DEFAULT'}) | ||
216 | 182 | }, | ||
217 | 183 | u'maasserver.nodegroup': { | ||
218 | 184 | 'Meta': {'object_name': 'NodeGroup'}, | ||
219 | 185 | 'api_key': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '18'}), | ||
220 | 186 | 'api_token': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['piston.Token']", 'unique': 'True'}), | ||
221 | 187 | 'cluster_name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100', 'blank': 'True'}), | ||
222 | 188 | 'created': ('django.db.models.fields.DateTimeField', [], {}), | ||
223 | 189 | 'dhcp_key': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '255', 'blank': 'True'}), | ||
224 | 190 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
225 | 191 | 'maas_url': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '255', 'blank': 'True'}), | ||
226 | 192 | 'name': ('django.db.models.fields.CharField', [], {'max_length': '80', 'blank': 'True'}), | ||
227 | 193 | 'status': ('django.db.models.fields.IntegerField', [], {'default': '0'}), | ||
228 | 194 | 'updated': ('django.db.models.fields.DateTimeField', [], {}), | ||
229 | 195 | 'uuid': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '36'}) | ||
230 | 196 | }, | ||
231 | 197 | u'maasserver.nodegroupinterface': { | ||
232 | 198 | 'Meta': {'unique_together': "((u'nodegroup', u'interface'),)", 'object_name': 'NodeGroupInterface'}, | ||
233 | 199 | 'broadcast_ip': ('django.db.models.fields.GenericIPAddressField', [], {'default': 'None', 'max_length': '39', 'null': 'True', 'blank': 'True'}), | ||
234 | 200 | 'created': ('django.db.models.fields.DateTimeField', [], {}), | ||
235 | 201 | 'foreign_dhcp_ip': ('django.db.models.fields.GenericIPAddressField', [], {'default': 'None', 'max_length': '39', 'null': 'True', 'blank': 'True'}), | ||
236 | 202 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
237 | 203 | 'interface': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '255', 'blank': 'True'}), | ||
238 | 204 | 'ip': ('django.db.models.fields.GenericIPAddressField', [], {'max_length': '39'}), | ||
239 | 205 | 'ip_range_high': ('django.db.models.fields.GenericIPAddressField', [], {'default': 'None', 'max_length': '39', 'null': 'True', 'blank': 'True'}), | ||
240 | 206 | 'ip_range_low': ('django.db.models.fields.GenericIPAddressField', [], {'default': 'None', 'max_length': '39', 'null': 'True', 'blank': 'True'}), | ||
241 | 207 | 'management': ('django.db.models.fields.IntegerField', [], {'default': '0'}), | ||
242 | 208 | 'nodegroup': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['maasserver.NodeGroup']"}), | ||
243 | 209 | 'router_ip': ('django.db.models.fields.GenericIPAddressField', [], {'default': 'None', 'max_length': '39', 'null': 'True', 'blank': 'True'}), | ||
244 | 210 | 'subnet_mask': ('django.db.models.fields.GenericIPAddressField', [], {'default': 'None', 'max_length': '39', 'null': 'True', 'blank': 'True'}), | ||
245 | 211 | 'updated': ('django.db.models.fields.DateTimeField', [], {}) | ||
246 | 212 | }, | ||
247 | 213 | u'maasserver.sshkey': { | ||
248 | 214 | 'Meta': {'unique_together': "((u'user', u'key'),)", 'object_name': 'SSHKey'}, | ||
249 | 215 | 'created': ('django.db.models.fields.DateTimeField', [], {}), | ||
250 | 216 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
251 | 217 | 'key': ('django.db.models.fields.TextField', [], {}), | ||
252 | 218 | 'updated': ('django.db.models.fields.DateTimeField', [], {}), | ||
253 | 219 | 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']"}) | ||
254 | 220 | }, | ||
255 | 221 | u'maasserver.tag': { | ||
256 | 222 | 'Meta': {'object_name': 'Tag'}, | ||
257 | 223 | 'comment': ('django.db.models.fields.TextField', [], {'blank': 'True'}), | ||
258 | 224 | 'created': ('django.db.models.fields.DateTimeField', [], {}), | ||
259 | 225 | 'definition': ('django.db.models.fields.TextField', [], {'blank': 'True'}), | ||
260 | 226 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
261 | 227 | 'kernel_opts': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), | ||
262 | 228 | 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '256'}), | ||
263 | 229 | 'updated': ('django.db.models.fields.DateTimeField', [], {}) | ||
264 | 230 | }, | ||
265 | 231 | u'maasserver.userprofile': { | ||
266 | 232 | 'Meta': {'object_name': 'UserProfile'}, | ||
267 | 233 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
268 | 234 | 'user': ('django.db.models.fields.related.OneToOneField', [], {'to': u"orm['auth.User']", 'unique': 'True'}) | ||
269 | 235 | }, | ||
270 | 236 | u'maasserver.zone': { | ||
271 | 237 | 'Meta': {'ordering': "[u'name']", 'object_name': 'Zone'}, | ||
272 | 238 | 'created': ('django.db.models.fields.DateTimeField', [], {}), | ||
273 | 239 | 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}), | ||
274 | 240 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
275 | 241 | 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '256'}), | ||
276 | 242 | 'updated': ('django.db.models.fields.DateTimeField', [], {}) | ||
277 | 243 | }, | ||
278 | 244 | u'piston.consumer': { | ||
279 | 245 | 'Meta': {'object_name': 'Consumer'}, | ||
280 | 246 | 'description': ('django.db.models.fields.TextField', [], {}), | ||
281 | 247 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
282 | 248 | 'key': ('django.db.models.fields.CharField', [], {'max_length': '18'}), | ||
283 | 249 | 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}), | ||
284 | 250 | 'secret': ('django.db.models.fields.CharField', [], {'max_length': '32'}), | ||
285 | 251 | 'status': ('django.db.models.fields.CharField', [], {'default': "'pending'", 'max_length': '16'}), | ||
286 | 252 | 'user': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'consumers'", 'null': 'True', 'to': u"orm['auth.User']"}) | ||
287 | 253 | }, | ||
288 | 254 | u'piston.token': { | ||
289 | 255 | 'Meta': {'object_name': 'Token'}, | ||
290 | 256 | 'callback': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), | ||
291 | 257 | 'callback_confirmed': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), | ||
292 | 258 | 'consumer': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['piston.Consumer']"}), | ||
293 | 259 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
294 | 260 | 'is_approved': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), | ||
295 | 261 | 'key': ('django.db.models.fields.CharField', [], {'max_length': '18'}), | ||
296 | 262 | 'secret': ('django.db.models.fields.CharField', [], {'max_length': '32'}), | ||
297 | 263 | 'timestamp': ('django.db.models.fields.IntegerField', [], {'default': '1400080565L'}), | ||
298 | 264 | 'token_type': ('django.db.models.fields.IntegerField', [], {}), | ||
299 | 265 | 'user': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'tokens'", 'null': 'True', 'to': u"orm['auth.User']"}), | ||
300 | 266 | 'verifier': ('django.db.models.fields.CharField', [], {'max_length': '10'}) | ||
301 | 267 | } | ||
302 | 268 | } | ||
303 | 269 | |||
304 | 270 | complete_apps = ['maasserver'] | ||
305 | 0 | 271 | ||
306 | === modified file 'src/maasserver/models/node.py' | |||
307 | --- src/maasserver/models/node.py 2014-05-09 06:04:54 +0000 | |||
308 | +++ src/maasserver/models/node.py 2014-05-14 15:21:48 +0000 | |||
309 | @@ -450,6 +450,10 @@ | |||
310 | 450 | :ivar status: This `Node`'s status. See the vocabulary | 450 | :ivar status: This `Node`'s status. See the vocabulary |
311 | 451 | :class:`NODE_STATUS`. | 451 | :class:`NODE_STATUS`. |
312 | 452 | :ivar owner: This `Node`'s owner if it's in use, None otherwise. | 452 | :ivar owner: This `Node`'s owner if it's in use, None otherwise. |
313 | 453 | :ivar osystem: This `Node`'s booting operating system, if it's blank then | ||
314 | 454 | the default_osystem will be used. | ||
315 | 455 | :ivar distro_series: This `Node`'s booting distro series, if | ||
316 | 456 | it's blank then the default_distro_series will be used. | ||
317 | 453 | :ivar power_type: The power type that determines how this | 457 | :ivar power_type: The power type that determines how this |
318 | 454 | node will be powered on. Its value must match a power driver template | 458 | node will be powered on. Its value must match a power driver template |
319 | 455 | name. | 459 | name. |
320 | @@ -477,9 +481,11 @@ | |||
321 | 477 | owner = ForeignKey( | 481 | owner = ForeignKey( |
322 | 478 | User, default=None, blank=True, null=True, editable=False) | 482 | User, default=None, blank=True, null=True, editable=False) |
323 | 479 | 483 | ||
324 | 484 | osystem = CharField( | ||
325 | 485 | max_length=20, blank=True, default='') | ||
326 | 486 | |||
327 | 480 | distro_series = CharField( | 487 | distro_series = CharField( |
330 | 481 | max_length=20, choices=DISTRO_SERIES_CHOICES, null=True, | 488 | max_length=20, choices=DISTRO_SERIES_CHOICES, blank=True, default='') |
329 | 482 | blank=True, default='') | ||
331 | 483 | 489 | ||
332 | 484 | architecture = CharField(max_length=31, blank=False) | 490 | architecture = CharField(max_length=31, blank=False) |
333 | 485 | 491 | ||
334 | 486 | 492 | ||
335 | === modified file 'src/maasserver/testing/factory.py' | |||
336 | --- src/maasserver/testing/factory.py 2014-05-13 18:55:36 +0000 | |||
337 | +++ src/maasserver/testing/factory.py 2014-05-14 15:21:48 +0000 | |||
338 | @@ -59,7 +59,6 @@ | |||
339 | 59 | NodeCommissionResult, | 59 | NodeCommissionResult, |
340 | 60 | ) | 60 | ) |
341 | 61 | from netaddr import IPAddress | 61 | from netaddr import IPAddress |
342 | 62 | |||
343 | 63 | # XXX 2014-05-13 blake-rouse bug=1319143 | 62 | # XXX 2014-05-13 blake-rouse bug=1319143 |
344 | 64 | # Need to not import directly, use RPC to info from cluster. | 63 | # Need to not import directly, use RPC to info from cluster. |
345 | 65 | from provisioningserver.driver import OperatingSystemRegistry | 64 | from provisioningserver.driver import OperatingSystemRegistry |
346 | 66 | 65 | ||
347 | === modified file 'src/maasserver/testing/osystems.py' | |||
348 | --- src/maasserver/testing/osystems.py 2014-05-01 19:25:38 +0000 | |||
349 | +++ src/maasserver/testing/osystems.py 2014-05-14 15:21:48 +0000 | |||
350 | @@ -21,8 +21,8 @@ | |||
351 | 21 | 21 | ||
352 | 22 | from maasserver import forms | 22 | from maasserver import forms |
353 | 23 | from maasserver.testing.factory import factory | 23 | from maasserver.testing.factory import factory |
354 | 24 | from provisioningserver.boot.tests.test_tftppath import make_osystem | ||
355 | 24 | from provisioningserver.driver import BOOT_IMAGE_PURPOSE | 25 | from provisioningserver.driver import BOOT_IMAGE_PURPOSE |
356 | 25 | from provisioningserver.boot.tests.test_tftppath import make_osystem | ||
357 | 26 | 26 | ||
358 | 27 | 27 | ||
359 | 28 | def make_osystem_with_releases(testcase, osystem_name=None, releases=None): | 28 | def make_osystem_with_releases(testcase, osystem_name=None, releases=None): |
360 | 29 | 29 | ||
361 | === modified file 'src/provisioningserver/boot/tftppath.py' | |||
362 | --- src/provisioningserver/boot/tftppath.py 2014-05-01 18:54:22 +0000 | |||
363 | +++ src/provisioningserver/boot/tftppath.py 2014-05-14 15:21:48 +0000 | |||
364 | @@ -27,6 +27,7 @@ | |||
365 | 27 | 27 | ||
366 | 28 | from provisioningserver.driver import OperatingSystemRegistry | 28 | from provisioningserver.driver import OperatingSystemRegistry |
367 | 29 | 29 | ||
368 | 30 | |||
369 | 30 | logger = getLogger(__name__) | 31 | logger = getLogger(__name__) |
370 | 31 | 32 | ||
371 | 32 | 33 | ||
372 | 33 | 34 | ||
373 | === modified file 'src/provisioningserver/driver/tests/test_os_ubuntu.py' | |||
374 | --- src/provisioningserver/driver/tests/test_os_ubuntu.py 2014-05-01 19:25:38 +0000 | |||
375 | +++ src/provisioningserver/driver/tests/test_os_ubuntu.py 2014-05-14 15:21:48 +0000 | |||
376 | @@ -15,6 +15,7 @@ | |||
377 | 15 | __all__ = [] | 15 | __all__ = [] |
378 | 16 | 16 | ||
379 | 17 | from itertools import product | 17 | from itertools import product |
380 | 18 | |||
381 | 18 | from maastesting.factory import factory | 19 | from maastesting.factory import factory |
382 | 19 | from maastesting.testcase import MAASTestCase | 20 | from maastesting.testcase import MAASTestCase |
383 | 20 | from provisioningserver.driver import BOOT_IMAGE_PURPOSE | 21 | from provisioningserver.driver import BOOT_IMAGE_PURPOSE |
Looks good, just a few comments.
[1]
Be sure to run 'make format', migrations/ 0077_add_ osystem_ to_node. py gets cleaned up a
src/maasserver/
bit by it.
[2]
=== added file 'src/maasserver /migrations/ 0077_add_ osystem_ to_node. py' migrations/ 0077_add_ osystem_ to_node. py 1970-01-01 00:00:00 +0000 migrations/ 0077_add_ osystem_ to_node. py 2014-05-14 12:45:06 +0000
--- src/maasserver/
+++ src/maasserver/
There is already another 0077 migration, so you'll have to merge and
regenerate this.
[3]
+ def forwards(self, orm): column( u'maasserver_ node', 'osystem', 'django. db.models. fields. CharField' )(default= u'', max_length=20, null=True, blank=True),
+ # Adding field 'Node.osystem'
+ db.add_
+ self.gf(
+ keep_default=False)
The max_length for Node's osystem field (20) doesn't match the max
length for BootImage's osystem field (255). If they're holding the
same set of values they should have the same types.
Also, Is there a set of osystem values a Node's osystem value should be
constrained to? Should a node always have an osystem that some BootImage
has, or is there some set they should both be constrained to?
[4]
There should be at least some basic test involving the osystem field.