Merge ~pappacena/txpkgupload:dtp-timeout-config into txpkgupload:master

Proposed by Thiago F. Pappacena
Status: Rejected
Rejected by: Thiago F. Pappacena
Proposed branch: ~pappacena/txpkgupload:dtp-timeout-config
Merge into: txpkgupload:master
Diff against target: 104 lines (+22/-4)
4 files modified
etc/txpkgupload.yaml (+3/-0)
src/txpkgupload/plugin.py (+5/-1)
src/txpkgupload/tests/test_plugin.py (+9/-0)
src/txpkgupload/twistedftp.py (+5/-3)
Reviewer Review Type Date Requested Status
William Grant Disapprove
Review via email: mp+393503@code.launchpad.net

Commit message

Adding config parameter for dtp timeout

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) wrote :

If something can't connect within 10 seconds, I'm not sure we care. That's almost always going to be a firewall problem -- even the Moon is only a 3s round trip.

review: Disapprove
Revision history for this message
Thiago F. Pappacena (pappacena) wrote :

The idea was not to have this timeout increased in production, but rather to let a sys admin do, in production, the test they needed to do.

Anyway, I'm closing this MP.

Unmerged commits

6daa850... by Thiago F. Pappacena

Adding config parameter for dtp timeout

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/etc/txpkgupload.yaml b/etc/txpkgupload.yaml
index 45f7a99..ae94b52 100644
--- a/etc/txpkgupload.yaml
+++ b/etc/txpkgupload.yaml
@@ -40,6 +40,9 @@ oops:
40## disconnected.40## disconnected.
41# idle_timeout: 360041# idle_timeout: 3600
4242
43## DTP connection timeout for FTP connections (defaults to 10).
44dtp_timeout: 15
45
43## Where on the filesystem do uploads live?46## Where on the filesystem do uploads live?
44# fsroot: "/var/tmp/txpkgupload/incoming"47# fsroot: "/var/tmp/txpkgupload/incoming"
4548
diff --git a/src/txpkgupload/plugin.py b/src/txpkgupload/plugin.py
index 0168643..c93933e 100644
--- a/src/txpkgupload/plugin.py
+++ b/src/txpkgupload/plugin.py
@@ -123,6 +123,9 @@ class Config(Schema):
123 # disconnected.123 # disconnected.
124 idle_timeout = Int(if_missing=3600)124 idle_timeout = Int(if_missing=3600)
125125
126 # DTP timeout for FTP connections.
127 dtp_timeout = Int(if_missing=10)
128
126 # Where on the filesystem do uploads live?129 # Where on the filesystem do uploads live?
127 fsroot = String(if_missing=None)130 fsroot = String(if_missing=None)
128131
@@ -238,7 +241,8 @@ class PkgUploadServiceMaker:
238 port=ftp_config["port"],241 port=ftp_config["port"],
239 root=root,242 root=root,
240 temp_dir=temp_dir,243 temp_dir=temp_dir,
241 idle_timeout=config["idle_timeout"])244 idle_timeout=config["idle_timeout"],
245 dtp_timeout=config["dtp_timeout"])
242 ftp_service.name = "ftp"246 ftp_service.name = "ftp"
243 ftp_service.setServiceParent(services)247 ftp_service.setServiceParent(services)
244248
diff --git a/src/txpkgupload/tests/test_plugin.py b/src/txpkgupload/tests/test_plugin.py
index 162c289..9413fe8 100644
--- a/src/txpkgupload/tests/test_plugin.py
+++ b/src/txpkgupload/tests/test_plugin.py
@@ -111,6 +111,7 @@ class TestConfig(TestCase):
111 "port": 2121,111 "port": 2121,
112 },112 },
113 "idle_timeout": 3600,113 "idle_timeout": 3600,
114 "dtp_timeout": 10,
114 "oops": {115 "oops": {
115 "directory": "",116 "directory": "",
116 "reporter": "PKGUPLOAD",117 "reporter": "PKGUPLOAD",
@@ -164,6 +165,11 @@ class TestConfig(TestCase):
164 {"idle_timeout": "bob"},165 {"idle_timeout": "bob"},
165 "idle_timeout: Please enter an integer value")166 "idle_timeout: Please enter an integer value")
166167
168 def test_option_dtp_timeout_integer(self):
169 self.check_exception(
170 {"dtp_timeout": "bob"},
171 "dtp_timeout: Please enter an integer value")
172
167173
168class TestOptions(TestCase):174class TestOptions(TestCase):
169 """Tests for `txpkgupload.plugin.Options`."""175 """Tests for `txpkgupload.plugin.Options`."""
@@ -521,6 +527,9 @@ class TestPkgUploadServiceMakerMixin:
521 self.assertEqual(527 self.assertEqual(
522 len(service.namedServices), len(service.services),528 len(service.namedServices), len(service.services),
523 "Not all services are named.")529 "Not all services are named.")
530 # Make sure we are using the configurations from the config file.
531 ftp_service = service.services[0]
532 self.assertEqual(15, ftp_service.factory.protocol.dtpTimeout)
524533
525 def _uploadPath(self, path):534 def _uploadPath(self, path):
526 """Return system path of specified path inside an upload.535 """Return system path of specified path inside an upload.
diff --git a/src/txpkgupload/twistedftp.py b/src/txpkgupload/twistedftp.py
index 37deffb..8e58b32 100644
--- a/src/txpkgupload/twistedftp.py
+++ b/src/txpkgupload/twistedftp.py
@@ -360,7 +360,7 @@ class FTPWithEPSV(ftp.FTP):
360class FTPServiceFactory(service.Service):360class FTPServiceFactory(service.Service):
361 """A factory that makes an `FTPService`"""361 """A factory that makes an `FTPService`"""
362362
363 def __init__(self, port, root, temp_dir, idle_timeout):363 def __init__(self, port, root, temp_dir, idle_timeout, dtp_timeout):
364 realm = FTPRealm(root, temp_dir)364 realm = FTPRealm(root, temp_dir)
365 portal = Portal(realm)365 portal = Portal(realm)
366 portal.registerChecker(AccessCheck())366 portal.registerChecker(AccessCheck())
@@ -368,6 +368,7 @@ class FTPServiceFactory(service.Service):
368368
369 factory.tld = root369 factory.tld = root
370 factory.protocol = FTPWithEPSV370 factory.protocol = FTPWithEPSV
371 factory.protocol.dtpTimeout = dtp_timeout
371 factory.welcomeMessage = "Launchpad upload server"372 factory.welcomeMessage = "Launchpad upload server"
372 factory.timeOut = idle_timeout373 factory.timeOut = idle_timeout
373374
@@ -375,7 +376,8 @@ class FTPServiceFactory(service.Service):
375 self.portno = port376 self.portno = port
376377
377 @staticmethod378 @staticmethod
378 def makeFTPService(port, root, temp_dir, idle_timeout):379 def makeFTPService(port, root, temp_dir, idle_timeout, dtp_timeout):
379 strport = "tcp6:%s" % port380 strport = "tcp6:%s" % port
380 factory = FTPServiceFactory(port, root, temp_dir, idle_timeout)381 factory = FTPServiceFactory(
382 port, root, temp_dir, idle_timeout, dtp_timeout)
381 return strports.service(strport, factory.ftpfactory)383 return strports.service(strport, factory.ftpfactory)

Subscribers

People subscribed via source and target branches