vantage6-node 4.3.2rc2__tar.gz → 4.3.4__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.
Files changed (30) hide show
  1. {vantage6-node-4.3.2rc2 → vantage6-node-4.3.4}/PKG-INFO +1 -1
  2. vantage6-node-4.3.4/vantage6/node/__build__ +1 -0
  3. {vantage6-node-4.3.2rc2 → vantage6-node-4.3.4}/vantage6/node/__init__.py +4 -3
  4. {vantage6-node-4.3.2rc2 → vantage6-node-4.3.4}/vantage6/node/_version.py +1 -1
  5. {vantage6-node-4.3.2rc2 → vantage6-node-4.3.4}/vantage6/node/docker/docker_base.py +18 -2
  6. {vantage6-node-4.3.2rc2 → vantage6-node-4.3.4}/vantage6/node/docker/docker_manager.py +2 -0
  7. {vantage6-node-4.3.2rc2 → vantage6-node-4.3.4}/vantage6/node/docker/squid.py +7 -5
  8. {vantage6-node-4.3.2rc2 → vantage6-node-4.3.4}/vantage6/node/docker/task_manager.py +7 -5
  9. {vantage6-node-4.3.2rc2 → vantage6-node-4.3.4}/vantage6/node/docker/vpn_manager.py +7 -4
  10. {vantage6-node-4.3.2rc2 → vantage6-node-4.3.4}/vantage6/node/proxy_server.py +4 -1
  11. {vantage6-node-4.3.2rc2 → vantage6-node-4.3.4}/vantage6_node.egg-info/PKG-INFO +1 -1
  12. {vantage6-node-4.3.2rc2 → vantage6-node-4.3.4}/vantage6_node.egg-info/requires.txt +3 -3
  13. vantage6-node-4.3.2rc2/vantage6/node/__build__ +0 -1
  14. {vantage6-node-4.3.2rc2 → vantage6-node-4.3.4}/setup.cfg +0 -0
  15. {vantage6-node-4.3.2rc2 → vantage6-node-4.3.4}/setup.py +0 -0
  16. {vantage6-node-4.3.2rc2 → vantage6-node-4.3.4}/tests/__init__.py +0 -0
  17. {vantage6-node-4.3.2rc2 → vantage6-node-4.3.4}/tests/test_ssh_tunnel.py +0 -0
  18. {vantage6-node-4.3.2rc2 → vantage6-node-4.3.4}/vantage6/node/cli/__init__.py +0 -0
  19. {vantage6-node-4.3.2rc2 → vantage6-node-4.3.4}/vantage6/node/cli/node.py +0 -0
  20. {vantage6-node-4.3.2rc2 → vantage6-node-4.3.4}/vantage6/node/context.py +0 -0
  21. {vantage6-node-4.3.2rc2 → vantage6-node-4.3.4}/vantage6/node/docker/exceptions.py +0 -0
  22. {vantage6-node-4.3.2rc2 → vantage6-node-4.3.4}/vantage6/node/docker/ssh_tunnel.py +0 -0
  23. {vantage6-node-4.3.2rc2 → vantage6-node-4.3.4}/vantage6/node/globals.py +0 -0
  24. {vantage6-node-4.3.2rc2 → vantage6-node-4.3.4}/vantage6/node/socket.py +0 -0
  25. {vantage6-node-4.3.2rc2 → vantage6-node-4.3.4}/vantage6/node/util/__init__.py +0 -0
  26. {vantage6-node-4.3.2rc2 → vantage6-node-4.3.4}/vantage6/node/util/colorer.py +0 -0
  27. {vantage6-node-4.3.2rc2 → vantage6-node-4.3.4}/vantage6_node.egg-info/SOURCES.txt +0 -0
  28. {vantage6-node-4.3.2rc2 → vantage6-node-4.3.4}/vantage6_node.egg-info/dependency_links.txt +0 -0
  29. {vantage6-node-4.3.2rc2 → vantage6-node-4.3.4}/vantage6_node.egg-info/entry_points.txt +0 -0
  30. {vantage6-node-4.3.2rc2 → vantage6-node-4.3.4}/vantage6_node.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vantage6-node
3
- Version: 4.3.2rc2
3
+ Version: 4.3.4
4
4
  Summary: vantage6 node
5
5
  Home-page: https://github.com/vantage6/vantage6
6
6
  Requires-Python: >=3.10
@@ -0,0 +1 @@
1
+ 0
@@ -498,9 +498,10 @@ class Node:
498
498
  self.log.warn(
499
499
  f"You are trying to reach the server at {self.client.host}."
500
500
  " As your node is running inside a Docker container, it cannot"
501
- " reach localhost on your host system. Probably, you have to "
502
- "change your serverl URL to http://host.docker.internal "
503
- "(Windows/MacOS) or http://172.17.0.1 (Linux)."
501
+ " reach localhost on your host system. Probably, you have to"
502
+ " change your server URL to http://host.docker.internal (Windows/MacOS)"
503
+ ' or look into node config option "node_extra_hosts" if using'
504
+ " http://172.17.0.1 does not work (Linux)."
504
505
  )
