Merge lp:~jtv/maas/drop-install-pxe-bootloader into lp:~maas-committers/maas/trunk

Proposed by Jeroen T. Vermeulen
Status: Merged
Approved by: Jeroen T. Vermeulen
Approved revision: no longer in the source branch.
Merged at revision: 2209
Proposed branch: lp:~jtv/maas/drop-install-pxe-bootloader
Merge into: lp:~maas-committers/maas/trunk
Diff against target: 107 lines (+7/-44)
3 files modified
src/provisioningserver/__main__.py (+0/-1)
src/provisioningserver/boot/install_bootloader.py (+2/-21)
src/provisioningserver/boot/tests/test_install_bootloader.py (+5/-22)
To merge this branch: bzr merge lp:~jtv/maas/drop-install-pxe-bootloader
Reviewer Review Type Date Requested Status
Raphaël Badin (community) Approve
Review via email: mp+213428@code.launchpad.net

Commit message

Drop the install-pxe-bootloader provisioning command. It's been there, essentially unchanged, since 2012 and we no longer use it anywhere.

Description of the change

This is a lot less exciting than I thought. The actual code underlying the command is still used, although the provisioning command as such isn't. And so all that goes away is the scaffolding that makes it a provisioning command.

Also unused and unmentioned are provisioning commands customize-config and install-uefi-config. Of these, the former is a utility that may still come in handy at some point in the future (though hopefully not — we don't want more shell code). The latter is new, and so there may be a plan for it. I'm leaving these two items untouched.

Jeroen

To post a comment you must log in.
Revision history for this message
Raphaël Badin (rvb) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/provisioningserver/__main__.py'
2--- src/provisioningserver/__main__.py 2014-03-28 04:43:57 +0000
3+++ src/provisioningserver/__main__.py 2014-03-31 10:35:56 +0000
4@@ -30,7 +30,6 @@
5 'atomic-write': AtomicWriteScript,
6 'customize-config': provisioningserver.customize_config,
7 'generate-dhcp-config': provisioningserver.dhcp.writer,
8- 'install-pxe-bootloader': provisioningserver.boot.install_bootloader,
9 'install-uefi-config': provisioningserver.boot.install_grub,
10 'start-cluster-controller': provisioningserver.start_cluster_controller,
11 'upgrade-cluster': provisioningserver.upgrade_cluster,
12
13=== modified file 'src/provisioningserver/boot/install_bootloader.py'
14--- src/provisioningserver/boot/install_bootloader.py 2014-03-28 06:51:59 +0000
15+++ src/provisioningserver/boot/install_bootloader.py 2014-03-31 10:35:56 +0000
16@@ -13,8 +13,8 @@
17
18 __metaclass__ = type
19 __all__ = [
20- "add_arguments",
21- "run",
22+ "install_bootloader",
23+ "make_destination",
24 ]
25
26 import filecmp
27@@ -22,7 +22,6 @@
28 from shutil import copyfile
29
30 from provisioningserver.boot.tftppath import locate_tftp_path
31-from provisioningserver.config import Config
32
33
34 def make_destination(tftproot):
35@@ -78,21 +77,3 @@
36 os.remove(temp_file)
37 copyfile(loader, temp_file)
38 os.rename(temp_file, destination)
39-
40-
41-def add_arguments(parser):
42- parser.add_argument(
43- '--loader', dest='loader', default=None,
44- help="Pre-boot loader to install.")
45-
46-
47-def run(args):
48- """Install a pre-boot loader into the TFTP directory structure.
49-
50- This won't overwrite an existing loader if its contents are unchanged.
51- """
52- config = Config.load(args.config_file)
53- tftproot = config["tftp"]["resource_root"]
54- destination_path = make_destination(tftproot)
55- destination = os.path.join(destination_path, os.path.basename(args.loader))
56- install_bootloader(args.loader, destination)
57
58=== modified file 'src/provisioningserver/boot/tests/test_install_bootloader.py'
59--- src/provisioningserver/boot/tests/test_install_bootloader.py 2014-03-28 04:31:32 +0000
60+++ src/provisioningserver/boot/tests/test_install_bootloader.py 2014-03-31 10:35:56 +0000
61@@ -22,41 +22,24 @@
62 age_file,
63 get_write_time,
64 )
65-import provisioningserver.boot.install_bootloader
66 from provisioningserver.boot.install_bootloader import (
67 install_bootloader,
68 make_destination,
69 )
70-from provisioningserver.boot.tftppath import locate_tftp_path
71-from provisioningserver.testing.config import set_tftp_root
72-from provisioningserver.utils import MainScript
73 from testtools.matchers import (
74 DirExists,
75 FileContains,
76- FileExists,
77 )
78
79
80 class TestInstallBootloader(MAASTestCase):
81
82 def test_integration(self):
83- tftproot = self.make_dir()
84- config_fixture = self.useFixture(set_tftp_root(tftproot))
85-
86- loader = self.make_file()
87-
88- action = factory.make_name("action")
89- script = MainScript(action)
90- script.register(action, provisioningserver.boot.install_bootloader)
91- script.execute(
92- ("--config-file", config_fixture.filename, action,
93- "--loader", loader))
94-
95- bootloader_filename = os.path.basename(loader)
96- self.assertThat(
97- locate_tftp_path(
98- bootloader_filename, tftproot=tftproot),
99- FileExists())
100+ loader_contents = factory.getRandomString()
101+ loader = self.make_file(contents=loader_contents)
102+ destination = self.make_file()
103+ install_bootloader(loader, destination)
104+ self.assertThat(destination, FileContains(loader_contents))
105
106 def test_make_destination_creates_directory_if_not_present(self):
107 tftproot = self.make_dir()