Merge lp:~nataliabidart/magicicada-server/clean-deps-for-stable into lp:magicicada-server

Proposed by Natalia Bidart
Status: Merged
Approved by: Natalia Bidart
Approved revision: 83
Merged at revision: 82
Proposed branch: lp:~nataliabidart/magicicada-server/clean-deps-for-stable
Merge into: lp:magicicada-server
Diff against target: 864 lines (+123/-189)
24 files modified
Makefile (+10/-12)
README.rst (+1/-1)
config-manager.txt (+0/-4)
dependencies-devel.txt (+1/-0)
dependencies.txt (+0/-2)
dev-scripts/cmd_client.py (+1/-1)
dev-scripts/deploy_api_server.py (+1/-1)
dev-scripts/dev_launcher.py (+1/-1)
dev-scripts/supervisor-dev.conf.tpl (+2/-14)
magicicada/rpcdb/tests/test_backend.py (+1/-1)
magicicada/server/content.py (+3/-3)
magicicada/server/integration/run_integtests.py (+1/-6)
magicicada/server/server.py (+14/-15)
magicicada/server/ssl_proxy.py (+9/-9)
magicicada/server/testing/aq_helpers.py (+2/-2)
magicicada/server/testing/testcase.py (+4/-4)
magicicada/server/tests/test_auth.py (+4/-4)
magicicada/server/tests/test_content.py (+13/-13)
magicicada/server/tests/test_generations.py (+3/-3)
magicicada/server/tests/test_server.py (+5/-5)
magicicada/server/tests/test_ssl_proxy.py (+4/-4)
magicicada/settings/__init__.py (+43/-2)
magicicada/settings/api_server.py (+0/-58)
magicicada/settings/ssl_proxy.py (+0/-24)
To merge this branch: bzr merge lp:~nataliabidart/magicicada-server/clean-deps-for-stable
Reviewer Review Type Date Requested Status
Facundo Batista Approve
Review via email: mp+322999@code.launchpad.net

Commit message

- Unified settings into a single file.
- Removed uneeded dependencies.
- Removed every outdated reference to "oauth".

To post a comment you must log in.
83. By Natalia Bidart

Missing replacement.

Revision history for this message
Facundo Batista (facundo) wrote :

