← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:update-sync-branches-source into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:update-sync-branches-source into launchpad:master.

Commit message:
Update rsync source used by sync-branches

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

I currently get "Connection timed out" trying to rsync from `bazaar.launchpad.net::mirrors/` on tellurium, but `bazaar.lp.internal::mirrors/` works fine, and makes a bit more logical sense anyway.

It probably makes sense for this to be configurable.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:update-sync-branches-source into launchpad:master.
diff --git a/lib/lp/codehosting/scripts/sync_branches.py b/lib/lp/codehosting/scripts/sync_branches.py
index fc361a5..8bbd875 100644
--- a/lib/lp/codehosting/scripts/sync_branches.py
+++ b/lib/lp/codehosting/scripts/sync_branches.py
@@ -18,7 +18,6 @@ from lp.services.scripts.base import LaunchpadScript, LaunchpadScriptFailure
 
 # We don't want to spend too long syncing branches.
 BRANCH_LIMIT = 35
-REMOTE_SERVER = "bazaar.launchpad.net"
 
 
 class SyncBranchesScript(LaunchpadScript):
@@ -45,7 +44,7 @@ class SyncBranchesScript(LaunchpadScript):
             "rsync",
             "-a",
             "--delete-after",
-            "%s::mirrors/%s/" % (REMOTE_SERVER, branch_path),
+            "%s/%s/" % (config.codehosting.sync_branches_source, branch_path),
             "%s/" % branch_dir,
         ]
         try:
diff --git a/lib/lp/codehosting/scripts/tests/test_sync_branches.py b/lib/lp/codehosting/scripts/tests/test_sync_branches.py
index 1d38c4a..312b0cc 100644
--- a/lib/lp/codehosting/scripts/tests/test_sync_branches.py
+++ b/lib/lp/codehosting/scripts/tests/test_sync_branches.py
@@ -43,7 +43,7 @@ class BranchSyncProcessMatches(MatchesListwise):
                             "rsync",
                             "-a",
                             "--delete-after",
-                            "bazaar.launchpad.net::mirrors/%s/" % branch_path,
+                            "bazaar.lp.internal::mirrors/%s/" % branch_path,
                             "%s/"
                             % os.path.join(
                                 config.codehosting.mirrored_branches_root,
@@ -161,7 +161,7 @@ class TestSyncBranches(TestCaseWithFactory):
             LaunchpadScriptFailure,
             "There was an error running: "
             "rsync -a --delete-after "
-            "bazaar.launchpad.net::mirrors/{}/ {}/{}/\n"
+            "bazaar.lp.internal::mirrors/{}/ {}/{}/\n"
             "Status: 1\n"
             "Output: rsync exploded".format(
                 branch_id_to_path(branch.id),
diff --git a/lib/lp/services/config/schema-lazr.conf b/lib/lp/services/config/schema-lazr.conf
index ce448cf..ac68bd4 100644
--- a/lib/lp/services/config/schema-lazr.conf
+++ b/lib/lp/services/config/schema-lazr.conf
@@ -362,6 +362,11 @@ host_key_pair_path: none
 # called the 'mirrored area'.
 mirrored_branches_root: /var/tmp/bazaar.launchpad.test/mirrors
 
+# datatype: string
+# rsync host::module that scripts/sync-branches.py should use to sync
+# branches from production to a staging environment.
+sync_branches_source: bazaar.lp.internal::mirrors
+
 # datatype: boolean
 spew: False