portacode 1.4.18.dev0__py3-none-any.whl → 1.4.18.dev1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
portacode/_version.py CHANGED
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
28
28
  commit_id: COMMIT_ID
29
29
  __commit_id__: COMMIT_ID
30
30
 
31
- __version__ = version = '1.4.18.dev0'
32
- __version_tuple__ = version_tuple = (1, 4, 18, 'dev0')
31
+ __version__ = version = '1.4.18.dev1'
32
+ __version_tuple__ = version_tuple = (1, 4, 18, 'dev1')
33
33
 
34
34
  __commit_id__ = commit_id = None
@@ -1179,7 +1179,7 @@ def _build_bootstrap_steps(
1179
1179
  steps.append(
1180
1180
  {
1181
1181
  "name": "add_ssh_key",
1182
- "cmd": f"install -d -m 700 /home/{user}/.ssh && echo '{ssh_key}' >> /home/{user}/.ssh/authorized_keys && chown -R {user}:{user} /home/{user}/.ssh",
1182
+ "cmd": f"install -d -m 700 /home/{user}/.ssh && echo '{ssh_key}' >> /home/{user}/.ssh/authorized_keys && chown -R {user}:$(id -gn {shlex.quote(user)}) /home/{user}/.ssh",
1183
1183
  "retries": 0,
1184
1184
  }
1185
1185
  )
@@ -1444,6 +1444,14 @@ def _su_command(user: str, command: str) -> str:
1444
1444
  return f"su - {user} -s /bin/sh -c {shlex.quote(command)}"
1445
1445
 
1446
1446
 
1447
+ def _resolve_user_group(vmid: int, user: str) -> str:
1448
+ res = _run_pct(vmid, f"id -gn {shlex.quote(user)}")
1449
+ group = (res.get("stdout") or "").strip()
1450
+ if group:
1451
+ return f"{user}:{group}"
1452
+ return f"{user}:{user}"
1453
+
1454
+
1447
1455
  def _resolve_portacode_cli_path(vmid: int, user: str) -> str:
1448
1456
  """Resolve the full path to the portacode CLI inside the container."""
1449
1457
  res = _run_pct(vmid, _su_command(user, "command -v portacode"))
@@ -1480,12 +1488,13 @@ def _push_bytes_to_container(
1480
1488
  ) -> None:
1481
1489
  logger.debug("Preparing to push %d bytes to container vmid=%s path=%s for user=%s", len(data), vmid, path, user)
1482
1490
  tmp_path: Optional[str] = None
1491
+ owner = _resolve_user_group(vmid, user)
1483
1492
  try:
1484
1493
  parent = Path(path).parent
1485
1494
  parent_str = parent.as_posix()
1486
1495
  if parent_str not in {"", ".", "/"}:
1487
1496
  _run_pct_exec_check(vmid, ["mkdir", "-p", parent_str])
1488
- _run_pct_exec_check(vmid, ["chown", "-R", f"{user}:{user}", parent_str])
1497
+ _run_pct_exec_check(vmid, ["chown", "-R", owner, parent_str])
1489
1498
 
1490
1499
  with tempfile.NamedTemporaryFile(delete=False) as tmp:
1491
1500
  tmp.write(data)
@@ -1497,7 +1506,7 @@ def _push_bytes_to_container(
1497
1506
  if push_res.returncode != 0:
1498
1507
  raise RuntimeError(push_res.stderr or push_res.stdout or f"pct push returned {push_res.returncode}")
1499
1508
 
1500
- _run_pct_exec_check(vmid, ["chown", f"{user}:{user}", path])
1509
+ _run_pct_exec_check(vmid, ["chown", owner, path])
1501
1510
  _run_pct_exec_check(vmid, ["chmod", format(mode, "o"), path])
1502
1511
  logger.debug("Successfully pushed %d bytes to vmid=%s path=%s", len(data), vmid, path)
1503
1512
  except Exception as exc:
@@ -1516,7 +1525,8 @@ def _resolve_portacode_key_dir(vmid: int, user: str) -> str:
1516
1525
  data_home = _run_pct_check(vmid, data_dir_cmd)["stdout"].strip()
1517
1526
  portacode_dir = f"{data_home}/portacode"
1518
1527
  _run_pct_exec_check(vmid, ["mkdir", "-p", portacode_dir])
1519
- _run_pct_exec_check(vmid, ["chown", "-R", f"{user}:{user}", portacode_dir])
1528
+ owner = _resolve_user_group(vmid, user)
1529
+ _run_pct_exec_check(vmid, ["chown", "-R", owner, portacode_dir])
1520
1530
  return f"{portacode_dir}/keys"
1521
1531
 
1522
1532
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: portacode
3
- Version: 1.4.18.dev0
3
+ Version: 1.4.18.dev1
4
4
  Summary: Portacode CLI client and SDK
5
5
  Home-page: https://github.com/portacode/portacode
6
6
  Author: Meena Erian
@@ -1,7 +1,7 @@
1
1
  portacode/README.md,sha256=4dKtpvR8LNgZPVz37GmkQCMWIr_u25Ao63iW56s7Ke4,775
2
2
  portacode/__init__.py,sha256=oB3sV1wXr-um-RXio73UG8E5Xx6cF2ZVJveqjNmC-vQ,1086
3
3
  portacode/__main__.py,sha256=jmHTGC1hzmo9iKJLv-SSYe9BSIbPPZ2IOpecI03PlTs,296
4
- portacode/_version.py,sha256=yA2sKupgNCrFCGL5pCY3CIzvzrKLzwboOhvQKU_KGWI,719
4
+ portacode/_version.py,sha256=5dOvBCvz5Pakc6MOjfghJssGskaXc70INnpW2F-9DbA,719
5
5
  portacode/cli.py,sha256=mGLKoZ-T2FBF7IA9wUq0zyG0X9__-A1ao7gajjcVRH8,21828
6
6
  portacode/data.py,sha256=5-s291bv8J354myaHm1Y7CQZTZyRzMU3TGe5U4hb-FA,1591
7
7
  portacode/keypair.py,sha256=0OO4vHDcF1XMxCDqce61xFTlFwlTcmqe5HyGsXFEt7s,5838
@@ -22,7 +22,7 @@ portacode/connection/handlers/diff_handlers.py,sha256=iYTIRCcpEQ03vIPKZCsMTE5aZb
22
22
  portacode/connection/handlers/file_handlers.py,sha256=nAJH8nXnX07xxD28ngLpgIUzcTuRwZBNpEGEKdRqohw,39507
23
23
  portacode/connection/handlers/project_aware_file_handlers.py,sha256=AqgMnDqX2893T2NsrvUSCwjN5VKj4Pb2TN0S_SuboOE,9803
24
24
  portacode/connection/handlers/project_state_handlers.py,sha256=v6ZefGW9i7n1aZLq2jOGumJIjYb6aHlPI4m1jkYewm8,1686
25
- portacode/connection/handlers/proxmox_infra.py,sha256=EzxN6czFMcvIcOVmNFyBoSQoFfg1GN0aWxdSnN7NVfk,99532
25
+ portacode/connection/handlers/proxmox_infra.py,sha256=dP0ldWSC7khwjlHGa-Ujmlp9ZCYbAt6QuE5j16IuGTY,99843
26
26
  portacode/connection/handlers/registry.py,sha256=qXGE60sYEWg6ZtVQzFcZ5YI2XWR6lMgw4hAL9x5qR1I,6181
27
27
  portacode/connection/handlers/session.py,sha256=uNGfiO_1B9-_yjJKkpvmbiJhIl6b-UXlT86UTfd6WYE,42219
28
28
  portacode/connection/handlers/system_handlers.py,sha256=fr12QpOr_Z8KYGUU-AYrTQwRPAcrLK85hvj3SEq1Kw8,14757
@@ -65,7 +65,7 @@ portacode/utils/__init__.py,sha256=NgBlWTuNJESfIYJzP_3adI1yJQJR0XJLRpSdVNaBAN0,3
65
65
  portacode/utils/diff_apply.py,sha256=4Oi7ft3VUCKmiUE4VM-OeqO7Gk6H7PF3WnN4WHXtjxI,15157
66
66
  portacode/utils/diff_renderer.py,sha256=S76StnQ2DLfsz4Gg0m07UwPfRp8270PuzbNaQq-rmYk,13850
67
67
  portacode/utils/ntp_clock.py,sha256=VqCnWCTehCufE43W23oB-WUdAZGeCcLxkmIOPwInYHc,2499
68
- portacode-1.4.18.dev0.dist-info/licenses/LICENSE,sha256=2FGbCnUDgRYuQTkB1O1dUUpu5CVAjK1j4_p6ack9Z54,1066
68
+ portacode-1.4.18.dev1.dist-info/licenses/LICENSE,sha256=2FGbCnUDgRYuQTkB1O1dUUpu5CVAjK1j4_p6ack9Z54,1066
69
69
  test_modules/README.md,sha256=Do_agkm9WhSzueXjRAkV_xEj6Emy5zB3N3VKY5Roce8,9274
70
70
  test_modules/__init__.py,sha256=1LcbHodIHsB0g-g4NGjSn6AMuCoGbymvXPYLOb6Z7F0,53
71
71
  test_modules/test_device_online.py,sha256=QtYq0Dq9vME8Gp2O4fGSheqVf8LUtpsSKosXXk56gGM,1654
@@ -91,8 +91,8 @@ testing_framework/core/playwright_manager.py,sha256=Tw46qwxIhOFkS48C2IWIQHHNpEe-
91
91
  testing_framework/core/runner.py,sha256=j2QwNJmAxVBmJvcbVS7DgPJUKPNzqfLmt_4NNdaKmZU,19297
92
92
  testing_framework/core/shared_cli_manager.py,sha256=BESSNtyQb7BOlaOvZmm04T8Uezjms4KCBs2MzTxvzYQ,8790
93
93
  testing_framework/core/test_discovery.py,sha256=2FZ9fJ8Dp5dloA-fkgXoJ_gCMC_nYPBnA3Hs2xlagzM,4928
94
- portacode-1.4.18.dev0.dist-info/METADATA,sha256=wRHmdC2IMhBneJ0RTBUzCwCdzh1Xvda78wK1LlvV14E,13051
95
- portacode-1.4.18.dev0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
96
- portacode-1.4.18.dev0.dist-info/entry_points.txt,sha256=lLUUL-BM6_wwe44Xv0__5NQ1BnAz6jWjSMFvZdWW3zU,48
97
- portacode-1.4.18.dev0.dist-info/top_level.txt,sha256=TGhTYUxfW8SyVZc_zGgzjzc24gGT7nSw8Qf73liVRKM,41
98
- portacode-1.4.18.dev0.dist-info/RECORD,,
94
+ portacode-1.4.18.dev1.dist-info/METADATA,sha256=ubjouOQTc91PCVLmKmJJKm3KPOqVe5jI_oAlARVTrqc,13051
95
+ portacode-1.4.18.dev1.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
96
+ portacode-1.4.18.dev1.dist-info/entry_points.txt,sha256=lLUUL-BM6_wwe44Xv0__5NQ1BnAz6jWjSMFvZdWW3zU,48
97
+ portacode-1.4.18.dev1.dist-info/top_level.txt,sha256=TGhTYUxfW8SyVZc_zGgzjzc24gGT7nSw8Qf73liVRKM,41
98
+ portacode-1.4.18.dev1.dist-info/RECORD,,