vortex-cli 8.4.1__tar.gz → 8.4.2__tar.gz
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.
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/PKG-INFO +6 -1
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/README.md +5 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/pyproject.toml +1 -1
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex/models.py +53 -2
- vortex_cli-8.4.2/vortex/session_store.py +67 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex/workspace.py +4 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex_cli.egg-info/PKG-INFO +6 -1
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex_cli.egg-info/SOURCES.txt +1 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/LICENSE +0 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/setup.cfg +0 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex/__init__.py +0 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex/__main__.py +0 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex/cli.py +0 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex/colour.py +0 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex/commands/__init__.py +0 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex/commands/agenda.py +0 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex/commands/app.py +0 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex/commands/clean.py +0 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex/commands/clone.py +0 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex/commands/code.py +0 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex/commands/compile.py +0 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex/commands/db.py +0 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex/commands/diff.py +0 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex/commands/docs.py +0 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex/commands/execute.py +0 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex/commands/fetch.py +0 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex/commands/file.py +0 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex/commands/info.py +0 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex/commands/keyword.py +0 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex/commands/libs.py +0 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex/commands/log.py +0 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex/commands/object_.py +0 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex/commands/pull.py +0 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex/commands/search.py +0 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex/commands/servers.py +0 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex/commands/stats.py +0 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex/commands/use.py +0 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex/commands/watch.py +0 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex/commands/weblog.py +0 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex/constants.py +0 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex/docs/Blackbook v2.md +0 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex/docs/Blackbook.pdf +0 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex/docs/index.html +0 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex/docs/marked.min.js +0 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex/git.py +0 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex/lib/puakma-6.0.40.jar +0 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex/libs.py +0 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex/logging.py +0 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex/main.py +0 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex/output.py +0 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex/registry.py +0 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex/schedule.py +0 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex/server_options.py +0 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex/soap.py +0 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex/spinner.py +0 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex/sync.py +0 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex/util.py +0 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex/webdesign.py +0 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex_cli.egg-info/dependency_links.txt +0 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex_cli.egg-info/entry_points.txt +0 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex_cli.egg-info/requires.txt +0 -0
- {vortex_cli-8.4.1 → vortex_cli-8.4.2}/vortex_cli.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: vortex_cli
|
|
3
|
-
Version: 8.4.
|
|
3
|
+
Version: 8.4.2
|
|
4
4
|
Summary: Vortex CLI
|
|
5
5
|
Author-email: Jordan Amos <jordan.amos@gmail.com>
|
|
6
6
|
License: MIT License
|
|
@@ -116,6 +116,11 @@ While it is possible to use without it, this software has been purposefully desi
|
|
|
116
116
|
- **8.4.1: `vortex clone` ignores case in a TemplateName or `group/name`.** `vortex clone
|
|
117
117
|
ui20complete/mastercustom` clones `ui20Complete/MasterCustom`; the name must still match in
|
|
118
118
|
full. If two applications differ only in case, the one typed exactly wins.
|
|
119
|
+
- **8.4.2: vortex reuses one server session.** Every command used to start a new Puakma
|
|
120
|
+
session, and parallel requests each started their own, leaving thousands of idle sessions
|
|
121
|
+
on the server until SessionTimeout. Session cookies are now kept per server in
|
|
122
|
+
`config/.sessions/` (owner-only; treat them like a login) and parallel requests share one
|
|
123
|
+
session. Delete the file to start a new session.
|
|
119
124
|
|
|
120
125
|
## Upgrading to 8.3
|
|
121
126
|
|
|
@@ -72,6 +72,11 @@ While it is possible to use without it, this software has been purposefully desi
|
|
|
72
72
|
- **8.4.1: `vortex clone` ignores case in a TemplateName or `group/name`.** `vortex clone
|
|
73
73
|
ui20complete/mastercustom` clones `ui20Complete/MasterCustom`; the name must still match in
|
|
74
74
|
full. If two applications differ only in case, the one typed exactly wins.
|
|
75
|
+
- **8.4.2: vortex reuses one server session.** Every command used to start a new Puakma
|
|
76
|
+
session, and parallel requests each started their own, leaving thousands of idle sessions
|
|
77
|
+
on the server until SessionTimeout. Session cookies are now kept per server in
|
|
78
|
+
`config/.sessions/` (owner-only; treat them like a login) and parallel requests share one
|
|
79
|
+
session. Delete the file to start a new session.
|
|
75
80
|
|
|
76
81
|
## Upgrading to 8.3
|
|
77
82
|
|
|
@@ -21,6 +21,7 @@ from typing import NamedTuple
|
|
|
21
21
|
|
|
22
22
|
import httpx
|
|
23
23
|
|
|
24
|
+
from vortex.session_store import SessionStore
|
|
24
25
|
from vortex.soap import ServerDesigner
|
|
25
26
|
|
|
26
27
|
if TYPE_CHECKING:
|
|
@@ -253,6 +254,12 @@ class PuakmaServer:
|
|
|
253
254
|
self._sync_client: httpx.Client | None = None
|
|
254
255
|
self._async_client: httpx.AsyncClient | None = None
|
|
255
256
|
self.server_designer = ServerDesigner(self)
|
|
257
|
+
# Set by Workspace: where this server's session cookies are kept
|
|
258
|
+
# between runs. Puakma creates a session for every request that
|
|
259
|
+
# arrives without one and keeps it for SessionTimeout (prod: 30
|
|
260
|
+
# days), so a fresh session per command - or per parallel request -
|
|
261
|
+
# piles up tens of thousands of idle sessions on the server
|
|
262
|
+
self.session_store: SessionStore | None = None
|
|
256
263
|
|
|
257
264
|
@property
|
|
258
265
|
def host(self) -> str:
|
|
@@ -333,15 +340,59 @@ class PuakmaServer:
|
|
|
333
340
|
@property
|
|
334
341
|
def _client(self) -> httpx.Client:
|
|
335
342
|
if self._sync_client is None:
|
|
336
|
-
|
|
343
|
+
cookies = (
|
|
344
|
+
self.session_store.load(self.username) if self.session_store else None
|
|
345
|
+
)
|
|
346
|
+
self._sync_client = httpx.Client(
|
|
347
|
+
auth=self.auth,
|
|
348
|
+
cookies=cookies,
|
|
349
|
+
event_hooks={"response": [self._save_session]},
|
|
350
|
+
)
|
|
337
351
|
return self._sync_client
|
|
338
352
|
|
|
339
353
|
@property
|
|
340
354
|
def _aclient(self) -> httpx.AsyncClient:
|
|
341
355
|
if self._async_client is None:
|
|
342
|
-
|
|
356
|
+
# Requests sent in parallel before the server has issued a
|
|
357
|
+
# session cookie each get a session of their own. Get one first
|
|
358
|
+
# on the sync client, so the async client starts with it
|
|
359
|
+
self._prime_session()
|
|
360
|
+
self._async_client = httpx.AsyncClient(
|
|
361
|
+
auth=self.auth,
|
|
362
|
+
cookies=self._client.cookies,
|
|
363
|
+
event_hooks={"response": [self._asave_session]},
|
|
364
|
+
)
|
|
343
365
|
return self._async_client
|
|
344
366
|
|
|
367
|
+
def _prime_session(self) -> None:
|
|
368
|
+
if self._client.cookies.get(SessionStore.SESSION_COOKIE) is not None:
|
|
369
|
+
return
|
|
370
|
+
if not self.gateway_path:
|
|
371
|
+
# webdesign has no cheap endpoint to ask for one
|
|
372
|
+
return
|
|
373
|
+
url = f"{self.base_gateway_url}/api/whoami"
|
|
374
|
+
try:
|
|
375
|
+
self._client.get(url, timeout=10)
|
|
376
|
+
except httpx.HTTPError as e:
|
|
377
|
+
# Not fatal: the real requests report their own errors
|
|
378
|
+
logger.debug(f"Unable to get a session before parallel requests: {e}")
|
|
379
|
+
|
|
380
|
+
def _save_session(self, response: httpx.Response) -> None:
|
|
381
|
+
if self.session_store is None or "set-cookie" not in response.headers:
|
|
382
|
+
return
|
|
383
|
+
client = self._sync_client
|
|
384
|
+
if client is not None:
|
|
385
|
+
client.cookies.extract_cookies(response)
|
|
386
|
+
self.session_store.save(self.username, client.cookies)
|
|
387
|
+
|
|
388
|
+
async def _asave_session(self, response: httpx.Response) -> None:
|
|
389
|
+
if self.session_store is None or "set-cookie" not in response.headers:
|
|
390
|
+
return
|
|
391
|
+
client = self._async_client
|
|
392
|
+
if client is not None:
|
|
393
|
+
client.cookies.extract_cookies(response)
|
|
394
|
+
self.session_store.save(self.username, client.cookies)
|
|
395
|
+
|
|
345
396
|
@property
|
|
346
397
|
def base_soap_url(self) -> str:
|
|
347
398
|
return f"{self}/{self.soap_path}"
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"""
|
|
2
|
+
The server's session cookies, kept between vortex runs.
|
|
3
|
+
|
|
4
|
+
Puakma gives every request that arrives without a session cookie a new
|
|
5
|
+
session, and keeps a logged-in session until it has been idle for the
|
|
6
|
+
server's SessionTimeout - 30 days on some servers. Every vortex command
|
|
7
|
+
used to start without cookies, and parallel requests (clone, fetch, weblog
|
|
8
|
+
--all...) each started their own, so a busy agent left tens of thousands
|
|
9
|
+
of idle 'Vortex Agent' sessions in the server's session list.
|
|
10
|
+
|
|
11
|
+
The cookies are written per server and per user, readable only by the
|
|
12
|
+
owner: the session cookie and LtpaToken are as good as a login until the
|
|
13
|
+
session expires.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
|
|
18
|
+
import json
|
|
19
|
+
import logging
|
|
20
|
+
import os
|
|
21
|
+
from pathlib import Path
|
|
22
|
+
|
|
23
|
+
import httpx
|
|
24
|
+
|
|
25
|
+
logger = logging.getLogger("vortex")
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class SessionStore:
|
|
29
|
+
SESSION_COOKIE = "_pma_sess_id"
|
|
30
|
+
|
|
31
|
+
def __init__(self, path: Path) -> None:
|
|
32
|
+
self.path = path
|
|
33
|
+
|
|
34
|
+
def load(self, username: str) -> httpx.Cookies | None:
|
|
35
|
+
try:
|
|
36
|
+
data = json.loads(self.path.read_text())
|
|
37
|
+
except (OSError, ValueError):
|
|
38
|
+
return None
|
|
39
|
+
if not isinstance(data, dict) or data.get("username") != username:
|
|
40
|
+
return None
|
|
41
|
+
cookies = httpx.Cookies()
|
|
42
|
+
for c in data.get("cookies", []):
|
|
43
|
+
try:
|
|
44
|
+
cookies.set(c["name"], c["value"], domain=c["domain"], path=c["path"])
|
|
45
|
+
except (KeyError, TypeError):
|
|
46
|
+
continue
|
|
47
|
+
return cookies
|
|
48
|
+
|
|
49
|
+
def save(self, username: str, cookies: httpx.Cookies) -> None:
|
|
50
|
+
data = {
|
|
51
|
+
"username": username,
|
|
52
|
+
"cookies": [
|
|
53
|
+
{"name": c.name, "value": c.value, "domain": c.domain, "path": c.path}
|
|
54
|
+
for c in cookies.jar
|
|
55
|
+
],
|
|
56
|
+
}
|
|
57
|
+
try:
|
|
58
|
+
self.path.parent.mkdir(parents=True, exist_ok=True)
|
|
59
|
+
# Per process: two vortex runs may save at the same time
|
|
60
|
+
tmp = self.path.with_suffix(f".{os.getpid()}.tmp")
|
|
61
|
+
fd = os.open(tmp, os.O_WRONLY | os.O_CREAT | os.O_TRUNC, 0o600)
|
|
62
|
+
with os.fdopen(fd, "w") as f:
|
|
63
|
+
json.dump(data, f)
|
|
64
|
+
os.replace(tmp, self.path)
|
|
65
|
+
except OSError as e:
|
|
66
|
+
# Not fatal: the next run just starts a new session
|
|
67
|
+
logger.debug(f"Unable to save the session to '{self.path}': {e}")
|
|
@@ -27,6 +27,7 @@ from vortex.models import PuakmaServer
|
|
|
27
27
|
from vortex.server_options import OPTIONS_BY_NAME
|
|
28
28
|
from vortex.server_options import ServersConfig
|
|
29
29
|
from vortex.server_options import secret_interpolation_error
|
|
30
|
+
from vortex.session_store import SessionStore
|
|
30
31
|
from vortex.util import file_lock
|
|
31
32
|
from vortex.util import locked_by_message
|
|
32
33
|
|
|
@@ -684,6 +685,9 @@ class Workspace:
|
|
|
684
685
|
protected,
|
|
685
686
|
gateway_path or None,
|
|
686
687
|
)
|
|
688
|
+
server.session_store = SessionStore(
|
|
689
|
+
self.config_dir / ".sessions" / f"{server_name}.json"
|
|
690
|
+
)
|
|
687
691
|
self._server_cache[server_name] = server
|
|
688
692
|
return server
|
|
689
693
|
except (configparser.Error, ValueError) as e:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: vortex_cli
|
|
3
|
-
Version: 8.4.
|
|
3
|
+
Version: 8.4.2
|
|
4
4
|
Summary: Vortex CLI
|
|
5
5
|
Author-email: Jordan Amos <jordan.amos@gmail.com>
|
|
6
6
|
License: MIT License
|
|
@@ -116,6 +116,11 @@ While it is possible to use without it, this software has been purposefully desi
|
|
|
116
116
|
- **8.4.1: `vortex clone` ignores case in a TemplateName or `group/name`.** `vortex clone
|
|
117
117
|
ui20complete/mastercustom` clones `ui20Complete/MasterCustom`; the name must still match in
|
|
118
118
|
full. If two applications differ only in case, the one typed exactly wins.
|
|
119
|
+
- **8.4.2: vortex reuses one server session.** Every command used to start a new Puakma
|
|
120
|
+
session, and parallel requests each started their own, leaving thousands of idle sessions
|
|
121
|
+
on the server until SessionTimeout. Session cookies are now kept per server in
|
|
122
|
+
`config/.sessions/` (owner-only; treat them like a login) and parallel requests share one
|
|
123
|
+
session. Delete the file to start a new session.
|
|
119
124
|
|
|
120
125
|
## Upgrading to 8.3
|
|
121
126
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|