v0.2.1
Added
-
ConnectionStringparses a connection target from whatever a user typed.
ConnectionString("nas", scheme="wss")andConnectionString("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, thendefaults.
scheme=/port=/host=/… are therefore overrides —scheme="ssh"
beats awss://in the string — whiledefaults(a mapping, or another
ConnectionStringused as a profile) fills only what nothing else
supplied.A port carries its own resolution strategy wherever one is accepted: an
int, a callablescheme -> 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_portresolves
the scheme — it knows schemes no system services database does (ws/wss,
socks5), and an application can register more with
netimps.register_port.Falsestops the search outright: no port, and no lookup.Credentials are parsed but never rendered.
str()andrepr()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 carrykey:valueextras after a newline,
asparse_credentialsdescribes, written raw.The host keeps the spelling it was given.
is_localresolves 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 bynetimps.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.qsland
query_val()read the query;replace()returns a changed copy.
Changed
netimpsis 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 within0.2.xgains
a new requirement, so a locked or offline environment needsnetimps
available before upgrading.
Fixed
- A path in a command is rendered through
__fspath__rather thanstr().
Every transport now shares onecommand_texthelper — the SSH, WinRM,
container, QGA, and PSRP executors each stringified withstr(), so only
the local executor asked for the filesystem representation.__fspath__is
tried by attribute rather than byisinstance(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