Ejemplo n.º 1
0
 def test_get_by_pxealias_returns_None_if_none_matching(self):
     arch1 = Architecture(
         name="arch1", description="arch1",
         pxealiases=["archibald", "reginald"])
     arch2 = Architecture(name="arch2", description="arch2")
     ArchitectureRegistry.register_item("arch1", arch1)
     ArchitectureRegistry.register_item("arch2", arch2)
     self.assertEqual(
         None, ArchitectureRegistry.get_by_pxealias("stinkywinky"))
Ejemplo n.º 2
0
 def test_get_by_pxealias_returns_valid_arch(self):
     arch1 = Architecture(
         name="arch1", description="arch1",
         pxealiases=["archibald", "reginald"])
     arch2 = Architecture(
         name="arch2", description="arch2",
         pxealiases=["fake", "foo"])
     ArchitectureRegistry.register_item("arch1", arch1)
     ArchitectureRegistry.register_item("arch2", arch2)
     self.assertEqual(
         arch1, ArchitectureRegistry.get_by_pxealias("archibald"))
Ejemplo n.º 3
0
    def handle_boot_method(self, file_name: TFTPPath, result):
        boot_method, params = result
        if boot_method is None:
            return super().get_reader(file_name)

        # Map pxe namespace architecture names to MAAS's.
        arch = params.get("arch")
        if arch is not None:
            maasarch = ArchitectureRegistry.get_by_pxealias(arch)
            if maasarch is not None:
                params["arch"] = maasarch.name.split("/")[0]

        # Send the local and remote endpoint addresses.
        local_host, local_port = tftp.get_local_address()
        params["local_ip"] = local_host
        remote_host, remote_port = tftp.get_remote_address()
        params["remote_ip"] = remote_host
        d = self.get_boot_method_reader(boot_method, params)
        return d