505
506
  else:
506
507
  self.log.debug(
@@ -7,7 +7,7 @@ with open(os.path.join(here, "__build__")) as fp:
7
7
  __build__ = json.load(fp)
8
8
 
9
9
  # Module version
10
- version_info = (4, 3, 2, "candidate", __build__, 0)
10
+ version_info = (4, 3, 4, "final", __build__, 0)
11
11
 
12
12
  # Module version stage suffix map
13
13
  _specifier_ = {"alpha": "a", "beta": "b", "candidate": "rc", "final": ""}
@@ -1,5 +1,7 @@
1
1
  import docker
2
2
 
3
+ from docker import DockerClient
4
+
3
5
  from vantage6.common.docker.network_manager import NetworkManager
4
6
 
5
7
 
@@ -9,11 +11,25 @@ class DockerBaseManager(object):
9
11
  by multiple derived classes
10
12
  """
11
13
 
12
- def __init__(self, isolated_network_mgr: NetworkManager) -> None:
14
+ def __init__(
15
+ self,
16
+ isolated_network_mgr: NetworkManager,
17
+ docker_client: DockerClient = None,
18
+ ) -> None:
19
+ """
20
+ Constructor for DockerBaseManager
21
+
22
+ Parameters
23
+ ----------
24
+ isolated_network_mgr: NetworkManager
25
+ Manager of an isolated network
26
+ docker_client: DockerClient
27
+ Docker client to use. If None is provided, a new client will be created
28
+ """
13
29
  self.isolated_network_mgr = isolated_network_mgr
14
30
 
15
31
  # Connect to docker daemon
16
- self.docker = docker.from_env()
32
+ self.docker = docker_client if docker_client else docker.from_env()
17
33
 
18
34
  def get_isolated_netw_ip(self, container) -> str:
19
35
  """
@@ -511,8 +511,10 @@ class DockerManager(DockerBaseManager):
511
511
  self.log.debug(f"run_id={run_id} is discarded")
512
512
  return TaskStatus.ACTIVE, None
513
513
 
514
+ # we pass self.docker instance, in which we may have logged in to registries
514
515
  task = DockerTaskManager(
515
516
  image=image,
517
+ docker_client=self.docker,
516
518
  run_id=run_id,
517
519
  task_info=task_info,
518
520
  vpn_manager=self.vpn_manager,
@@ -20,7 +20,7 @@ from vantage6.common.docker.addons import (
20
20
  remove_container,
21
21
  running_in_docker,
22
22
  remove_container_if_exists,
23
- pull_if_newer,
23
+ pull_image,
24
24
  )
25
25
  from vantage6.node.docker.docker_base import DockerBaseManager
26
26
  from vantage6.node.docker.docker_manager import NetworkManager
@@ -90,7 +90,7 @@ class Squid(DockerBaseManager):
90
90
  # This is the default port of the squid container, which is exposed
91
91
  # to the algorithm containers.
92
92
  self.port = 3128
93
- log.debug(f"Squid hostname: {self.hostname}, port: {self.port}")
93
+ log.debug("Squid hostname: %s, port: %s", self.hostname, self.port)
94
94
 
95
95
  try:
96
96
  # Create squid configuration, which can later be mounted by the
@@ -100,15 +100,17 @@ class Squid(DockerBaseManager):
100
100
  # parent class should handle this
101
101
  raise KeyError(f"Invalid Squid configuration: {e}")
102
102
 
103
- log.debug(f"Squid configuration: {self.squid_config}")
103
+ log.debug("Squid configuration: %s", self.squid_config)
104
104
 
105
105
  # Check if the whitelist is safe, if not, log a warning
106
106
  self.check_safety_of_whitelist(self.squid_config)
107
107
 
108
108
  # The image is overridable by the user configuration
109
109
  self.image = squid_image if squid_image else f"{SQUID_IMAGE}:{major_minor}"
110
- pull_if_newer(self.docker, self.image, log)
111
- log.debug(f"Squid image: {self.image}")
110
+ log.info("Pulling Squid image: %s", self.image)
111
+ pull_image(self.docker, self.image)
112
+
113
+ log.debug("Squid image: %s", self.image)
112
114
 
113
115
  # Create the SSH configuration files
114
116
  self.create_squid_config_file(self.squid_config)
@@ -7,12 +7,12 @@ import json
7
7
  import base64
8
8
 
9
9
  from pathlib import Path
10
+ from docker import DockerClient
10
11
 
11
12
  from vantage6.common.globals import APPNAME, ENV_VAR_EQUALS_REPLACEMENT, STRING_ENCODING
12
13
  from vantage6.common.docker.addons import (
13
14
  remove_container_if_exists,
14
15
  remove_container,
15
- pull_if_newer,
16
16
  running_in_docker,
17
17
  )
18
18
  from vantage6.common.docker.network_manager import NetworkManager
@@ -42,6 +42,7 @@ class DockerTaskManager(DockerBaseManager):
42
42
  def __init__(
43
43
  self,
44
44
  image: str,
45
+ docker_client: DockerClient,
45
46
  vpn_manager: VPNManager,
46
47
  node_name: str,
47
48
  run_id: int,
@@ -61,6 +62,8 @@ class DockerTaskManager(DockerBaseManager):
61
62
  ----------
62
63
  image: str
63
64
  Name of docker image to be run
65
+ docker_client: DockerClient
66
+ Docker client instance to use
64
67
  vpn_manager: VPNManager
65
68
  VPN manager required to set up traffic forwarding via VPN
66
69
  node_name: str
@@ -86,7 +89,7 @@ class DockerTaskManager(DockerBaseManager):
86
89
  self.task_id = task_info["id"]
87
90
  self.log = logging.getLogger(f"task ({self.task_id})")
88
91
 
89
- super().__init__(isolated_network_mgr)
92
+ super().__init__(isolated_network_mgr, docker_client=docker_client)
90
93
  self.image = image
91
94
  self.__vpn_manager = vpn_manager
92
95
  self.run_id = run_id
@@ -184,8 +187,7 @@ class DockerTaskManager(DockerBaseManager):
184
187
  """Pull the latest docker image."""
185
188
  try:
186
189
  self.log.info(f"Retrieving latest image: '{self.image}'")
187
- pull_if_newer(self.docker, self.image, self.log)
188
-
190
+ self.docker.images.pull(self.image)
189
191
  except docker.errors.APIError as e:
190
192
  self.log.debug("Failed to pull image: could not find image")
191
193
  self.log.exception(e)
@@ -655,5 +657,5 @@ class DockerTaskManager(DockerBaseManager):
655
657
 
656
658
  encoded_environment_variables = {}
657
659
  for key, val in environment_variables.items():
658
- encoded_environment_variables[key] = _encode(val)
660
+ encoded_environment_variables[key] = _encode(str(val))
659
661
  return encoded_environment_variables
@@ -12,7 +12,7 @@ from vantage6.common.globals import APPNAME, VPN_CONFIG_FILE
12
12
  from vantage6.common.docker.addons import (
13
13
  remove_container_if_exists,
14
14
  remove_container,
15
- pull_if_newer,
15
+ pull_image,
16
16
  )
17
17
  from vantage6.common.docker.network_manager import NetworkManager
18
18
  from vantage6.node.globals import (
@@ -101,9 +101,12 @@ class VPNManager(DockerBaseManager):
101
101
  def _update_images(self) -> None:
102
102
  """Pulls the latest version of the VPN images"""
103
103
  self.log.info("Updating VPN images...")
104
- pull_if_newer(self.docker, self.alpine_image, self.log)
105
- pull_if_newer(self.docker, self.vpn_client_image, self.log)
106
- pull_if_newer(self.docker, self.network_config_image, self.log)
104
+ self.log.debug("Pulling Alpine image")
105
+ pull_image(self.docker, self.alpine_image)
106
+ self.log.debug("Pulling VPN client image")
107
+ pull_image(self.docker, self.vpn_client_image)
108
+ self.log.debug("Pulling network config image")
109
+ pull_image(self.docker, self.network_config_image)
107
110
  self.log.info("Done updating VPN images")
108
111
 
109
112
  def connect_vpn(self) -> None:
@@ -119,7 +119,10 @@ def make_request(
119
119
  # verify that the server gave us a valid response, else we
120
120
  # would want to try again
121
121
  if response.status_code > 210:
122
- log.warn("Proxy server received status code:" f"{response.status_code}")
122
+ log.warning(
123
+ "Proxy server received status code %s", response.status_code
124
+ )
125
+ log.warning("Error messages: %s", response.json())
123
126
  log.debug(
124
127
  f"method: {request.method}, url: {url}, json: {json}"
125
128
  f", params: {params}, headers: {headers}"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vantage6-node
3
- Version: 4.3.2rc2
3
+ Version: 4.3.4
4
4
  Summary: vantage6 node
5
5
  Home-page: https://github.com/vantage6/vantage6
6
6
  Requires-Python: >=3.10
@@ -4,9 +4,9 @@ gevent==23.9.1
4
4
  jinja2==3.1.3
5
5
  python-socketio==5.7.2
6
6
  requests==2.31.0
7
- vantage6==4.3.2rc2
8
- vantage6-client==4.3.2rc2
9
- vantage6-algorithm-tools==4.3.2rc2
7
+ vantage6==4.3.4
8
+ vantage6-client==4.3.4
9
+ vantage6-algorithm-tools==4.3.4
10
10
 
11
11
  [dev]
12
12
  coverage==6.4.4
@@ -1 +0,0 @@
1
- 2
File without changes