lib.ExecApp, ec.Local: Don't use keyword "local" as URI
ExecApp's --target parameter and the ec.Local.__init__()'s uri argument carry "local" as their default value which was meant as a keyword but doesn't pass as an URI. Fix that. Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v1.5.0 Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
ec142057bf
commit
e558efb4cc
4 changed files with 9 additions and 5 deletions
|
|
@ -46,7 +46,7 @@ class ExecApp(Base): # export
|
|||
help = "Be verbose on stderr about what's being done on the distro level",
|
||||
)
|
||||
parser.add_argument(
|
||||
'--target', default = 'local', help = 'Run commands on this host'
|
||||
'--target', default = 'local://', help = 'Run commands on this host'
|
||||
)
|
||||
parser.add_argument(
|
||||
'--path-filter',
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ if TYPE_CHECKING:
|
|||
|
||||
class Local(Base):
|
||||
|
||||
def __init__(self, uri: str | Uri = 'local', *args: Any, **kwargs: Any) -> None:
|
||||
def __init__(self, uri: str | Uri = 'local://', *args: Any, **kwargs: Any) -> None:
|
||||
super().__init__(uri, *args, **kwargs)
|
||||
|
||||
@cache
|
||||
|
|
|
|||
|
|
@ -9,10 +9,10 @@ import tempfile
|
|||
|
||||
from typing import TYPE_CHECKING, override
|
||||
|
||||
from jw.pkg.cmds.secrets.lib.FilesContext import FilesContext
|
||||
from jw.pkg.cmds.secrets.lib.base import Attrs
|
||||
from jw.pkg.lib.PathFilter import Verdict
|
||||
from jw.pkg.cmds.secrets.lib.FilesContext import FilesContext
|
||||
from jw.pkg.lib.ec.Local import Local
|
||||
from jw.pkg.lib.PathFilter import Verdict
|
||||
|
||||
if TYPE_CHECKING:
|
||||
import os
|
||||
|
|
|
|||
|
|
@ -52,9 +52,13 @@ opts = [o for a in app.parser._actions for o in getattr(a, 'option_strings', ())
|
|||
for opt in ('--interactive', '--verbose', '--target'):
|
||||
assert opt in opts, f'{opt} must be registered by ExecApp'
|
||||
|
||||
# -- The default target is a conforming URI: a bare keyword would
|
||||
# be parsed as a file path, and a downstream URI round-trip
|
||||
# would misread it as a hostname
|
||||
assert app.parser.get_default('target') == 'local://'
|
||||
|
||||
# -- Exiting the async context must close the app, through the
|
||||
# App.__aexit__() that ExecApp.__aexit__() chains to.
|
||||
|
||||
async def exit_context() -> None:
|
||||
async with app:
|
||||
pass
|
||||
|
|
|
|||
Loading…
Reference in a new issue