vantage6 4.0.0a8__py3-none-any.whl → 4.0.0a10__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.

Potentially problematic release.


This version of vantage6 might be problematic. Click here for more details.

vantage6/cli/__build__ CHANGED
@@ -1 +1 @@
1
- 8
1
+ 10
vantage6/cli/dev.py CHANGED
@@ -249,7 +249,10 @@ def create_vserver_config(server_name: str, port: int) -> Path:
249
249
  loader=FileSystemLoader(PACKAGE_FOLDER / APPNAME / "cli" / "template"),
250
250
  trim_blocks=True, lstrip_blocks=True, autoescape=True)
251
251
  template = environment.get_template("server_config.j2")
252
- server_config = template.render(port=port)
252
+ server_config = template.render(
253
+ port=port,
254
+ jwt_secret_key=generate_apikey()
255
+ )
253
256
  folders = ServerContext.instance_folders(
254
257
  instance_type='server', instance_name=server_name,
255
258
  system_folders=True)
vantage6/cli/node.py CHANGED
@@ -36,7 +36,8 @@ from vantage6.common.globals import (
36
36
  STRING_ENCODING,
37
37
  APPNAME,
38
38
  DEFAULT_DOCKER_REGISTRY,
39
- DEFAULT_NODE_IMAGE
39
+ DEFAULT_NODE_IMAGE,
40
+ DEFAULT_NODE_IMAGE_WO_TAG,
40
41
  )
41
42
  from vantage6.common.globals import VPN_CONFIG_FILE
