mirror of
https://github.com/NixOS/nix.git
synced 2025-11-15 06:52:43 +01:00
Add user@address:port support
This patch allows users to specify the connection port
in the store URLS like so:
```
nix store info --store "ssh-ng://localhost:22" --json
```
Previously this failed with: `error: failed to start SSH connection to 'localhost:22'`,
because the code did not distinguish the port from the hostname. This
patch remedies that problem by introducing a ParsedURL::Authority type
for working with parsed authority components of URIs.
Now that the URL parsing code is less ad-hoc we can
add more long-awaited fixes for specifying SSH connection
ports in store URIs.
Builds upon the work from bd1d2d1041.
Co-authored-by: Sergei Zimmerman <sergei@zimmerman.foo>
Co-authored-by: John Ericson <John.Ericson@Obsidian.Systems>
This commit is contained in:
parent
c98af65da6
commit
49ba06175e
18 changed files with 312 additions and 101 deletions
|
|
@ -39,6 +39,14 @@ TEST(machines, getMachinesUriOnly)
|
|||
EXPECT_THAT(actual[0], Field(&Machine::sshPublicHostKey, SizeIs(0)));
|
||||
}
|
||||
|
||||
TEST(machines, getMachinesUriWithPort)
|
||||
{
|
||||
auto actual = Machine::parseConfig({"TEST_ARCH-TEST_OS"}, "nix@scratchy.labs.cs.uu.nl:2222");
|
||||
ASSERT_THAT(actual, SizeIs(1));
|
||||
EXPECT_THAT(
|
||||
actual[0], Field(&Machine::storeUri, Eq(StoreReference::parse("ssh://nix@scratchy.labs.cs.uu.nl:2222"))));
|
||||
}
|
||||
|
||||
TEST(machines, getMachinesDefaults)
|
||||
{
|
||||
auto actual = Machine::parseConfig({"TEST_ARCH-TEST_OS"}, "nix@scratchy.labs.cs.uu.nl - - - - - - -");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue