1
0
forked from clan/clan-core

Merge pull request 'remove unused multi machine clan urls' (#1687) from Mic92-main into main

This commit is contained in:
clan-bot 2024-07-02 10:26:14 +00:00
commit 6b70792cae
2 changed files with 4 additions and 19 deletions

View File

@ -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 = (

View File

@ -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"