~ubuntu-branches/ubuntu/trusty/maas/trusty-security

« back to all changes in this revision

Viewing changes to src/provisioningserver/boot/tests/test_install_bootloader.py

  • Committer: Package Import Robot
  • Author(s): Andres Rodriguez, Andres Rodriguez, Jason Hobbs, Jeroen Vermeulen
  • Date: 2014-04-03 13:45:02 UTC
  • mfrom: (1.2.27)
  • Revision ID: package-import@ubuntu.com-20140403134502-k8ocidn51k203zzw
Tags: 1.5+bzr2227-0ubuntu1
* New upstream bugfix release:
  - Fix catching exceptions raised by
    twisted.conch.ssh.keys.Key.fromString (LP: #1298788)
  - Fix validationg in default NodeGroupInterface.broadcast_ip making it
    optional. (LP: #1299374)
  - Drop install-pxe-bootloader as it conflicts with newer import script.
  - Remove references to old import script.
  - Fix changes that cause overwriting of existing entries.
  - Fix inappropriate ValidationError when defining networks with nested
    (but non-identical) address ranges. (LP: #1299114)
  - Fix issue where if a node does not provide an architecture type on dhcp
    request, or no other boot method is available for that architecture,
    the node still uses pxelinux.0 to boot. (LP: #1300285)
  - Take an advisory lock to prevent concurrent creation of the
    eventloops table. (LP: #1300363)
  - Remove the cloud_images_archive setting, as it conflicts with new
    import script. (LP: #1300587)
  - Add a 'logout confirmation' page. Using this, the logout action is
    protected against CSRF attacks because it uses a POST request, in
    conjunction with Django's CSRF protection feature. (LP: #1298790)
  - Fix cluster listings when dealing with large number of clusters by
    paginating it. (LP: #1301242)
  - Change list_boot_images() so that it can cope with a missing boot
    images directory: this happens if the reporting task runs before the
    images have been imported. (LP: #213984)
  - Fix internal server error on fast path installer. (LP: #1293676)
  - Fix uploading files using maas-cli. (LP: #1187826)
  - Fix SM15k Invalid Power Control and Fix enlisting machines with
    2.0 api. (LP: #1302818, LP: #1302819)

[ Andres Rodriguez ]
* debian/maas-cluster-controller.install: Install UEFI templates
* debian/maas-cluster-controller.dirs: Create 'boot-resources' dir.

[ Jason Hobbs ]
* debian/extras/99-maas: Allow access to keyserver.ubuntu.com via
  squid-deb-proxy.
 
[Jeroen Vermeulen]
* debian/maas-cluster-controller.postinst:
  - Make the tgt config link point to the new boot-resources dir.
* debian/maas-region-controller-min.dirs:
  - Don't create /var/lib/maas/tftp.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
    age_file,
23
23
    get_write_time,
24
24
    )
25
 
import provisioningserver.boot.install_bootloader
26
25
from provisioningserver.boot.install_bootloader import (
27
26
    install_bootloader,
28
27
    make_destination,
29
28
    )
30
 
from provisioningserver.boot.tftppath import locate_tftp_path
31
 
from provisioningserver.testing.config import set_tftp_root
32
 
from provisioningserver.utils import MainScript
33
29
from testtools.matchers import (
34
30
    DirExists,
35
31
    FileContains,
36
 
    FileExists,
37
32
    )
38
33
 
39
34
 
40
35
class TestInstallBootloader(MAASTestCase):
41
36
 
42
37
    def test_integration(self):
43
 
        tftproot = self.make_dir()
44
 
        config_fixture = self.useFixture(set_tftp_root(tftproot))
45
 
 
46
 
        loader = self.make_file()
47
 
 
48
 
        action = factory.make_name("action")
49
 
        script = MainScript(action)
50
 
        script.register(action, provisioningserver.boot.install_bootloader)
51
 
        script.execute(
52
 
            ("--config-file", config_fixture.filename, action,
53
 
             "--loader", loader))
54
 
 
55
 
        bootloader_filename = os.path.basename(loader)
56
 
        self.assertThat(
57
 
            locate_tftp_path(
58
 
                bootloader_filename, tftproot=tftproot),
59
 
            FileExists())
 
38
        loader_contents = factory.getRandomString()
 
39
        loader = self.make_file(contents=loader_contents)
 
40
        destination = self.make_file()
 
41
        install_bootloader(loader, destination)
 
42
        self.assertThat(destination, FileContains(loader_contents))
60
43
 
61
44
    def test_make_destination_creates_directory_if_not_present(self):
62
45
        tftproot = self.make_dir()