launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #09715
[Merge] lp:~allenap/maas/dynamic-tftp-polish into lp:maas
Gavin Panella has proposed merging lp:~allenap/maas/dynamic-tftp-polish into lp:maas.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~allenap/maas/dynamic-tftp-polish/+merge/113970
--
https://code.launchpad.net/~allenap/maas/dynamic-tftp-polish/+merge/113970
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~allenap/maas/dynamic-tftp-polish into lp:maas.
=== modified file 'src/provisioningserver/plugin.py'
--- src/provisioningserver/plugin.py 2012-07-05 20:19:59 +0000
+++ src/provisioningserver/plugin.py 2012-07-09 13:01:21 +0000
@@ -13,7 +13,6 @@
__all__ = []
from getpass import getuser
-from os import getcwd
from formencode import Schema
from formencode.validators import (
@@ -24,6 +23,7 @@
)
from provisioningserver.amqpclient import AMQFactory
from provisioningserver.cobblerclient import CobblerSession
+from provisioningserver.pxe.tftppath import locate_tftp_path
from provisioningserver.remote import ProvisioningAPI_XMLRPC
from provisioningserver.services import (
LogService,
@@ -150,7 +150,7 @@
if_key_missing = None
- root = String(if_missing=getcwd())
+ root = String(if_missing=locate_tftp_path())
port = Int(min=1, max=65535, if_missing=5244)
generator = URL(
add_http=True, require_tld=False,
=== modified file 'src/provisioningserver/pxe/tests/test_tftppath.py'
--- src/provisioningserver/pxe/tests/test_tftppath.py 2012-06-29 04:52:07 +0000
+++ src/provisioningserver/pxe/tests/test_tftppath.py 2012-07-09 13:01:21 +0000
@@ -91,3 +91,6 @@
self.assertEqual(
os.path.join(tftproot, pxefile),
locate_tftp_path(pxefile, tftproot=tftproot))
+
+ def test_locate_tftp_path_returns_root_by_default(self):
+ self.assertEqual(TFTPROOT, locate_tftp_path())
=== modified file 'src/provisioningserver/pxe/tftppath.py'
--- src/provisioningserver/pxe/tftppath.py 2012-06-29 04:53:31 +0000
+++ src/provisioningserver/pxe/tftppath.py 2012-07-09 13:01:21 +0000
@@ -61,7 +61,7 @@
return '/'.join(['/maas', arch, subarch, release, purpose])
-def locate_tftp_path(tftp_path, tftproot=None):
+def locate_tftp_path(tftp_path=None, tftproot=None):
"""Return the local filesystem path corresponding to `tftp_path`.
The return value gives the filesystem path where you'd have to put
@@ -74,4 +74,6 @@
"""
if tftproot is None:
tftproot = TFTPROOT
+ if tftp_path is None:
+ return tftproot
return os.path.join(tftproot, tftp_path.lstrip('/'))
=== modified file 'src/provisioningserver/tests/test_plugin.py'
--- src/provisioningserver/tests/test_plugin.py 2012-07-05 20:22:52 +0000
+++ src/provisioningserver/tests/test_plugin.py 2012-07-09 13:01:21 +0000
@@ -31,6 +31,7 @@
ProvisioningServiceMaker,
SingleUsernamePasswordChecker,
)
+from provisioningserver.pxe.tftppath import locate_tftp_path
from provisioningserver.testing.fakecobbler import make_fake_cobbler_session
from provisioningserver.tftp import TFTPBackend
from testtools.deferredruntest import (
@@ -86,7 +87,7 @@
'tftp': {
'generator': 'http://localhost:5243/api/1.0/pxeconfig',
'port': 5244,
- 'root': os.getcwd(),
+ 'root': locate_tftp_path(),
},
'interface': '127.0.0.1',
'port': 5241,