diff --git a/gns3server/controller/compute.py b/gns3server/controller/compute.py index 7646008b..9f6e83c3 100644 --- a/gns3server/controller/compute.py +++ b/gns3server/controller/compute.py @@ -103,7 +103,14 @@ class Compute: elif self._id == "local": self._name = "Local" else: - self._name = "{}://{}:{}".format(self._protocol, self._host, self._port) + if self._user: + user = self._user + # Due to random user generated by 1.4 it's common to have a very long user + if len(user) > 14: + user = user[:11] + "..." + self._name = "{}://{}@{}:{}".format(self._protocol, user, self._host, self._port) + else: + self._name = "{}://{}:{}".format(self._protocol, self._host, self._port) @property def connected(self): diff --git a/tests/controller/test_compute.py b/tests/controller/test_compute.py index 84886b22..ad521e0d 100644 --- a/tests/controller/test_compute.py +++ b/tests/controller/test_compute.py @@ -47,7 +47,8 @@ def test_name(): assert c.name == "Local" c = Compute("world", protocol="https", host="example.com", port=84, controller=MagicMock(), name="hello") assert c.name == "hello" - + c = Compute("world", protocol="https", host="example.com", port=84, controller=MagicMock(),user="azertyuiopqsdfghjklkm") + assert c.name == "https://azertyuiopq...@example.com:84" def test_compute_local(compute): """ diff --git a/tests/controller/test_controller.py b/tests/controller/test_controller.py index b5455da7..43fcda86 100644 --- a/tests/controller/test_controller.py +++ b/tests/controller/test_controller.py @@ -64,7 +64,7 @@ def test_load(controller, controller_config_path, async_run): "port": 8000, "protocol": "http", "user": "admin", - "name": "http://localhost:8000" + "name": "http://admin@localhost:8000" }