appmesh 1.2.6__py3-none-any.whl → 1.2.9__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.
- appmesh/appmesh_client.py +9 -8
- {appmesh-1.2.6.dist-info → appmesh-1.2.9.dist-info}/METADATA +2 -2
- appmesh-1.2.9.dist-info/RECORD +6 -0
- appmesh-1.2.6.dist-info/RECORD +0 -6
- {appmesh-1.2.6.dist-info → appmesh-1.2.9.dist-info}/WHEEL +0 -0
- {appmesh-1.2.6.dist-info → appmesh-1.2.9.dist-info}/top_level.txt +0 -0
appmesh/appmesh_client.py
CHANGED
@@ -13,7 +13,7 @@ import uuid
|
|
13
13
|
from enum import Enum, unique
|
14
14
|
from datetime import datetime
|
15
15
|
from http import HTTPStatus
|
16
|
-
from typing import Optional
|
16
|
+
from typing import Optional, Tuple
|
17
17
|
from urllib import parse
|
18
18
|
|
19
19
|
import aniso8601
|
@@ -31,7 +31,7 @@ _SSL_CA_PEM_FILE = "/opt/appmesh/ssl/ca.pem"
|
|
31
31
|
_SSL_CLIENT_PEM_FILE = "/opt/appmesh/ssl/client.pem"
|
32
32
|
_SSL_CLIENT_PEM_KEY_FILE = "/opt/appmesh/ssl/client-key.pem"
|
33
33
|
HTTP_USER_AGENT_HEADER_NAME = "User-Agent"
|
34
|
-
HTTP_USER_AGENT = "
|
34
|
+
HTTP_USER_AGENT = "appmesh/python"
|
35
35
|
|
36
36
|
|
37
37
|
def _get_str_item(data: dict, key):
|
@@ -296,7 +296,7 @@ class App(object):
|
|
296
296
|
return output
|
297
297
|
|
298
298
|
|
299
|
-
class
|
299
|
+
class AppRun(object):
|
300
300
|
"""
|
301
301
|
Application run object indicate to a remote run from run_async()
|
302
302
|
"""
|
@@ -1241,13 +1241,13 @@ class AppMeshClient(metaclass=abc.ABCMeta):
|
|
1241
1241
|
)
|
1242
1242
|
if resp.status_code != HTTPStatus.OK:
|
1243
1243
|
raise Exception(resp.text)
|
1244
|
-
return
|
1244
|
+
return AppRun(self, resp.json()["name"], resp.json()["process_uuid"])
|
1245
1245
|
|
1246
|
-
def run_async_wait(self, run:
|
1246
|
+
def run_async_wait(self, run: AppRun, stdout_print: bool = True, timeout: int = 0) -> int:
|
1247
1247
|
"""Wait for an async run to be finished
|
1248
1248
|
|
1249
1249
|
Args:
|
1250
|
-
run (
|
1250
|
+
run (AppRun): asyncrized run result from run_async().
|
1251
1251
|
stdout_print (bool, optional): print remote stdout to local or not.
|
1252
1252
|
timeout (int, optional): wait max timeout seconds and return if not finished, 0 means wait until finished
|
1253
1253
|
|
@@ -1282,7 +1282,7 @@ class AppMeshClient(metaclass=abc.ABCMeta):
|
|
1282
1282
|
stdout_print: bool = True,
|
1283
1283
|
max_time_seconds=DEFAULT_RUN_APP_TIMEOUT_SECONDS,
|
1284
1284
|
life_cycle_seconds=DEFAULT_RUN_APP_LIFECYCLE_SECONDS,
|
1285
|
-
) -> int:
|
1285
|
+
) -> Tuple[int, str]:
|
1286
1286
|
"""Block run a command remotely, 'name' attribute in app_json dict used to run an existing application
|
1287
1287
|
The synchronized run will block the process until the remote run is finished then return the result from HTTP response
|
1288
1288
|
|
@@ -1294,6 +1294,7 @@ class AppMeshClient(metaclass=abc.ABCMeta):
|
|
1294
1294
|
|
1295
1295
|
Returns:
|
1296
1296
|
int: process exit code, return None if no exit code.
|
1297
|
+
str: stdout text
|
1297
1298
|
"""
|
1298
1299
|
path = "/appmesh/app/syncrun"
|
1299
1300
|
resp = self._request_http(
|
@@ -1310,7 +1311,7 @@ class AppMeshClient(metaclass=abc.ABCMeta):
|
|
1310
1311
|
exit_code = int(resp.headers.get("Exit-Code"))
|
1311
1312
|
elif stdout_print:
|
1312
1313
|
print(resp.text)
|
1313
|
-
return exit_code
|
1314
|
+
return exit_code, resp.text
|
1314
1315
|
|
1315
1316
|
def _request_http(self, method: Method, path: str, query: dict = None, header: dict = None, body=None) -> requests.Response:
|
1316
1317
|
"""REST API
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: appmesh
|
3
|
-
Version: 1.2.
|
3
|
+
Version: 1.2.9
|
4
4
|
Summary: Client SDK for App Mesh
|
5
5
|
Home-page: https://github.com/laoshanxi/app-mesh
|
6
6
|
Author: laoshanxi
|
@@ -43,7 +43,7 @@ Cloud native | Schedule cloud-level applications to run on multiple hosts with r
|
|
43
43
|
Micro service application | ⚡️ [Consul micro-service cluster management](https://app-mesh.readthedocs.io/en/latest/CONSUL.html)
|
44
44
|
Extra Features | Collect host/app resource usage <br> Remote shell command execution <br> File upload/download interface <br> Hot-update support `systemctl reload appmesh` <br> Bash completion <br> Reverse proxy <br> [Web GUI](https://github.com/laoshanxi/app-mesh-ui)
|
45
45
|
Platform support | X86_64 <br> ARM32 <br> ARM64
|
46
|
-
SDK | [Python](https://app-mesh.readthedocs.io/en/latest/api/appmesh_client.html) <br> [Golang](https://github.com/laoshanxi/app-mesh/blob/main/src/sdk/go/appmesh_client.go) <br> [JavaScript](https://www.npmjs.com/package/appmesh) <br> [Swagger OpenAPI Specification](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/laoshanxi/app-mesh/main/src/daemon/rest/openapi.yaml)
|
46
|
+
SDK | [Python](https://app-mesh.readthedocs.io/en/latest/api/appmesh_client.html) <br> [Golang](https://github.com/laoshanxi/app-mesh/blob/main/src/sdk/go/appmesh_client.go) <br> [JavaScript](https://www.npmjs.com/package/appmesh) <br> [Java](https://github.com/laoshanxi/app-mesh/blob/main/src/sdk/java/) <br> [Swagger OpenAPI Specification](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/laoshanxi/app-mesh/main/src/daemon/rest/openapi.yaml)
|
47
47
|
|
48
48
|
## Getting started
|
49
49
|
|
@@ -0,0 +1,6 @@
|
|
1
|
+
appmesh/__init__.py,sha256=xRdXeFHEieRauuJZElbEBASgXG0ZzU1a5_0isAhM7Gw,11
|
2
|
+
appmesh/appmesh_client.py,sha256=12PXzQY1MTh48XR5XaCLQ3Lvs1g7lLD2KE9QcrNhPgw,62480
|
3
|
+
appmesh-1.2.9.dist-info/METADATA,sha256=k4BdUChQq2Ts5YwEJwPGolTy1jpYpZdWnm6SmEtLrKo,11041
|
4
|
+
appmesh-1.2.9.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
|
5
|
+
appmesh-1.2.9.dist-info/top_level.txt,sha256=-y0MNQOGJxUzLdHZ6E_Rfv5_LNCkV-GTmOBME_b6pg8,8
|
6
|
+
appmesh-1.2.9.dist-info/RECORD,,
|
appmesh-1.2.6.dist-info/RECORD
DELETED
@@ -1,6 +0,0 @@
|
|
1
|
-
appmesh/__init__.py,sha256=xRdXeFHEieRauuJZElbEBASgXG0ZzU1a5_0isAhM7Gw,11
|
2
|
-
appmesh/appmesh_client.py,sha256=XJNMUIyBj97JiRfQ3Y11Hk76nQLKtIy6fszUUO-_nmM,62408
|
3
|
-
appmesh-1.2.6.dist-info/METADATA,sha256=3OdzuZkZp3ehs-ng7iVXzBQNh4CGJywiFXyFfynILQM,10966
|
4
|
-
appmesh-1.2.6.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
|
5
|
-
appmesh-1.2.6.dist-info/top_level.txt,sha256=-y0MNQOGJxUzLdHZ6E_Rfv5_LNCkV-GTmOBME_b6pg8,8
|
6
|
-
appmesh-1.2.6.dist-info/RECORD,,
|
File without changes
|
File without changes
|