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:
commit
6b70792cae
|
@ -77,19 +77,11 @@ class ClanURI:
|
||||||
# Parse the URL into a ClanUrl object
|
# Parse the URL into a ClanUrl object
|
||||||
self.flake_id = self._parse_url(clean_comps)
|
self.flake_id = self._parse_url(clean_comps)
|
||||||
|
|
||||||
# Parse the fragment into a list of machine queries
|
if self._components.fragment == "":
|
||||||
# Then parse every machine query into a MachineParameters object
|
self._machines.append(MachineData(flake_id=self.flake_id))
|
||||||
machine_frags = list(
|
return
|
||||||
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 there are no machine fragments, add a default machine
|
self._machines.append(self._parse_machine_query(self._components.fragment))
|
||||||
if len(machine_frags) == 0:
|
|
||||||
default_machine = MachineData(flake_id=self.flake_id)
|
|
||||||
self._machines.append(default_machine)
|
|
||||||
|
|
||||||
def _parse_url(self, comps: urllib.parse.ParseResult) -> FlakeId:
|
def _parse_url(self, comps: urllib.parse.ParseResult) -> FlakeId:
|
||||||
comb = (
|
comb = (
|
||||||
|
|
|
@ -50,13 +50,6 @@ def test_remote_with_clanparams() -> None:
|
||||||
assert uri.flake_id.url == "https://example.com"
|
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:
|
def test_from_str_remote() -> None:
|
||||||
uri = ClanURI.from_str(url="https://example.com", machine_name="myVM")
|
uri = ClanURI.from_str(url="https://example.com", machine_name="myVM")
|
||||||
assert uri.get_url() == "https://example.com"
|
assert uri.get_url() == "https://example.com"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user