From 7b8f16bcb43e5390aabb06225870887cfda376fc Mon Sep 17 00:00:00 2001 From: Kelvin zawala <87924723+Zawala@users.noreply.github.com> Date: Tue, 3 May 2022 13:52:10 +0200 Subject: [PATCH] Get-app from port specific ssh git server (#1299) * Get-app from port specific ssh git server Current bench package fails to get an app from a private git server with a specific ssh port other than the normal 22. * test: Added tests for ssh ports Co-authored-by: Aradhya Tripathi <67282231+Aradhya-Tripathi@users.noreply.github.com> Co-authored-by: Aradhya --- bench/app.py | 2 +- bench/tests/test_utils.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/bench/app.py b/bench/app.py index e0da4e18..6a9d4e97 100755 --- a/bench/app.py +++ b/bench/app.py @@ -116,7 +116,7 @@ class AppMeta: name = url if url else self.name if name.startswith("git@") or name.startswith("ssh://"): self.use_ssh = True - _first_part, _second_part = name.split(":") + _first_part, _second_part = self.name.rsplit(":", 1) self.remote_server = _first_part.split("@")[-1] self.org, _repo = _second_part.rsplit("/", 1) else: diff --git a/bench/tests/test_utils.py b/bench/tests/test_utils.py index 3c2b3307..f91e8785 100644 --- a/bench/tests/test_utils.py +++ b/bench/tests/test_utils.py @@ -73,3 +73,7 @@ class TestUtils(unittest.TestCase): self.assertEqual("11.0", fake_bench.apps.states["frappe"]["version"]) shutil.rmtree(bench_dir) + + def test_ssh_ports(self): + app = App("git@github.com:22:frappe/frappe") + self.assertEqual((app.use_ssh, app.org, app.repo), (True, "frappe", "frappe")) \ No newline at end of file