Skip to content

v0.2.1

Choose a tag to compare

@github-actions github-actions released this 29 Jul 03:53

Added

  • ConnectionString parses a connection target from whatever a user typed.
    ConnectionString("nas", scheme="wss") and ConnectionString("nas:8443", ...) parse, because a bare host is not an invalid URI — it is a URI with
    the scheme left off, which is what people type on a command line.

    Every field can be supplied directly, and three layers decide each one: an
    explicit argument wins, then whatever the string carried, then defaults.
    scheme=/port=/host=/… are therefore overridesscheme="ssh"
    beats a wss:// in the string — while defaults (a mapping, or another
    ConnectionString used as a profile) fills only what nothing else
    supplied.

    A port carries its own resolution strategy wherever one is accepted: an
    int, a callable scheme -> port | None, or anything indexable by scheme
    (a plain mapping), so a caller passes its whole table without pre-selecting
    an entry. When no layer supplies one, netimps.get_default_port resolves
    the scheme — it knows schemes no system services database does (ws/wss,
    socks5), and an application can register more with
    netimps.register_port.

    False stops the search outright: no port, and no lookup.

    Credentials are parsed but never rendered. str() and repr() both emit
    the redacted form, with the password removed rather than masked, so the
    output stays a valid, reusable connection string that cannot round-trip a
    wrong credential — and a value reaching a log line or a traceback frame
    cannot leak one. A password may carry key:value extras after a newline,
    as parse_credentials describes, written raw.

    The host keeps the spelling it was given. is_local resolves nothing — it
    is called while a configuration is built, which is network-free, and
    resolving would both block and raise on a name that does not resolve. An
    address literal is answered by netimps.is_local_address, so an address
    actually assigned to this machine counts as local and not just loopback,
    while a name is compared against the loopback spellings. qsl and
    query_val() read the query; replace() returns a changed copy.

Changed

  • netimps is now a required dependency, supplying scheme/port and
    address semantics rather than hostctl reimplementing them. Note this
    arrives in a patch release: an existing install pinned within 0.2.x gains
    a new requirement, so a locked or offline environment needs netimps
    available before upgrading.

Fixed

  • A path in a command is rendered through __fspath__ rather than str().
    Every transport now shares one command_text helper — the SSH, WinRM,
    container, QGA, and PSRP executors each stringified with str(), so only
    the local executor asked for the filesystem representation. __fspath__ is
    tried by attribute rather than by isinstance(value, os.PathLike), so a
    duck-typed path that never registered with the ABC is honoured too, and an
    object whose __fspath__ raises or returns a non-string falls back to
    str() rather than failing the command. The shell layer follows the same
    rule. No shipped path type changes behaviour — str() and __fspath__
    agree for all of them — but the contract now matches what a path promises.

Full Changelog: v0.2.0...v0.2.1