~blake-rouse/maas/osystem-preseed-prefix

« back to all changes in this revision

Viewing changes to src/provisioningserver/boot/uefi.py

Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
from provisioningserver.boot import (
26
26
    BootMethod,
27
27
    BootMethodInstallError,
 
28
    BytesReader,
28
29
    get_parameters,
29
30
    utils,
30
31
    )
120
121
    bootloader_path = "bootx64.efi"
121
122
    arch_octet = "00:07"  # AMD64 EFI
122
123
 
123
 
    def match_config_path(self, path):
 
124
    def match_path(self, backend, path):
124
125
        """Checks path for the configuration file that needs to be
125
126
        generated.
126
127
 
 
128
        :param backend: requesting backend
127
129
        :param path: requested path
128
130
        :returns: dict of match params from path, None if no match
129
131
        """
139
141
 
140
142
        return params
141
143
 
142
 
    def render_config(self, kernel_params, **extra):
 
144
    def get_reader(self, backend, kernel_params, **extra):
143
145
        """Render a configuration file as a unicode string.
144
146
 
 
147
        :param backend: requesting backend
145
148
        :param kernel_params: An instance of `KernelParameters`.
146
149
        :param extra: Allow for other arguments. This is a safety valve;
147
150
            parameters generated in another component (for example, see
148
 
            `TFTPBackend.get_config_reader`) won't cause this to break.
 
151
            `TFTPBackend.get_boot_method_reader`) won't cause this to break.
149
152
        """
150
153
        template = self.get_template(
151
154
            kernel_params.purpose, kernel_params.arch,
152
155
            kernel_params.subarch)
153
156
        namespace = self.compose_template_namespace(kernel_params)
154
 
        return template.substitute(namespace)
 
157
        return BytesReader(template.substitute(namespace).encode("utf-8"))
155
158
 
156
159
    def install_bootloader(self, destination):
157
160
        """Installs the required files for UEFI booting into the