<bigjools> I am trying to be constructive on the review but you're going to hate me, sorry :(
<roaksoax> hehe :)
Did you guys have any pre-implementation chat with one of us before starting this? I can't approve this as it stands for quite a few fundamental architectural reasons, and also it's an 1100+ line diff without a single test change. I did previously say I won't accept any more branches that have untested code, especially untested walls of shell :(
This scares the bejesus out of me. This is just a workaround so that the shell script make-userdata-maas can be used instead of doing it properly in Python, and tested. It has completely sidestepped all of the code that exists already in src/maasserver/preseed.py and src/maasserver/compose_preseed.py that calculates preseed_data based on the node state.
It is extremely fragile and it is likely to break, horribly, in many ways, as soon as someone changes anything elsewhere.
At the very least, this template should not be calling out to the shell script. If you can't re-write it in Python and test it in the time available, it should be called from the existing Python code that generates preseeds and returned in preseed_data for the template. It can then be tested so we know the right preseed is getting returned for FPI.
The changes in all these files need tests. I expect some tests are broken as a result but I can't run the test suite at the moment as I get this:
$ make build
bin/buildout install database
Traceback (most recent call last):
File "bin/buildout", line 5, in <module>
from pkg_resources import load_entry_point
File "/home/ed/canonical/maas/sandbox/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/pkg_resources.py", line 16, in <module>
import sys, os, zipimport, time, re, imp, types
File "/home/ed/canonical/maas/sandbox/lib/python2.7/re.py", line 105, in <module>
import sre_compile
File "/home/ed/canonical/maas/sandbox/lib/python2.7/sre_compile.py", line 14, in <module>
import sre_parse
File "/home/ed/canonical/maas/sandbox/lib/python2.7/sre_parse.py", line 17, in <module>
from sre_constants import *
File "/home/ed/canonical/maas/sandbox/lib/python2.7/sre_constants.py", line 18, in <module>
from _sre import MAXREPEAT
ImportError: cannot import name MAXREPEAT
Don't bother with both SAY commands, they get parsed and executed before choosing the LABEL so both get printed. You could fix the existing templates too.
I have not reviewed the changes in the contrib/ directory, shell is not my expertise. Also, no tests :(
I realise that you need to get *something* in raring before FF tomorrow. Last-minute rushed changes are never good, but if you can at least add tests and make the change to the preseed template as I suggested then this could land with a view to improving more later.
<bigjools> I am trying to be constructive on the review but you're going to hate me, sorry :(
<roaksoax> hehe :)
Did you guys have any pre-implementation chat with one of us before starting this? I can't approve this as it stands for quite a few fundamental architectural reasons, and also it's an 1100+ line diff without a single test change. I did previously say I won't accept any more branches that have untested code, especially untested walls of shell :(
More below.
25 === added file 'contrib/ preseeds_ v2/preseed_ xinstall' preseeds_ v2/preseed_ xinstall 1970-01-01 00:00:00 +0000 preseeds_ v2/preseed_ xinstall 2013-04-17 16:47:25 +0000 check_output( ["/usr/ share/maas/ xinstall/ make-userdata- maas", proxy=" +proxy, selections= "+preseed_ data, url="+node_ disable_ pxe_url, url-data= "+node_ disable_ pxe_data, host+"/ MAAS/static/ images/ "+node. architecture+ "/"+node. distro_ series+ "/xinstall/ root.tar. gz",
26 --- contrib/
27 +++ contrib/
[snip]
36 +preseed = subprocess.
37 + "--apt-
38 + "--dpkg-
39 + "--finished-
40 + "--finished-
41 + "http://"+cluster_
42 + "/dev/sda"])
43 +}}
44 +{{preseed}}
This scares the bejesus out of me. This is just a workaround so that the shell script make-userdata-maas can be used instead of doing it properly in Python, and tested. It has completely sidestepped all of the code that exists already in src/maasserver/ preseed. py and src/maasserver/ compose_ preseed. py that calculates preseed_data based on the node state.
It is extremely fragile and it is likely to break, horribly, in many ways, as soon as someone changes anything elsewhere.
At the very least, this template should not be calling out to the shell script. If you can't re-write it in Python and test it in the time available, it should be called from the existing Python code that generates preseeds and returned in preseed_data for the template. It can then be tested so we know the right preseed is getting returned for FPI.
1045 === modified file 'src/maasserver /api.py' /models/ nodegroup. py' /preseed. py' ngserver/ kernel_ opts.py' ngserver/ pxe/install_ image.py'
1061 === modified file 'src/maasserver
1077 === modified file 'src/maasserver
1096 === modified file 'src/provisioni
1135 === modified file 'src/provisioni
The changes in all these files need tests. I expect some tests are broken as a result but I can't run the test suite at the moment as I get this:
$ make build ed/canonical/ maas/sandbox/ local/lib/ python2. 7/site- packages/ distribute- 0.6.24- py2.7.egg/ pkg_resources. py", line 16, in <module> ed/canonical/ maas/sandbox/ lib/python2. 7/re.py" , line 105, in <module> ed/canonical/ maas/sandbox/ lib/python2. 7/sre_compile. py", line 14, in <module> ed/canonical/ maas/sandbox/ lib/python2. 7/sre_parse. py", line 17, in <module> ed/canonical/ maas/sandbox/ lib/python2. 7/sre_constants .py", line 18, in <module>
bin/buildout install database
Traceback (most recent call last):
File "bin/buildout", line 5, in <module>
from pkg_resources import load_entry_point
File "/home/
import sys, os, zipimport, time, re, imp, types
File "/home/
import sre_compile
File "/home/
import sre_parse
File "/home/
from sre_constants import *
File "/home/
from _sre import MAXREPEAT
ImportError: cannot import name MAXREPEAT
1109 === added file 'src/provisioni ngserver/ pxe/config. xinstall. template' gserver/ pxe/config. xinstall. template 1970-01-01 00:00:00 +0000 gserver/ pxe/config. xinstall. template 2013-04-17 16:47:25 +0000
1110 --- src/provisionin
1111 +++ src/provisionin
[snip]
1119 +LABEL amd64
1120 + SAY Booting (amd64) under MAAS direction...
[snip]
1127 +LABEL i386
1128 + SAY Booting (i386) under MAAS direction...
Don't bother with both SAY commands, they get parsed and executed before choosing the LABEL so both get printed. You could fix the existing templates too.
I have not reviewed the changes in the contrib/ directory, shell is not my expertise. Also, no tests :(
I realise that you need to get *something* in raring before FF tomorrow. Last-minute rushed changes are never good, but if you can at least add tests and make the change to the preseed template as I suggested then this could land with a view to improving more later.
J