42
43
  from vantage6.common.docker.addons import (
@@ -312,6 +313,32 @@ def vnode_start(name: str, config: str, system_folders: bool,
312
313
  custom_images: dict = ctx.config.get('images')
313
314
  if custom_images:
314
315
  image = custom_images.get("node")
316
+
317
+ # if no custom image is specified, find the server version and use
318
+ # the latest images from that minor version
319
+ client = _create_client(ctx)
320
+ major_minor = None
321
+ try:
322
+ # try to get server version, skip if can't get a connection
323
+ version = client.util.get_server_version(
324
+ attempts_on_timeout=3
325
+ )['version']
326
+ major_minor = '.'.join(version.split('.')[:2])
327
+ image = (f"{DEFAULT_DOCKER_REGISTRY}/{DEFAULT_NODE_IMAGE_WO_TAG}"
328
+ f":{major_minor}")
329
+ except Exception:
330
+ warning("Could not determine server version. Using default node "
331
+ "image")
332
+ pass # simply use the default image
333
+
334
+ if major_minor and not __version__.startswith(major_minor):
335
+ warning(
336
+ "Version mismatch between CLI and server/node. CLI is running "
337
+ f"on version {__version__}, while node and server are on "
338
+ f"version {major_minor}. This might cause unexpected issues; "
339
+ f"changing to {major_minor}.<latest> is recommended."
340
+ )
341
+
315
342
  if not image:
316
343
  image = f"{DEFAULT_DOCKER_REGISTRY}/{DEFAULT_NODE_IMAGE}"
317
344
 
@@ -970,36 +997,55 @@ def _print_log_worker(logs_stream: Iterable[bytes]) -> None:
970
997
  print(log.decode(STRING_ENCODING), end="")
971
998
 
972
999
 
973
- def _create_client_and_authenticate(ctx: NodeContext) -> UserClient:
1000
+ def _create_client(ctx: NodeContext) -> UserClient:
974
1001
  """
975
- Generate a client and authenticate with the server.
1002
+ Create a client instance.
976
1003
 
977
1004
  Parameters
978
1005
  ----------
979
1006
  ctx : NodeContext
980
1007
  Context of the node loaded from the configuration file
981
-
982
1008
  Returns
983
1009
  -------
984
1010
  UserClient
985
1011
  vantage6 client
986
1012
  """
987
1013
  host = ctx.config['server_url']
1014
+ # if the server is run locally, we need to use localhost here instead of
1015
+ # the host address of docker
1016
+ if host in ['http://host.docker.internal', 'http://172.17.0.1']:
1017
+ host = 'http://localhost'
988
1018
  port = ctx.config['port']
989
1019
  api_path = ctx.config['api_path']
990
-
991
1020
  info(f"Connecting to server at '{host}:{port}{api_path}'")
1021
+ return UserClient(host, port, api_path, log_level='warn')
1022
+
1023
+
1024
+ def _create_client_and_authenticate(ctx: NodeContext) -> UserClient:
1025
+ """
1026
+ Generate a client and authenticate with the server.
1027
+
1028
+ Parameters
1029
+ ----------
1030
+ ctx : NodeContext
1031
+ Context of the node loaded from the configuration file
1032
+
1033
+ Returns
1034
+ -------
1035
+ UserClient
1036
+ vantage6 client
1037
+ """
1038
+ client = _create_client(ctx)
1039
+
992
1040
  username = q.text("Username:").ask()
993
1041
  password = q.password("Password:").ask()
994
1042
 
995
- client = UserClient(host, port, api_path)
996
-
997
1043
  try:
998
1044
  client.authenticate(username, password)
999
1045
 
1000
- except Exception as e:
1046
+ except Exception as exc:
1001
1047
  error("Could not authenticate with server!")
1002
- debug(e)
1048
+ debug(exc)
1003
1049
  exit(1)
1004
1050
 
1005
1051
  return client
vantage6/cli/server.py CHANGED
@@ -209,16 +209,6 @@ def vserver_start(ctx: ServerContext, ip: str, port: int, image: str,
209
209
  # Then we check if the image has been specified in the config file, and
210
210
  # finally we use the default settings from the package.
211
211
  if image is None:
212
-
213
- # FIXME: remove me in version 4+, as this is to support older
214
- # configuration files. So the outer `image` key is no longer supported
215
- # Note that this was implicitly supported in version 3.* for server as
216
- # well
217
- if ctx.config.get('image'):
218
- warning('Using the `image` option in the config file is to be '
219
- 'removed in version 4+.')
220
- image = ctx.config.get('image')
221
-
222
212
  custom_images: dict = ctx.config.get('images')
223
213
  if custom_images:
224
214
  image = custom_images.get('server')
@@ -12,3 +12,4 @@ logging:
12
12
  use_console: true
13
13
  port: {{ port }}
14
14
  uri: sqlite:///default.sqlite
15
+ jwt_secret_key: {{ jwt_secret_key }}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vantage6
3
- Version: 4.0.0a8
3
+ Version: 4.0.0a10
4
4
  Summary: vantage6 command line interface
5
5
  Home-page: https://github.com/vantage6/vantage6
6
6
  Requires-Python: >=3.10
@@ -13,8 +13,8 @@ Requires-Dist: jinja2 ==3.1.2
13
13
  Requires-Dist: questionary ==1.10.0
14
14
  Requires-Dist: schema ==0.7.5
15
15
  Requires-Dist: SQLAlchemy ==1.4.46
16
- Requires-Dist: vantage6-common ==4.0.0a8
17
- Requires-Dist: vantage6-client ==4.0.0a8
16
+ Requires-Dist: vantage6-common ==4.0.0a10
17
+ Requires-Dist: vantage6-client ==4.0.0a10
18
18
  Provides-Extra: dev
19
19
  Requires-Dist: coverage ==6.4.4 ; extra == 'dev'
20
20
 
@@ -3,26 +3,26 @@ tests_cli/test_example.py,sha256=TV8JA52UR-Yh1WeVwx8g8ngA9ZTiRCwsJkUKxsXUXMg,147
3
3
  tests_cli/test_node_cli.py,sha256=WnJ5IBbP-hT4WY7dxx0H3hvoG8hP13K7lPyCrFhGJyE,14667
4
4
  tests_cli/test_server_cli.py,sha256=of88K23UqY4puDEs-6Q7P-Au8p4cjOtFpf-EyK7eyvg,5858
5
5
  tests_cli/test_wizard.py,sha256=dRrOScN79z8nKGNWmn6tPAVfnDOmCsGckiDJMKufhms,3580
6
- vantage6/cli/__build__,sha256=LGJCMs3SIXcSlN-7MQrKAAoN9qyLZraW2Q7wb977ZKM,1
6
+ vantage6/cli/__build__,sha256=SkTcFTZCBKgP6A6QOUVcwWCCgYIP4rJPHlIzreavHdU,2
7
7
  vantage6/cli/__init__.py,sha256=dEbhLHe9VfU3otY3CQkMVrj39uPGWjqzAvHW2B2Flgs,62
8
8
  vantage6/cli/_version.py,sha256=IZvEcyXbRmjO6iYbFQyllAnSW6LWidVvFrVIAyEhFS4,684
9
9
  vantage6/cli/configuration_manager.py,sha256=4EHlOW16nfIiplzA0sw9udc4-VLKcmdKgWzzFa5Nw7A,3841
10
10
  vantage6/cli/configuration_wizard.py,sha256=c8L4xm9_HYjAkyTmRmLDMwzTDqdKdgnBZy915TAIfRI,11569
11
11
  vantage6/cli/context.py,sha256=Q8d-PYq_hBB8chXv1qlI9jYfVVIv2X6BOC-PGmWgptw,13183
12
- vantage6/cli/dev.py,sha256=Nd5MS1gPVHyVoDCTpZxQkvSUSm7b06bIb7QSXKKqRmo,15742
12
+ vantage6/cli/dev.py,sha256=wpoemItUXJW5aPDiMKwuS5YAhJJsWhIYdcLSWeJLPSE,15798
13
13
  vantage6/cli/globals.py,sha256=5mo7pv45gXhDtG7phSYdK_D9_LPFuBM8bVABgt-J-BY,778
14
- vantage6/cli/node.py,sha256=mV3Hx01JicWZiUJnD_uRiP3FRyCAui8HalvY45zsmh8,35785
15
- vantage6/cli/server.py,sha256=yIbGLyzY3FBZmR_0D8rNmsJn3-gtrLGyjoLw_0-Pf5M,34955
14
+ vantage6/cli/node.py,sha256=J8fk3Lnw7XuaSs9KtkyHlKMtSNIbPt3btlPZNs7OZw4,37523
15
+ vantage6/cli/server.py,sha256=DePFVddu0wm6hu5wEZhg8hRFp9tBpFZ80OKZ6orRAg8,34508
16
16
  vantage6/cli/utils.py,sha256=Lx1xYKXDBeHjJpXGkVAhidy79P-zV3TOQYfa2nMbvSs,2353
17
17
  vantage6/cli/rabbitmq/__init__.py,sha256=0cuoLZ3V1199PKI-Ew37leZmh77SOAYa8CKMLUUBgBs,737
18
18
  vantage6/cli/rabbitmq/definitions.py,sha256=aGFdwxzi7R28uaDS60iW3a-JCkV2F5w_T3oede0kWds,536
19
19
  vantage6/cli/rabbitmq/queue_manager.py,sha256=CG2Lx5RCpf2AjzaCvj9vrwrqJOlWbEqf89auX2iuXcU,7613
20
20
  vantage6/cli/rabbitmq/rabbitmq.config,sha256=LYAQAEoXaF472XeJDYXc9JfWSETIzPRIR2W-JB2i7fU,136
21
21
  vantage6/cli/template/node_config.j2,sha256=-IyUquZl4jRxb5DRBWvEbZFwz2lFtHG_1reZoSkeees,495
22
- vantage6/cli/template/server_config.j2,sha256=WIWdDA3qgp8UBeBdrKbrxZmyUg6F8hTTlG1v4ifgCSQ,331
22
+ vantage6/cli/template/server_config.j2,sha256=d6O_K-VzJC3GHbCGVbXRWB4jTEzJHPz1VC7t3U8e0Tc,367
23
23
  vantage6/cli/template/server_import_config.j2,sha256=PRB0ym_FYjx9vhkmY9C0xzlv_85Y5kBfWdUYs089bNQ,1844
24
- vantage6-4.0.0a8.dist-info/METADATA,sha256=kUErERKV7oc8hY_jsPnWbfRAr4hv7dRo_S2j_4kVFBU,5710
25
- vantage6-4.0.0a8.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
26
- vantage6-4.0.0a8.dist-info/entry_points.txt,sha256=vSagHm3y33r8pUMgWW4kZCz-j35aDECRnYnViVNRvtI,126
27
- vantage6-4.0.0a8.dist-info/top_level.txt,sha256=CYDIBS8jEfFq5YCs_Fuit54K9-3wdosZppTrsymIoUk,19
28
- vantage6-4.0.0a8.dist-info/RECORD,,
24
+ vantage6-4.0.0a10.dist-info/METADATA,sha256=Y7Th0V7F7P4JDCxUMB8fioYlWULVFoR7NS7ujB844Vw,5713
25
+ vantage6-4.0.0a10.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
26
+ vantage6-4.0.0a10.dist-info/entry_points.txt,sha256=vSagHm3y33r8pUMgWW4kZCz-j35aDECRnYnViVNRvtI,126
27
+ vantage6-4.0.0a10.dist-info/top_level.txt,sha256=CYDIBS8jEfFq5YCs_Fuit54K9-3wdosZppTrsymIoUk,19
28
+ vantage6-4.0.0a10.dist-info/RECORD,,