Awesome, thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'Makefile'
--- Makefile 2016-10-01 12:48:16 +0000
+++ Makefile 2017-04-22 22:01:02 +0000
@@ -128,14 +128,12 @@
128version:128version:
129 bzr version-info --format=python > lib/versioninfo.py || true129 bzr version-info --format=python > lib/versioninfo.py || true
130130
131start: build start-base start-filesync-dummy-group publish-api-port131start: build start-base start-filesync-server-group publish-api-port
132132
133start-oauth: build start-base start-filesync-oauth-group publish-api-port133resume: start-base start-filesync-server-group
134134
135resume: start-base start-filesync-oauth-group135start-heapy:
136136 USE_HEAPY=1 $(MAKE) start
137start-oauth-heapy:
138 USE_HEAPY=1 $(MAKE) start-oauth
139137
140start-base:138start-base:
141 $(MAKE) start-supervisor && $(MAKE) start-dbus || ( $(MAKE) stop ; exit 1 )139 $(MAKE) start-supervisor && $(MAKE) start-dbus || ( $(MAKE) stop ; exit 1 )
@@ -168,9 +166,9 @@
168 -@dev-scripts/supervisorctl-dev stop $*166 -@dev-scripts/supervisorctl-dev stop $*
169167
170publish-api-port:168publish-api-port:
171 python -c 'from magicicada import settings; print >> file("tmp/filesyncserver.port", "w"), settings.api_server.TCP_PORT'169 python -c 'from magicicada import settings; print >> file("tmp/filesyncserver.port", "w"), settings.TCP_PORT'
172 python -c 'from magicicada import settings; print >> file("tmp/filesyncserver.port.ssl", "w"), settings.ssl_proxy.PORT'170 python -c 'from magicicada import settings; print >> file("tmp/filesyncserver.port.ssl", "w"), settings.SSL_PORT'
173 python -c 'from magicicada import settings; print >> file("tmp/filesyncserver-status.port", "w"), settings.api_server.STATUS_PORT'171 python -c 'from magicicada import settings; print >> file("tmp/filesyncserver-status.port", "w"), settings.API_STATUS_PORT'
174172
175shell:173shell:
176 $(DJANGO_MANAGE) shell174 $(DJANGO_MANAGE) shell
@@ -184,4 +182,4 @@
184.PHONY: sourcedeps link-sourcedeps build-sourcedeps build-deploy-sourcedeps \182.PHONY: sourcedeps link-sourcedeps build-sourcedeps build-deploy-sourcedeps \
185 build clean version lint test ci-test build-for-deployment \183 build clean version lint test ci-test build-for-deployment \
186 clean-sourcedeps tarball start stop publish-api-port start-supervisor \184 clean-sourcedeps tarball start stop publish-api-port start-supervisor \
187 stop-supervisor start-dbus stop-dbus start-oauth start-oauth-heapy185 stop-supervisor start-dbus stop-dbus start-heapy
188186
=== modified file 'README.rst'
--- README.rst 2017-02-25 15:29:01 +0000
+++ README.rst 2017-04-22 22:01:02 +0000
@@ -139,7 +139,7 @@
139Start the server via command line this way::139Start the server via command line this way::
140140
141 cd ~/magicicada/magicicada-server141 cd ~/magicicada/magicicada-server
142 make start-oauth142 make start
143143
144Note that the server will listen on port 21101, so you need to assure that the144Note that the server will listen on port 21101, so you need to assure that the
145client could reach it (open the whole it in your firewall config, etc).145client could reach it (open the whole it in your firewall config, etc).
146146
=== modified file 'config-manager.txt'
--- config-manager.txt 2016-12-27 21:57:00 +0000
+++ config-manager.txt 2017-04-22 22:01:02 +0000
@@ -24,10 +24,6 @@
24./.sourcecode/configglue ~configglue/configglue/trunk;revno=124./.sourcecode/configglue ~configglue/configglue/trunk;revno=1
25./.sourcecode/dirspec ~ubuntuone-control-tower/dirspec/trunk;revno=1425./.sourcecode/dirspec ~ubuntuone-control-tower/dirspec/trunk;revno=14
26./.sourcecode/django ~ubuntuone-pqm-team/django/stable;revno=1726./.sourcecode/django ~ubuntuone-pqm-team/django/stable;revno=17
27./.sourcecode/mock ~ubuntuone-pqm-team/python-mock/stable;revno=1
28./.sourcecode/oauthlib ~ubuntuone-pqm-team/oauthlib/stable;revno=209
29./.sourcecode/requests ~ubuntuone-pqm-team/requests/stable;revno=816
30./.sourcecode/requests_oauthlib ~ubuntuone-pqm-team/requests-oauthlib/stable;revno=16
31./.sourcecode/u1sync ~facundo/u1sync/opensourcing;revno=1027./.sourcecode/u1sync ~facundo/u1sync/opensourcing;revno=10
32./.sourcecode/magicicada-client ~chicharreros/magicicada-client/trunk;revno=143328./.sourcecode/magicicada-client ~chicharreros/magicicada-client/trunk;revno=1433
33./.sourcecode/magicicada-protocol ~chicharreros/magicicada-protocol/trunk;revno=16929./.sourcecode/magicicada-protocol ~chicharreros/magicicada-protocol/trunk;revno=169
3430
=== modified file 'dependencies-devel.txt'
--- dependencies-devel.txt 2016-09-15 13:46:24 +0000
+++ dependencies-devel.txt 2017-04-22 22:01:02 +0000
@@ -4,6 +4,7 @@
4python-dbus4python-dbus
5python-gobject5python-gobject
6python-httplib26python-httplib2
7python-mock
7python-mocker8python-mocker
8python-pyinotify9python-pyinotify
9python-testtools10python-testtools
1011
=== modified file 'dependencies.txt'
--- dependencies.txt 2016-02-20 17:42:06 +0000
+++ dependencies.txt 2017-04-22 22:01:02 +0000
@@ -15,8 +15,6 @@
15python-psutil15python-psutil
16python-psycopg216python-psycopg2
17python-setuptools17python-setuptools
18python-testresources
19python-transaction
20python-twisted-web18python-twisted-web
21python-tz19python-tz
22python-virtualenv20python-virtualenv
2321
=== modified file 'dev-scripts/cmd_client.py'
--- dev-scripts/cmd_client.py 2015-09-17 19:30:41 +0000
+++ dev-scripts/cmd_client.py 2017-04-22 22:01:02 +0000
@@ -719,7 +719,7 @@
719 @parse_args(str, str)719 @parse_args(str, str)
720 @require_connection720 @require_connection
721 @show_exception721 @show_exception
722 def do_oauth(self):722 def do_auth(self):
723 """Perform authorisation."""723 """Perform authorisation."""
724 self.defer_from_thread(self._auth)724 self.defer_from_thread(self._auth)
725725
726726
=== modified file 'dev-scripts/deploy_api_server.py'
--- dev-scripts/deploy_api_server.py 2016-05-29 21:20:25 +0000
+++ dev-scripts/deploy_api_server.py 2017-04-22 22:01:02 +0000
@@ -55,7 +55,7 @@
55 """Start the server."""55 """Start the server."""
5656
57 status_port = int(57 status_port = int(
58 os.getenv('API_STATUS_PORT', settings.api_server.STATUS_PORT))58 os.getenv('API_STATUS_PORT', settings.STATUS_PORT))
59 service = server.create_service(status_port)59 service = server.create_service(status_port)
6060
61 yield service.startService()61 yield service.startService()
6262
=== modified file 'dev-scripts/dev_launcher.py'
--- dev-scripts/dev_launcher.py 2015-09-17 19:30:41 +0000
+++ dev-scripts/dev_launcher.py 2017-04-22 22:01:02 +0000
@@ -37,7 +37,7 @@
37 "runs PROGNAME with args plus:\n"37 "runs PROGNAME with args plus:\n"
38 " --port with the local server port\n"38 " --port with the local server port\n"
39 " --host localhost\n"39 " --host localhost\n"
40 " --oauth keys for user USERNAME\n")40 " --auth username and password for user USERNAME\n")
4141
4242
43def main(args):43def main(args):
4444
=== modified file 'dev-scripts/supervisor-dev.conf.tpl'
--- dev-scripts/supervisor-dev.conf.tpl 2016-06-03 00:35:53 +0000
+++ dev-scripts/supervisor-dev.conf.tpl 2017-04-22 22:01:02 +0000
@@ -24,7 +24,7 @@
24files=services-supervisor.conf workers-supervisor.conf24files=services-supervisor.conf workers-supervisor.conf
2525
26[eventlistener:heartbeat]26[eventlistener:heartbeat]
27command=python %(basepath)s/lib/ubuntuone/supervisor/heartbeat_listener.py --interval=10 --timeout=20 --log_level=DEBUG --log_file=%(tmp_dir)s/heartbeat.log --groups=filesync-dummy,filesync-oauth27command=python %(basepath)s/lib/ubuntuone/supervisor/heartbeat_listener.py --interval=10 --timeout=20 --log_level=DEBUG --log_file=%(tmp_dir)s/heartbeat.log --groups=filesync-server
28environment=PYTHONPATH="%(basepath)s:%(basepath)s/lib"28environment=PYTHONPATH="%(basepath)s:%(basepath)s/lib"
29events=PROCESS_COMMUNICATION,TICK_529events=PROCESS_COMMUNICATION,TICK_5
30buffer_size=4230buffer_size=42
@@ -36,15 +36,6 @@
36autostart=false36autostart=false
37stopsignal=INT37stopsignal=INT
3838
39[program:filesync-dummy-auth]
40command=python %(basepath)s/dev-scripts/deploy_api_server.py
41environment=PYTHONPATH="%(basepath)s:%(basepath)s/lib",DJANGO_SETTINGS_MODULE="magicicada.settings",PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp
42stdout_capture_maxbytes=16384
43autostart=false
44redirect_stderr=true ; send stderr to the log file
45stdout_logfile=%(tmp_dir)s/filesync.log
46stdout_logfile_maxbytes=0
47
48[program:ssl-proxy]39[program:ssl-proxy]
49command=/usr/bin/twistd --pidfile %(tmp_dir)s/ssl-proxy.pid -n -y %(basepath)s/magicicada/server/ssl_proxy.tac --reactor=epoll40command=/usr/bin/twistd --pidfile %(tmp_dir)s/ssl-proxy.pid -n -y %(basepath)s/magicicada/server/ssl_proxy.tac --reactor=epoll
50environment=PYTHONPATH="%(basepath)s:%(basepath)s/lib",DJANGO_SETTINGS_MODULE="magicicada.settings"41environment=PYTHONPATH="%(basepath)s:%(basepath)s/lib",DJANGO_SETTINGS_MODULE="magicicada.settings"
@@ -52,8 +43,5 @@
52autostart=false43autostart=false
53stopsignal=INT44stopsignal=INT
5445
55[group:filesync-dummy]46[group:filesync-server]
56programs=filesync-dummy-auth
57
58[group:filesync-oauth]
59programs=filesync,ssl-proxy47programs=filesync,ssl-proxy
6048
=== modified file 'magicicada/rpcdb/tests/test_backend.py'
--- magicicada/rpcdb/tests/test_backend.py 2016-11-07 01:37:46 +0000
+++ magicicada/rpcdb/tests/test_backend.py 2017-04-22 22:01:02 +0000
@@ -57,7 +57,7 @@
57 self.assertEqual(result, dict(user_id=self.usr.id))57 self.assertEqual(result, dict(user_id=self.usr.id))
5858
59 def test_get_user_id_bad_auth(self):59 def test_get_user_id_bad_auth(self):
60 """Bad parameters in the oauth request."""60 """Bad parameters in the auth request."""
61 bad_parameters = self.auth_parameters.copy()61 bad_parameters = self.auth_parameters.copy()
62 bad_parameters['password'] = "bad"62 bad_parameters['password'] = "bad"
63 try:63 try:
6464
=== modified file 'magicicada/server/content.py'
--- magicicada/server/content.py 2016-11-07 01:37:46 +0000
+++ magicicada/server/content.py 2017-04-22 22:01:02 +0000
@@ -190,8 +190,8 @@
190 def add_part(self, chunk_size):190 def add_part(self, chunk_size):
191 """Add a part to an upload job."""191 """Add a part to an upload job."""
192 self.unsaved_count += chunk_size192 self.unsaved_count += chunk_size
193 if self.unsaved_count >= settings.api_server.STORAGE_CHUNK_SIZE:193 if self.unsaved_count >= settings.STORAGE_CHUNK_SIZE:
194 self.unsaved_count -= settings.api_server.STORAGE_CHUNK_SIZE194 self.unsaved_count -= settings.STORAGE_CHUNK_SIZE
195 kwargs = dict(user_id=self.user.id, volume_id=self.volume_id,195 kwargs = dict(user_id=self.user.id, volume_id=self.volume_id,
196 uploadjob_id=self.uploadjob_id,196 uploadjob_id=self.uploadjob_id,
197 chunk_size=chunk_size)197 chunk_size=chunk_size)
@@ -870,7 +870,7 @@
870 if upload is None:870 if upload is None:
871 # no uploadjob found, create a new one: if the file is small just871 # no uploadjob found, create a new one: if the file is small just
872 # get a bo872 # get a bo
873 if deflated_size <= settings.api_server.STORAGE_CHUNK_SIZE:873 if deflated_size <= settings.STORAGE_CHUNK_SIZE:
874 upload = BogusUploadJob()874 upload = BogusUploadJob()
875 else:875 else:
876 try:876 try:
877877
=== modified file 'magicicada/server/integration/run_integtests.py'
--- magicicada/server/integration/run_integtests.py 2016-08-30 00:50:31 +0000
+++ magicicada/server/integration/run_integtests.py 2017-04-22 22:01:02 +0000
@@ -48,11 +48,6 @@
48dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)48dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
4949
50LIB_DIR = os.path.abspath("lib")50LIB_DIR = os.path.abspath("lib")
51
52# this should be done manually before:
53DEP_STARTOAUTH = """
54make start-oauth
55"""
56CLIENT_DIR = os.path.abspath(os.path.join('.sourcecode', 'magicicada-client'))51CLIENT_DIR = os.path.abspath(os.path.join('.sourcecode', 'magicicada-client'))
57PROTOCOL_DIR = os.path.abspath(52PROTOCOL_DIR = os.path.abspath(
58 os.path.join('.sourcecode', 'magicicada-protocol'))53 os.path.join('.sourcecode', 'magicicada-protocol'))
@@ -101,7 +96,7 @@
101 """96 """
102 couchdb_port = os.path.join(TMP_DIR, "couchdb-master0.port")97 couchdb_port = os.path.join(TMP_DIR, "couchdb-master0.port")
103 if not os.path.exists(couchdb_port):98 if not os.path.exists(couchdb_port):
104 print "Not ready! Hint: did you do...?:\n" + DEP_STARTOAUTH99 print "Not ready! Hint: did you run...?:\nmake start"
105 return True100 return True
106101
107 log_conf = os.path.join(CLIENT_DIR, "data", "logging.conf")102 log_conf = os.path.join(CLIENT_DIR, "data", "logging.conf")
108103
=== modified file 'magicicada/server/server.py'
--- magicicada/server/server.py 2016-11-07 01:37:46 +0000
+++ magicicada/server/server.py 2017-04-22 22:01:02 +0000
@@ -285,8 +285,7 @@
285 self.pending_requests = collections.deque()285 self.pending_requests = collections.deque()
286 self.ping_loop = LoopingPing(StorageServer.PING_INTERVAL,286 self.ping_loop = LoopingPing(StorageServer.PING_INTERVAL,
287 StorageServer.PING_TIMEOUT,287 StorageServer.PING_TIMEOUT,
288 settings.api_server.IDLE_TIMEOUT,288 settings.IDLE_TIMEOUT, self)
289 self)
290289
291 # capabilities that the server is working with290 # capabilities that the server is working with
292 self.working_caps = MIN_CAP291 self.working_caps = MIN_CAP
@@ -624,7 +623,7 @@
624623
625 def __init__(self, protocol, message):624 def __init__(self, protocol, message):
626 """Create the request response."""625 """Create the request response."""
627 self.use_protocol_weakref = settings.api_server.PROTOCOL_WEAKREF626 self.use_protocol_weakref = settings.PROTOCOL_WEAKREF
628 self._protocol_ref = None627 self._protocol_ref = None
629 super(BaseRequestResponse, self).__init__(protocol, message)628 super(BaseRequestResponse, self).__init__(protocol, message)
630629
@@ -1841,7 +1840,7 @@
1841 def _get_upload_job(self):1840 def _get_upload_job(self):
1842 """Get the uploadjob."""1841 """Get the uploadjob."""
1843 share_id = self.convert_share_id(self.source_message.put_content.share)1842 share_id = self.convert_share_id(self.source_message.put_content.share)
1844 if settings.api_server.MAGIC_UPLOAD_ACTIVE:1843 if settings.MAGIC_UPLOAD_ACTIVE:
1845 magic_hash = self.source_message.put_content.magic_hash or None1844 magic_hash = self.source_message.put_content.magic_hash or None
1846 else:1845 else:
1847 magic_hash = None1846 magic_hash = None
@@ -1907,7 +1906,7 @@
1907 msg = self.source_message1906 msg = self.source_message
1908 share_id = self.convert_share_id(msg.get_delta.share)1907 share_id = self.convert_share_id(msg.get_delta.share)
1909 from_generation = msg.get_delta.from_generation1908 from_generation = msg.get_delta.from_generation
1910 delta_max_size = settings.api_server.DELTA_MAX_SIZE1909 delta_max_size = settings.DELTA_MAX_SIZE
1911 delta_info = yield self.protocol.user.get_delta(1910 delta_info = yield self.protocol.user.get_delta(
1912 share_id, from_generation, limit=delta_max_size)1911 share_id, from_generation, limit=delta_max_size)
1913 nodes, vol_generation, free_bytes = delta_info1912 nodes, vol_generation, free_bytes = delta_info
@@ -1942,7 +1941,7 @@
1942 """Build and send the DELTA_INFO for each node."""1941 """Build and send the DELTA_INFO for each node."""
1943 count = 01942 count = 0
1944 for node in nodes:1943 for node in nodes:
1945 if count == settings.api_server.MAX_DELTA_INFO:1944 if count == settings.MAX_DELTA_INFO:
1946 count = 01945 count = 0
1947 yield1946 yield
1948 message = protocol_pb2.Message()1947 message = protocol_pb2.Message()
@@ -1983,7 +1982,7 @@
1983 def _process(self):1982 def _process(self):
1984 """Get all the live nodes and send DeltaInfos."""1983 """Get all the live nodes and send DeltaInfos."""
1985 msg = self.source_message1984 msg = self.source_message
1986 limit = settings.api_server.GET_FROM_SCRATCH_LIMIT1985 limit = settings.GET_FROM_SCRATCH_LIMIT
1987 share_id = self.convert_share_id(msg.get_delta.share)1986 share_id = self.convert_share_id(msg.get_delta.share)
1988 # get the first chunk1987 # get the first chunk
1989 delta_info = yield self.protocol.user.get_from_scratch(1988 delta_info = yield self.protocol.user.get_from_scratch(
@@ -2333,7 +2332,7 @@
2333 @cvar protocol: The class of the server.2332 @cvar protocol: The class of the server.
2334 """2333 """
2335 protocol = StorageServer2334 protocol = StorageServer
2336 graceful_shutdown = settings.api_server.GRACEFUL_SHUTDOWN2335 graceful_shutdown = settings.GRACEFUL_SHUTDOWN
23372336
2338 def __init__(self, auth_provider_class=auth.DummyAuthProvider,2337 def __init__(self, auth_provider_class=auth.DummyAuthProvider,
2339 content_class=content.ContentManager,2338 content_class=content.ContentManager,
@@ -2341,7 +2340,7 @@
2341 """Create a StorageServerFactory."""2340 """Create a StorageServerFactory."""
2342 self.auth_provider = auth_provider_class(self)2341 self.auth_provider = auth_provider_class(self)
2343 self.content = content_class(self)2342 self.content = content_class(self)
2344 self.diskstorage = DiskStorage(settings.api_server.STORAGE_BASEDIR)2343 self.diskstorage = DiskStorage(settings.STORAGE_BASEDIR)
23452344
2346 self.metrics = metrics.get_meter('root')2345 self.metrics = metrics.get_meter('root')
2347 self.user_metrics = metrics.get_meter('user')2346 self.user_metrics = metrics.get_meter('user')
@@ -2377,7 +2376,7 @@
23772376
2378 self.protocols = []2377 self.protocols = []
2379 self.reactor = reactor2378 self.reactor = reactor
2380 self.trace_users = set(settings.api_server.TRACE_USERS)2379 self.trace_users = set(settings.TRACE_USERS)
23812380
2382 twisted.python.log.addObserver(self._deferror_handler)2381 twisted.python.log.addObserver(self._deferror_handler)
23832382
@@ -2631,10 +2630,10 @@
2631 OrderedMultiService.__init__(self)2630 OrderedMultiService.__init__(self)
2632 self.heartbeat_writer = None2631 self.heartbeat_writer = None
2633 if heartbeat_interval is None:2632 if heartbeat_interval is None:
2634 heartbeat_interval = float(settings.api_server.HEARTBEAT_INTERVAL)2633 heartbeat_interval = float(settings.HEARTBEAT_INTERVAL)
2635 self.heartbeat_interval = heartbeat_interval2634 self.heartbeat_interval = heartbeat_interval
2636 self.rpc_dal = None2635 self.rpc_dal = None
2637 self.servername = settings.api_server.SERVERNAME2636 self.servername = settings.API_SERVER_NAME
2638 logger.info('Starting %s', self.servername)2637 logger.info('Starting %s', self.servername)
2639 logger.info(2638 logger.info(
2640 'protocol buffers implementation: %s',2639 'protocol buffers implementation: %s',
@@ -2726,15 +2725,15 @@
2726 logger.debug('activated heapy remote monitor')2725 logger.debug('activated heapy remote monitor')
27272726
2728 # set GC's debug2727 # set GC's debug
2729 if settings.api_server.GC_DEBUG:2728 if settings.GC_DEBUG:
2730 import gc2729 import gc
2731 gc.set_debug(gc.DEBUG_UNCOLLECTABLE)2730 gc.set_debug(gc.DEBUG_UNCOLLECTABLE)
2732 logger.debug('set gc debug on')2731 logger.debug('set gc debug on')
27332732
2734 if status_port is None:2733 if status_port is None:
2735 status_port = settings.api_server.STATUS_PORT2734 status_port = settings.API_STATUS_PORT
27362735
2737 # create the service2736 # create the service
2738 service = StorageServerService(2737 service = StorageServerService(
2739 settings.api_server.TCP_PORT, auth_provider_class, status_port)2738 settings.TCP_PORT, auth_provider_class, status_port)
2740 return service2739 return service
27412740
=== modified file 'magicicada/server/ssl_proxy.py'
--- magicicada/server/ssl_proxy.py 2016-08-08 01:14:41 +0000
+++ magicicada/server/ssl_proxy.py 2017-04-22 22:01:02 +0000
@@ -245,7 +245,7 @@
245 self.status_service = create_status_service(self.factory, status_port)245 self.status_service = create_status_service(self.factory, status_port)
246 self.status_service.setServiceParent(self)246 self.status_service.setServiceParent(self)
247 # disable ssl compression247 # disable ssl compression
248 if settings.ssl_proxy.DISABLE_SSL_COMPRESSION:248 if settings.DISABLE_SSL_COMPRESSION:
249 disable_ssl_compression(logger)249 disable_ssl_compression(logger)
250250
251 @property251 @property
@@ -265,7 +265,7 @@
265 # setup stats in the factory265 # setup stats in the factory
266 yield MultiService.startService(self)266 yield MultiService.startService(self)
267 # only start the HeartbeatWriter if the interval is > 0267 # only start the HeartbeatWriter if the interval is > 0
268 heartbeat_interval = float(settings.ssl_proxy.HEARTBEAT_INTERVAL)268 heartbeat_interval = float(settings.HEARTBEAT_INTERVAL)
269 if heartbeat_interval > 0:269 if heartbeat_interval > 0:
270 self.heartbeat_writer = stdio.StandardIO(270 self.heartbeat_writer = stdio.StandardIO(
271 supervisor_utils.HeartbeatWriter(heartbeat_interval, logger))271 supervisor_utils.HeartbeatWriter(heartbeat_interval, logger))
@@ -283,9 +283,9 @@
283283
284def create_service():284def create_service():
285 """Create the service instance."""285 """Create the service instance."""
286 server_key = settings.api_server.KEY286 server_key = settings.CRT_KEY
287 server_crt = settings.api_server.CRT287 server_crt = settings.CRT
288 server_crt_chain = settings.api_server.CRT_CHAIN288 server_crt_chain = settings.CRT_CHAIN
289289
290 ssl_cert = crypto.load_certificate(crypto.FILETYPE_PEM, server_crt)290 ssl_cert = crypto.load_certificate(crypto.FILETYPE_PEM, server_crt)
291 if server_crt_chain:291 if server_crt_chain:
@@ -296,11 +296,11 @@
296 ssl_key = crypto.load_privatekey(crypto.FILETYPE_PEM, server_key)296 ssl_key = crypto.load_privatekey(crypto.FILETYPE_PEM, server_key)
297297
298 ssl_proxy = ProxyService(ssl_cert, ssl_key, ssl_cert_chain,298 ssl_proxy = ProxyService(ssl_cert, ssl_key, ssl_cert_chain,
299 settings.ssl_proxy.PORT,299 settings.SSL_PORT,
300 '127.0.0.1',300 '127.0.0.1',
301 settings.api_server.TCP_PORT,301 settings.TCP_PORT,
302 settings.ssl_proxy.SERVER_NAME,302 settings.SSL_SERVER_NAME,
303 settings.ssl_proxy.STATUS_PORT)303 settings.SSL_STATUS_PORT)
304 return ssl_proxy304 return ssl_proxy
305305
306306
307307
=== modified file 'magicicada/server/testing/aq_helpers.py'
--- magicicada/server/testing/aq_helpers.py 2016-12-27 21:57:00 +0000
+++ magicicada/server/testing/aq_helpers.py 2017-04-22 22:01:02 +0000
@@ -332,8 +332,8 @@
332 0, # port332 0, # port
333 "localhost", self.port,333 "localhost", self.port,
334 "ssl-proxy-test", 0)334 "ssl-proxy-test", 0)
335 self.patch(settings.ssl_proxy, 'HEARTBEAT_INTERVAL',335 self.patch(
336 self.ssl_proxy_heartbeat_interval)336 settings, 'HEARTBEAT_INTERVAL', self.ssl_proxy_heartbeat_interval)
337 yield self.ssl_service.startService()337 yield self.ssl_service.startService()
338338
339 if os.path.exists(self.tmpdir):339 if os.path.exists(self.tmpdir):
340340
=== modified file 'magicicada/server/testing/testcase.py'
--- magicicada/server/testing/testcase.py 2016-12-27 21:57:00 +0000
+++ magicicada/server/testing/testcase.py 2017-04-22 22:01:02 +0000
@@ -43,9 +43,9 @@
43from magicicada.testing.testcase import BaseTestCase43from magicicada.testing.testcase import BaseTestCase
4444
45logger = logging.getLogger(__name__)45logger = logging.getLogger(__name__)
46server_key = settings.api_server.KEY46server_key = settings.CRT_KEY
47server_crt = settings.api_server.CRT47server_crt = settings.CRT
48server_crt_chain = settings.api_server.CRT_CHAIN48server_crt_chain = settings.CRT_CHAIN
4949
5050
51class FakeTimestampChecker(object):51class FakeTimestampChecker(object):
@@ -365,7 +365,7 @@
365 dummy_tokens[password] = user.id365 dummy_tokens[password] = user.id
366366
367 # tune the config for this tests367 # tune the config for this tests
368 self.patch(settings.api_server, 'STORAGE_CHUNK_SIZE', 1024 * 64)368 self.patch(settings, 'STORAGE_CHUNK_SIZE', 1024 * 64)
369369
370 def save_req(self, req, name):370 def save_req(self, req, name):
371 """Save a request for later use."""371 """Save a request for later use."""
372372
=== modified file 'magicicada/server/tests/test_auth.py'
--- magicicada/server/tests/test_auth.py 2016-06-08 21:04:35 +0000
+++ magicicada/server/tests/test_auth.py 2017-04-22 22:01:02 +0000
@@ -96,7 +96,7 @@
9696
97 @defer.inlineCallbacks97 @defer.inlineCallbacks
98 def test_authenticate(self):98 def test_authenticate(self):
99 """The OAuth provider succeeds with a valid PLAINTEXT signature."""99 """The Auth provider succeeds with a valid password."""
100 user = yield self.provider.authenticate(self.creds, None)100 user = yield self.provider.authenticate(self.creds, None)
101 self.assertEqual(user.id, self.usr0.id)101 self.assertEqual(user.id, self.usr0.id)
102102
@@ -106,7 +106,7 @@
106106
107 @defer.inlineCallbacks107 @defer.inlineCallbacks
108 def test_authenticate_failure(self):108 def test_authenticate_failure(self):
109 """The OAuth provider succeeds with an invalid PLAINTEXT signature."""109 """The Auth provider succeeds with an invalid password."""
110 auth_parameters = self.creds.copy()110 auth_parameters = self.creds.copy()
111 auth_parameters['password'] = 'invalid'111 auth_parameters['password'] = 'invalid'
112112
@@ -115,7 +115,7 @@
115115
116 @defer.inlineCallbacks116 @defer.inlineCallbacks
117 def test_authenticate_no_parameters(self):117 def test_authenticate_no_parameters(self):
118 """The OAuth provider fails with no parameters."""118 """The Auth provider fails with no parameters."""
119 user = yield self.provider.authenticate({}, None)119 user = yield self.provider.authenticate({}, None)
120 self.assertEqual(user, None)120 self.assertEqual(user, None)
121121
@@ -248,7 +248,7 @@
248248
249249
250class ClientSimpleAuthTests(ClientDummyAuthTests):250class ClientSimpleAuthTests(ClientDummyAuthTests):
251 """Client authentication tests using the OAuth provider."""251 """Client authentication tests using the Auth provider."""
252252
253 auth_provider_class = SimpleAuthProvider253 auth_provider_class = SimpleAuthProvider
254254
255255
=== modified file 'magicicada/server/tests/test_content.py'
--- magicicada/server/tests/test_content.py 2016-11-07 01:37:46 +0000
+++ magicicada/server/tests/test_content.py 2017-04-22 22:01:02 +0000
@@ -565,7 +565,7 @@
565565
566 def test_putcontent_cancel_middle(self):566 def test_putcontent_cancel_middle(self):
567 """Test putting content to a file and cancelling it in the middle."""567 """Test putting content to a file and cancelling it in the middle."""
568 size = int(settings.api_server.STORAGE_CHUNK_SIZE * 1.5)568 size = int(settings.STORAGE_CHUNK_SIZE * 1.5)
569 data = os.urandom(size)569 data = os.urandom(size)
570 deflated_data = zlib.compress(data)570 deflated_data = zlib.compress(data)
571 hash_object = content_hash_factory()571 hash_object = content_hash_factory()
@@ -1146,7 +1146,7 @@
1146 Test that a PutContent fails and is terminated as soon we get an1146 Test that a PutContent fails and is terminated as soon we get an
1147 error, instead of wait until the full upload is done.1147 error, instead of wait until the full upload is done.
1148 """1148 """
1149 chunk_size = settings.api_server.STORAGE_CHUNK_SIZE1149 chunk_size = settings.STORAGE_CHUNK_SIZE
1150 user, content_user = self._get_users(chunk_size ** 2)1150 user, content_user = self._get_users(chunk_size ** 2)
1151 # create the file1151 # create the file
1152 a_file = user.root.make_file(u"A new file")1152 a_file = user.root.make_file(u"A new file")
@@ -1596,7 +1596,7 @@
1596 self.handler = self.add_memento_handler(server.logger, level=0)1596 self.handler = self.add_memento_handler(server.logger, level=0)
1597 yield super(TestMultipartPutContent, self).setUp()1597 yield super(TestMultipartPutContent, self).setUp()
1598 # override defaults set by TestWithDatabase.setUp.1598 # override defaults set by TestWithDatabase.setUp.
1599 self.patch(settings.api_server, 'STORAGE_CHUNK_SIZE', 1024)1599 self.patch(settings, 'STORAGE_CHUNK_SIZE', 1024)
16001600
1601 def get_data(self, size):1601 def get_data(self, size):
1602 """Return random data of the specified size."""1602 """Return random data of the specified size."""
@@ -1650,7 +1650,7 @@
1650 @defer.inlineCallbacks1650 @defer.inlineCallbacks
1651 def test_resume_putcontent(self):1651 def test_resume_putcontent(self):
1652 """Test that the client can resume a putcontent request."""1652 """Test that the client can resume a putcontent request."""
1653 self.patch(settings.api_server, 'STORAGE_CHUNK_SIZE', 1024 * 64)1653 self.patch(settings, 'STORAGE_CHUNK_SIZE', 1024 * 64)
1654 size = 2 * 1024 * 5121654 size = 2 * 1024 * 512
1655 StorageUser.objects.filter(id=self.usr0.id).update(1655 StorageUser.objects.filter(id=self.usr0.id).update(
1656 max_storage_bytes=size * 2)1656 max_storage_bytes=size * 2)
@@ -1776,7 +1776,7 @@
17761776
1777 It receives a new upload_id.1777 It receives a new upload_id.
1778 """1778 """
1779 self.patch(settings.api_server, 'STORAGE_CHUNK_SIZE', 1024 * 32)1779 self.patch(settings, 'STORAGE_CHUNK_SIZE', 1024 * 32)
1780 size = 2 * 1024 * 1281780 size = 2 * 1024 * 128
1781 StorageUser.objects.filter(id=self.usr0.id).update(1781 StorageUser.objects.filter(id=self.usr0.id).update(
1782 max_storage_bytes=size * 2)1782 max_storage_bytes=size * 2)
@@ -1848,7 +1848,7 @@
18481848
1849 def test_putcontent_corrupt(self):1849 def test_putcontent_corrupt(self):
1850 """Put content on a file with corrupt data."""1850 """Put content on a file with corrupt data."""
1851 self.patch(settings.api_server, 'STORAGE_CHUNK_SIZE', 1024 * 64)1851 self.patch(settings, 'STORAGE_CHUNK_SIZE', 1024 * 64)
1852 size = 2 * 1024 * 5121852 size = 2 * 1024 * 512
1853 StorageUser.objects.filter(id=self.usr0.id).update(1853 StorageUser.objects.filter(id=self.usr0.id).update(
1854 max_storage_bytes=size * 2)1854 max_storage_bytes=size * 2)
@@ -1965,7 +1965,7 @@
1965 Test that a PutContent fails and is terminated as soon we get an1965 Test that a PutContent fails and is terminated as soon we get an
1966 error, instead of wait until the full upload is done.1966 error, instead of wait until the full upload is done.
1967 """1967 """
1968 chunk_size = settings.api_server.STORAGE_CHUNK_SIZE1968 chunk_size = settings.STORAGE_CHUNK_SIZE
1969 user = self.make_user(max_storage_bytes=chunk_size ** 2)1969 user = self.make_user(max_storage_bytes=chunk_size ** 2)
1970 content_user = User(1970 content_user = User(
1971 self.service.factory.content, user.id, user.root_volume_id,1971 self.service.factory.content, user.id, user.root_volume_id,
@@ -2079,11 +2079,11 @@
2079 """Setup the test."""2079 """Setup the test."""
2080 yield super(TestChunkedContent, self).setUp()2080 yield super(TestChunkedContent, self).setUp()
2081 # tune the config for this tests2081 # tune the config for this tests
2082 self.patch(settings.api_server, 'STORAGE_CHUNK_SIZE', 1024 * 1024)2082 self.patch(settings, 'STORAGE_CHUNK_SIZE', 1024 * 1024)
20832083
2084 def test_putcontent_chunked(self, put_fail=False, get_fail=False):2084 def test_putcontent_chunked(self, put_fail=False, get_fail=False):
2085 """Checks a chunked putcontent."""2085 """Checks a chunked putcontent."""
2086 size = int(settings.api_server.STORAGE_CHUNK_SIZE * 1.5)2086 size = int(settings.STORAGE_CHUNK_SIZE * 1.5)
2087 data = os.urandom(size)2087 data = os.urandom(size)
2088 deflated_data = zlib.compress(data)2088 deflated_data = zlib.compress(data)
2089 hash_object = content_hash_factory()2089 hash_object = content_hash_factory()
@@ -2162,7 +2162,7 @@
21622162
2163 def test_deferred_add_part_to_uj(self):2163 def test_deferred_add_part_to_uj(self):
2164 """Check that parts are added to upload job only after a limit."""2164 """Check that parts are added to upload job only after a limit."""
2165 size = int(settings.api_server.STORAGE_CHUNK_SIZE * 2.5)2165 size = int(settings.STORAGE_CHUNK_SIZE * 2.5)
2166 data = os.urandom(size)2166 data = os.urandom(size)
2167 deflated_data = zlib.compress(data)2167 deflated_data = zlib.compress(data)
2168 hash_object = content_hash_factory()2168 hash_object = content_hash_factory()
@@ -2344,7 +2344,7 @@
2344 def setUp(self):2344 def setUp(self):
2345 """Setup the test."""2345 """Setup the test."""
2346 yield super(TestUploadJob, self).setUp()2346 yield super(TestUploadJob, self).setUp()
2347 self.chunk_size = settings.api_server.STORAGE_CHUNK_SIZE2347 self.chunk_size = settings.STORAGE_CHUNK_SIZE
2348 self.half_size = self.chunk_size / 22348 self.half_size = self.chunk_size / 2
2349 self.double_size = self.chunk_size * 22349 self.double_size = self.chunk_size * 2
2350 self.user = self.make_user(max_storage_bytes=self.chunk_size ** 2)2350 self.user = self.make_user(max_storage_bytes=self.chunk_size ** 2)
@@ -2673,7 +2673,7 @@
2673 def setUp(self):2673 def setUp(self):
2674 """Setup the test."""2674 """Setup the test."""
2675 yield super(TestNode, self).setUp()2675 yield super(TestNode, self).setUp()
2676 self.chunk_size = settings.api_server.STORAGE_CHUNK_SIZE2676 self.chunk_size = settings.STORAGE_CHUNK_SIZE
2677 self.half_size = self.chunk_size / 22677 self.half_size = self.chunk_size / 2
2678 self.double_size = self.chunk_size * 22678 self.double_size = self.chunk_size * 2
2679 self.user = self.make_user(max_storage_bytes=self.chunk_size ** 2)2679 self.user = self.make_user(max_storage_bytes=self.chunk_size ** 2)
@@ -3073,7 +3073,7 @@
3073 def test_add_part(self):3073 def test_add_part(self):
3074 """Test add_part method."""3074 """Test add_part method."""
3075 dbuj = yield self._make_uj()3075 dbuj = yield self._make_uj()
3076 chunk_size = int(settings.api_server.STORAGE_CHUNK_SIZE) + 13076 chunk_size = int(settings.STORAGE_CHUNK_SIZE) + 1
3077 yield dbuj.add_part(chunk_size)3077 yield dbuj.add_part(chunk_size)
30783078
3079 # check it called rpc dal correctly3079 # check it called rpc dal correctly
30803080
=== modified file 'magicicada/server/tests/test_generations.py'
--- magicicada/server/tests/test_generations.py 2016-05-29 20:58:45 +0000
+++ magicicada/server/tests/test_generations.py 2017-04-22 22:01:02 +0000
@@ -139,7 +139,7 @@
139 yield client.dummy_authenticate("open sesame")139 yield client.dummy_authenticate("open sesame")
140 # create some nodes to get a delta140 # create some nodes to get a delta
141 limit = 10141 limit = 10
142 self.patch(server.settings.api_server, 'DELTA_MAX_SIZE', limit)142 self.patch(server.settings, 'DELTA_MAX_SIZE', limit)
143 for i in range(20):143 for i in range(20):
144 self.usr0.root.make_file(u"name%s" % i)144 self.usr0.root.make_file(u"name%s" % i)
145 req = yield client.get_delta(request.ROOT, 5)145 req = yield client.get_delta(request.ROOT, 5)
@@ -182,7 +182,7 @@
182 def auth(client):182 def auth(client):
183 yield client.dummy_authenticate("open sesame")183 yield client.dummy_authenticate("open sesame")
184 # create some nodes to get a delta184 # create some nodes to get a delta
185 self.patch(server.settings.api_server, 'MAX_DELTA_INFO', 5)185 self.patch(server.settings, 'MAX_DELTA_INFO', 5)
186 for i in range(20):186 for i in range(20):
187 self.usr0.root.make_file(u"name%s" % i)187 self.usr0.root.make_file(u"name%s" % i)
188 req = yield client.get_delta(request.ROOT, 5)188 req = yield client.get_delta(request.ROOT, 5)
@@ -248,7 +248,7 @@
248 def auth(client):248 def auth(client):
249 yield client.dummy_authenticate("open sesame")249 yield client.dummy_authenticate("open sesame")
250 # create some nodes to get a delta250 # create some nodes to get a delta
251 self.patch(server.settings.api_server, 'MAX_DELTA_INFO', 5)251 self.patch(server.settings, 'MAX_DELTA_INFO', 5)
252 for i in range(20):252 for i in range(20):
253 self.usr0.root.make_file(u"name%s" % i)253 self.usr0.root.make_file(u"name%s" % i)
254 req = yield client.get_delta(request.ROOT, 5)254 req = yield client.get_delta(request.ROOT, 5)
255255
=== modified file 'magicicada/server/tests/test_server.py'
--- magicicada/server/tests/test_server.py 2016-11-07 01:37:46 +0000
+++ magicicada/server/tests/test_server.py 2017-04-22 22:01:02 +0000
@@ -349,7 +349,7 @@
349349
350 def test_protocol_ref_enabled(self):350 def test_protocol_ref_enabled(self):
351 """Test that protocol weakref is disabled in tests."""351 """Test that protocol weakref is disabled in tests."""
352 self.patch(settings.api_server, 'PROTOCOL_WEAKREF', True)352 self.patch(settings, 'PROTOCOL_WEAKREF', True)
353 _server = StorageServer()353 _server = StorageServer()
354 response = StorageServerRequestResponse(354 response = StorageServerRequestResponse(
355 protocol=_server, message=self.make_protocol_message())355 protocol=_server, message=self.make_protocol_message())
@@ -358,7 +358,7 @@
358358
359 def test_protocol_ref_disabled(self):359 def test_protocol_ref_disabled(self):
360 """Test that protocol weakref is disabled in tests."""360 """Test that protocol weakref is disabled in tests."""
361 self.patch(settings.api_server, 'PROTOCOL_WEAKREF', False)361 self.patch(settings, 'PROTOCOL_WEAKREF', False)
362 _server = StorageServer()362 _server = StorageServer()
363 response = StorageServerRequestResponse(363 response = StorageServerRequestResponse(
364 protocol=_server, message=self.make_protocol_message())364 protocol=_server, message=self.make_protocol_message())
@@ -2340,7 +2340,7 @@
23402340
2341 def test_reset_send_delta_info_counter(self):2341 def test_reset_send_delta_info_counter(self):
2342 """Test that the count is reset on each iteration."""2342 """Test that the count is reset on each iteration."""
2343 self.patch(settings.api_server, 'MAX_DELTA_INFO', 5)2343 self.patch(settings, 'MAX_DELTA_INFO', 5)
2344 # create a few fake nodes2344 # create a few fake nodes
2345 nodes = []2345 nodes = []
2346 right_now = now()2346 right_now = now()
@@ -2415,7 +2415,7 @@
2415 @defer.inlineCallbacks2415 @defer.inlineCallbacks
2416 def test_chunked_get_from_scratch(self):2416 def test_chunked_get_from_scratch(self):
2417 """Get the nodes list in chunks."""2417 """Get the nodes list in chunks."""
2418 self.patch(settings.api_server, 'GET_FROM_SCRATCH_LIMIT', 5)2418 self.patch(settings, 'GET_FROM_SCRATCH_LIMIT', 5)
2419 # build fake nodes2419 # build fake nodes
2420 nodes = []2420 nodes = []
2421 right_now = now()2421 right_now = now()
@@ -2612,7 +2612,7 @@
2612 def test_trace_users(self):2612 def test_trace_users(self):
2613 """Check trace users are correctly set."""2613 """Check trace users are correctly set."""
2614 # set a specific config to test2614 # set a specific config to test
2615 self.patch(settings.api_server, 'TRACE_USERS', ['foo', 'bar', 'baz'])2615 self.patch(settings, 'TRACE_USERS', ['foo', 'bar', 'baz'])
2616 factory = StorageServerFactory()2616 factory = StorageServerFactory()
2617 self.assertEqual(factory.trace_users, set(['foo', 'bar', 'baz']))2617 self.assertEqual(factory.trace_users, set(['foo', 'bar', 'baz']))
26182618
26192619
=== modified file 'magicicada/server/tests/test_ssl_proxy.py'
--- magicicada/server/tests/test_ssl_proxy.py 2016-08-14 20:40:09 +0000
+++ magicicada/server/tests/test_ssl_proxy.py 2017-04-22 22:01:02 +0000
@@ -54,8 +54,8 @@
54 ssl_proxy.logger, level=logging.DEBUG)54 ssl_proxy.logger, level=logging.DEBUG)
55 self.metrics = MetricReceiver()55 self.metrics = MetricReceiver()
56 self.patch(metrics, 'get_meter', lambda n: self.metrics)56 self.patch(metrics, 'get_meter', lambda n: self.metrics)
57 self.patch(settings.ssl_proxy, 'HEARTBEAT_INTERVAL',57 self.patch(
58 self.ssl_proxy_heartbeat_interval)58 settings, 'HEARTBEAT_INTERVAL', self.ssl_proxy_heartbeat_interval)
5959
60 @defer.inlineCallbacks60 @defer.inlineCallbacks
61 def test_start_stop(self):61 def test_start_stop(self):
@@ -87,8 +87,8 @@
87 # keep metrics in our MetricReceiver87 # keep metrics in our MetricReceiver
88 self.metrics = MetricReceiver()88 self.metrics = MetricReceiver()
89 self.patch(metrics, 'get_meter', lambda n: self.metrics)89 self.patch(metrics, 'get_meter', lambda n: self.metrics)
90 self.patch(settings.ssl_proxy, 'HEARTBEAT_INTERVAL',90 self.patch(
91 self.ssl_proxy_heartbeat_interval)91 settings, 'HEARTBEAT_INTERVAL', self.ssl_proxy_heartbeat_interval)
92 yield self.ssl_service.startService()92 yield self.ssl_service.startService()
93 self.addCleanup(self.ssl_service.stopService)93 self.addCleanup(self.ssl_service.stopService)
9494
9595
=== modified file 'magicicada/settings/__init__.py'
--- magicicada/settings/__init__.py 2016-12-27 21:57:00 +0000
+++ magicicada/settings/__init__.py 2017-04-22 22:01:02 +0000
@@ -35,6 +35,18 @@
3535
36from psycopg2.extensions import ISOLATION_LEVEL_REPEATABLE_READ36from psycopg2.extensions import ISOLATION_LEVEL_REPEATABLE_READ
3737
38
39def get_file_content(folder, filename):
40 filepath = os.path.join(folder, filename)
41 if not os.path.exists(filepath):
42 filepath = os.path.join(folder, 'dev-' + filename)
43
44 with open(filepath) as f:
45 content = f.read()
46
47 return content
48
49
38BASE_DIR = os.path.dirname(50BASE_DIR = os.path.dirname(
39 os.path.dirname(os.path.dirname(os.path.abspath(__file__))))51 os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
4052
@@ -216,8 +228,37 @@
216SYSLOG_FORMAT = (228SYSLOG_FORMAT = (
217 '%(processName)-13s %(levelname)-8s %(name)s[%(process)d]: %(message)s')229 '%(processName)-13s %(levelname)-8s %(name)s[%(process)d]: %(message)s')
218230
219from . import api_server # noqa231
220from . import ssl_proxy # noqa232# Server settings
233
234API_SERVER_NAME = 'filesync-server'
235API_STATUS_PORT = 21102
236CERTS_FOLDER = os.path.join(BASE_DIR, 'certs')
237# the `crt` key with the content of `cacert.pem` file
238CRT = get_file_content(CERTS_FOLDER, 'cacert.pem')
239CRT_CHAIN = None
240# the `key` key with the content of `privkey.pem` file
241CRT_KEY = get_file_content(CERTS_FOLDER, 'privkey.pem')
242DELTA_MAX_SIZE = 1000
243DISABLE_SSL_COMPRESSION = True
244GC_DEBUG = False
245GET_FROM_SCRATCH_LIMIT = 2000
246GRACEFUL_SHUTDOWN = True
247HEARTBEAT_INTERVAL = 5
248IDLE_TIMEOUT = 7200
249MAGIC_UPLOAD_ACTIVE = True
250MAX_DELTA_INFO = 20
251PROTOCOL_WEAKREF = False
252SSL_LOG_FILENAME = 'ssl-proxy.log'
253SSL_PORT = 21101
254SSL_SERVER_NAME = 'ssl-proxy'
255SSL_STATUS_PORT = 21103
256STATS_LOG_INTERVAL = 0
257STORAGE_CHUNK_SIZE = 5242880
258TCP_PORT = 21100
259TRACE_USERS = ['test', 'etc']
260UPLOAD_BUFFER_MAX_SIZE = 10485761
261STORAGE_BASEDIR = os.path.join(BASE_DIR, 'tmp', 'filestorage')
221262
222263
223try:264try:
224265
=== removed file 'magicicada/settings/api_server.py'
--- magicicada/settings/api_server.py 2016-05-29 23:43:14 +0000
+++ magicicada/settings/api_server.py 1970-01-01 00:00:00 +0000
@@ -1,58 +0,0 @@
1# Copyright 2008-2015 Canonical
2# Copyright 2015 Chicharreros (https://launchpad.net/~chicharreros)
3#
4# This program is free software: you can redistribute it and/or modify
5# it under the terms of the GNU Affero General Public License as
6# published by the Free Software Foundation, either version 3 of the
7# License, or (at your option) any later version.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU Affero General Public License for more details.
13#
14# You should have received a copy of the GNU Affero General Public License
15# along with this program. If not, see <http://www.gnu.org/licenses/>.
16#
17# For further info, check http://launchpad.net/filesync-server
18
19import os
20from django.conf import settings
21
22
23def get_file_content(folder, filename):
24 filepath = os.path.join(folder, filename)
25 if not os.path.exists(filepath):
26 filepath = os.path.join(folder, 'dev-' + filename)
27
28 with open(filepath) as f:
29 content = f.read()
30
31 return content
32
33
34CERTS_FOLDER = os.path.join(settings.BASE_DIR, 'certs')
35# the `crt` key with the content of `cacert.pem` file
36CRT = get_file_content(CERTS_FOLDER, 'cacert.pem')
37CRT_CHAIN = None
38# the `key` key with the content of `privkey.pem` file
39KEY = get_file_content(CERTS_FOLDER, 'privkey.pem')
40DELTA_MAX_SIZE = 1000
41GC_DEBUG = True
42GET_FROM_SCRATCH_LIMIT = 2000
43GRACEFUL_SHUTDOWN = True
44HEARTBEAT_INTERVAL = 5
45IDLE_TIMEOUT = 7200
46MAGIC_UPLOAD_ACTIVE = True
47MAX_DELTA_INFO = 20
48METRICS_NAMESPACE = 'development.filesync.server'
49PROTOCOL_WEAKREF = False
50SERVERNAME = 'filesyncserver-development'
51SLI_METRIC_NAMESPACE = None
52STATS_LOG_INTERVAL = 0
53STATUS_PORT = 21102
54STORAGE_CHUNK_SIZE = 5242880
55TCP_PORT = 21100
56TRACE_USERS = ['test', 'etc']
57UPLOAD_BUFFER_MAX_SIZE = 10485761
58STORAGE_BASEDIR = os.path.join(settings.BASE_DIR, 'tmp', 'filestorage')
590
=== removed file 'magicicada/settings/ssl_proxy.py'
--- magicicada/settings/ssl_proxy.py 2016-05-31 22:59:18 +0000
+++ magicicada/settings/ssl_proxy.py 1970-01-01 00:00:00 +0000
@@ -1,24 +0,0 @@
1# Copyright 2008-2015 Canonical
2# Copyright 2015-2016 Chicharreros (https://launchpad.net/~chicharreros)
3#
4# This program is free software: you can redistribute it and/or modify
5# it under the terms of the GNU Affero General Public License as
6# published by the Free Software Foundation, either version 3 of the
7# License, or (at your option) any later version.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU Affero General Public License for more details.
13#
14# You should have received a copy of the GNU Affero General Public License
15# along with this program. If not, see <http://www.gnu.org/licenses/>.
16#
17# For further info, check http://launchpad.net/filesync-server
18
19DISABLE_SSL_COMPRESSION = True
20HEARTBEAT_INTERVAL = 5
21LOG_FILENAME = 'ssl-proxy.log'
22PORT = 21101
23SERVER_NAME = 'ssl-proxy-dev'
24STATUS_PORT = 21103

Subscribers

People subscribed via source and target branches

to all changes: