bsdci / libioc

A Python library to manage jails with ioc{age,ell}
https://bsd.ci/libioc
Other
38 stars 11 forks source link

Network's __create_new_epair_interface function parameter nic_suffix_b is ignored #766

Open igalic opened 3 years ago

igalic commented 3 years ago

the following code snippet from the Network class :

    def __create_new_epair_interface(
        self,
        nic_suffix_a: str=":a",
        nic_suffix_b: str=":b",
        mac_addresses: typing.Optional[libioc.MacAddress.MacAddressPair]=None,
        **nic_args: typing.Any
    ) -> typing.Tuple[
        libioc.NetworkInterface.NetworkInterface,
        libioc.NetworkInterface.NetworkInterface
    ]:

       … 

        nic_a = libioc.NetworkInterface.NetworkInterface(
            name="epair",
            create=True,
            logger=self.logger
        )
        nic_b_name = nic_a.name[:-1] + "b" # ⬅️

is later called as

nic_a, nic_b = self.__create_new_epair_interface(
            nic_suffix_a="",
            nic_suffix_b=":j",
            mac_addresses=mac_address_pair,
            mtu=self.mtu,
            description=self.nic_local_description,
        )

which won't do what we tell it to do