From e637394370cce12142f7b20e0b9ef5afc075d55d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Tue, 2 Jul 2024 12:10:34 +0200 Subject: [PATCH] remove unused multi machine clan urls --- pkgs/clan-cli/clan_cli/clan_uri.py | 16 ++++------------ pkgs/clan-cli/tests/test_clan_uri.py | 7 ------- 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/pkgs/clan-cli/clan_cli/clan_uri.py b/pkgs/clan-cli/clan_cli/clan_uri.py index 876772cb..5b28c661 100644 --- a/pkgs/clan-cli/clan_cli/clan_uri.py +++ b/pkgs/clan-cli/clan_cli/clan_uri.py @@ -77,19 +77,11 @@ class ClanURI: # Parse the URL into a ClanUrl object self.flake_id = self._parse_url(clean_comps) - # Parse the fragment into a list of machine queries - # Then parse every machine query into a MachineParameters object - machine_frags = list( - filter(lambda x: len(x) > 0, self._components.fragment.split("#")) - ) - for machine_frag in machine_frags: - machine = self._parse_machine_query(machine_frag) - self._machines.append(machine) + if self._components.fragment == "": + self._machines.append(MachineData(flake_id=self.flake_id)) + return - # If there are no machine fragments, add a default machine - if len(machine_frags) == 0: - default_machine = MachineData(flake_id=self.flake_id) - self._machines.append(default_machine) + self._machines.append(self._parse_machine_query(self._components.fragment)) def _parse_url(self, comps: urllib.parse.ParseResult) -> FlakeId: comb = ( diff --git a/pkgs/clan-cli/tests/test_clan_uri.py b/pkgs/clan-cli/tests/test_clan_uri.py index 63196fd7..891d022d 100644 --- a/pkgs/clan-cli/tests/test_clan_uri.py +++ b/pkgs/clan-cli/tests/test_clan_uri.py @@ -50,13 +50,6 @@ def test_remote_with_clanparams() -> None: assert uri.flake_id.url == "https://example.com" -def test_remote_with_all_params() -> None: - uri = ClanURI("clan://https://example.com?password=12345#myVM#secondVM") - assert uri.machine.name == "myVM" - assert uri._machines[1].name == "secondVM" - assert uri.flake_id.url == "https://example.com?password=12345" - - def test_from_str_remote() -> None: uri = ClanURI.from_str(url="https://example.com", machine_name="myVM") assert uri.get_url() == "https://example.com"