publisher, deployer: neutral defaults in the packaged copies
build / build (push) Canceled after 2m34s
build / build (push) Canceled after 2m34s
Default host is localhost, user is "user", paths are under /home/user; the publisher apps_dir no longer points at a personal Tomcat. Tests of the copies follow. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -18,12 +18,12 @@ class ConfigError(ValueError):
|
||||
|
||||
@dataclass
|
||||
class Server:
|
||||
host: str = "192.168.88.60"
|
||||
user: str = "das"
|
||||
host: str = "localhost"
|
||||
user: str = "user"
|
||||
port: int = 22
|
||||
app_root: str = "/home/das/app"
|
||||
configs_root: str = "/home/das/app/configs"
|
||||
state_dir: str = "/home/das/app_deploy"
|
||||
app_root: str = "/home/user/app"
|
||||
configs_root: str = "/home/user/app/configs"
|
||||
state_dir: str = "/home/user/app_deploy"
|
||||
keep: int = 5
|
||||
local_roots: list[str] = field(default_factory=lambda: ["~/Dev/Projects"])
|
||||
# Development-only files: not synced for python/docker/files apps (an app can sync them via its own rules)
|
||||
@@ -53,7 +53,7 @@ class App:
|
||||
# python-*
|
||||
unit: str = ""
|
||||
entry: str = "main.py"
|
||||
user: str = "das"
|
||||
user: str = "user"
|
||||
description: str = ""
|
||||
env_file: str = ""
|
||||
syslog_id: str = ""
|
||||
|
||||
@@ -149,7 +149,7 @@ def import_server(cfg: Config, log=print) -> list[Imported]:
|
||||
if f[0] == "P" and len(f) == 9:
|
||||
_, d, unit, desc, user, sid, envf, entry, links = f
|
||||
app = App(name=d, kind="python-update", src="", dest=f"python/{d}", unit=unit, entry=entry or "main.py",
|
||||
user=user or "das", description=desc, syslog_id="" if sid == unit else sid, env_file=envf,
|
||||
user=user or "user", description=desc, syslog_id="" if sid == unit else sid, env_file=envf,
|
||||
configs=[x for x in links.split(",") if x])
|
||||
local = match_local(projects, [d, sid], unit)
|
||||
elif f[0] == "D" and len(f) == 2:
|
||||
|
||||
@@ -36,7 +36,7 @@ dest = "~/scripts"
|
||||
"""))
|
||||
assert [a.name for a in cfg.apps] == ["a", "b"]
|
||||
assert cfg.dest_path(cfg.app("a")) == "/srv/app/python/a"
|
||||
assert cfg.dest_path(cfg.app("b")) == "/home/das/scripts"
|
||||
assert cfg.dest_path(cfg.app("b")) == "/home/user/scripts"
|
||||
assert cfg.app("a").src_path == Path.home() / "x"
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ def test_rsync_cmd_options():
|
||||
cmd = remote.rsync_cmd(s, "src/", "/d/", filters=["- x"], delete=True, dry_run=True, extra=["--chmod=F640"])
|
||||
assert cmd[0] == "rsync" and "-n" in cmd and "--delete" in cmd and "-c" in cmd
|
||||
assert cmd.index("--chmod=F640") < cmd.index("--filter=- x")
|
||||
assert cmd[-2:] == ["src/", "das@192.168.88.60:/d/"]
|
||||
assert cmd[-2:] == ["src/", "user@localhost:/d/"]
|
||||
|
||||
|
||||
def test_parse_itemize():
|
||||
@@ -164,14 +164,14 @@ def test_python_config_layout(tmp_path):
|
||||
(tmp_path / "configs").mkdir()
|
||||
cfg = config.Config(tmp_path / "x.toml", config.Server(), [])
|
||||
plan = type("P", (), {})()
|
||||
plan.cfg, plan.dest = cfg, "/home/das/app/python/App"
|
||||
plan.cfg, plan.dest = cfg, "/home/user/app/python/App"
|
||||
plan.app = config.App(name="App", kind="python-update", src=str(tmp_path), dest="python/App", unit="u",
|
||||
configs=["configs"])
|
||||
k = get("python-update")
|
||||
assert k.config_items(plan) == [("configs", "/home/das/app/configs/python/App")]
|
||||
assert k.config_items(plan) == [("configs", "/home/user/app/configs/python/App")]
|
||||
plan.app.configs = [".env", "secrets.yaml"]
|
||||
assert k.config_items(plan) == [(".env", "/home/das/app/configs/python/App/app.env"),
|
||||
("secrets.yaml", "/home/das/app/configs/python/App/secrets.yaml")]
|
||||
plan.dest = "/home/das/app/docker/stack"
|
||||
assert k.config_items(plan) == [(".env", "/home/user/app/configs/python/App/app.env"),
|
||||
("secrets.yaml", "/home/user/app/configs/python/App/secrets.yaml")]
|
||||
plan.dest = "/home/user/app/docker/stack"
|
||||
plan.app = config.App(name="stack", kind="docker", src=str(tmp_path), dest="docker/stack")
|
||||
assert get("docker").config_items(plan) == [(".env", "/home/das/app/configs/docker/stack.env")]
|
||||
assert get("docker").config_items(plan) == [(".env", "/home/user/app/configs/docker/stack.env")]
|
||||
|
||||
Reference in New Issue
Block a user