← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:code-import-worker-remove-blacklisted-hostnames into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:code-import-worker-remove-blacklisted-hostnames into launchpad:master.

Commit message:
Remove blacklisted hostname checks in code import worker

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/394109

The scheduler now passes --exclude-host options, which cover the same ground.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:code-import-worker-remove-blacklisted-hostnames into launchpad:master.
diff --git a/lib/lp/codehosting/codeimport/tests/test_worker.py b/lib/lp/codehosting/codeimport/tests/test_worker.py
index b6c2614..59077d7 100644
--- a/lib/lp/codehosting/codeimport/tests/test_worker.py
+++ b/lib/lp/codehosting/codeimport/tests/test_worker.py
@@ -1456,7 +1456,6 @@ class CodeImportBranchOpenPolicyTests(TestCase):
         self.assertGoodUrl("http://user:password@svn.example/branches/trunk";)
         self.assertBadUrl("svn+ssh://svn.example.com/bla")
         self.assertGoodUrl("bzr://bzr.example.com/somebzrurl/")
-        self.assertBadUrl("bzr://bazaar.launchpad.test/example")
 
     def test_check_one_url_git_to_bzr(self):
         self.policy = CodeImportBranchOpenPolicy("git", "bzr")
@@ -1464,7 +1463,6 @@ class CodeImportBranchOpenPolicyTests(TestCase):
         self.assertBadUrl("file:///etc/passwd")
         self.assertBadUrl("unknown-scheme://devpad/")
         self.assertGoodUrl("git://git.example.com/repo")
-        self.assertGoodUrl("git://git.launchpad.test/example")
 
     def test_check_one_url_git_to_git(self):
         self.policy = CodeImportBranchOpenPolicy("git", "git")
@@ -1472,7 +1470,6 @@ class CodeImportBranchOpenPolicyTests(TestCase):
         self.assertBadUrl("file:///etc/passwd")
         self.assertBadUrl("unknown-scheme://devpad/")
         self.assertGoodUrl("git://git.example.com/repo")
-        self.assertBadUrl("git://git.launchpad.test/example")
 
     def test_check_one_url_exclude_hosts(self):
         self.policy = CodeImportBranchOpenPolicy(
diff --git a/lib/lp/codehosting/codeimport/worker.py b/lib/lp/codehosting/codeimport/worker.py
index 2652b16..43f6938 100644
--- a/lib/lp/codehosting/codeimport/worker.py
+++ b/lib/lp/codehosting/codeimport/worker.py
@@ -83,7 +83,6 @@ from six.moves.urllib.parse import (
     urlunsplit,
     )
 
-from lp.code.interfaces.branch import get_blacklisted_hostnames
 from lp.codehosting.codeimport.foreigntree import CVSWorkingTree
 from lp.codehosting.codeimport.tarball import (
     create_tarball,
@@ -146,16 +145,6 @@ class CodeImportBranchOpenPolicy(BranchOpenPolicy):
         for hostname in self.exclude_hosts:
             if uri.underDomain(hostname):
                 raise BadUrl(url)
-        # XXX cjwatson 2020-10-20: These hostname checks require tight
-        # coupling with Launchpad.  Remove them once the scheduler always
-        # passes exclusions via --exclude-host arguments.
-        if self.rcstype == self.target_rcstype:
-            launchpad_domain = config.vhost.mainsite.hostname
-            if uri.underDomain(launchpad_domain):
-                raise BadUrl(url)
-        for hostname in get_blacklisted_hostnames():
-            if uri.underDomain(hostname):
-                raise BadUrl(url)
         if uri.scheme not in self.allowed_schemes:
             raise BadUrl(url)