Merge lp:~nataliabidart/magicicada-server/use-venv-dependencies into lp:magicicada-server

Proposed by Natalia Bidart
Status: Merged
Approved by: Natalia Bidart
Approved revision: 92
Merged at revision: 86
Proposed branch: lp:~nataliabidart/magicicada-server/use-venv-dependencies
Merge into: lp:magicicada-server
Diff against target: 1048 lines (+186/-427)
29 files modified
.bzrignore (+1/-2)
.travis.yml (+7/-7)
Dockerfile (+15/-0)
Makefile (+48/-56)
README.rst (+0/-6)
config-manager.txt (+0/-4)
dependencies-devel.txt (+5/-10)
dependencies.txt (+1/-15)
dev-scripts/check_readme.sh (+0/-8)
dev-scripts/cmd_client.py (+2/-6)
dev-scripts/dev_launcher.py (+0/-87)
dev-scripts/sd_test.sh (+0/-29)
dev-scripts/start-dbus.sh (+0/-1)
dev-scripts/stop-dbus.sh (+1/-2)
dev-scripts/supervisor-config-dev.py (+57/-13)
dev-scripts/supervisor-dev.conf.tpl (+5/-5)
dev-scripts/supervisor_templates.py (+0/-65)
dev-scripts/supervisorctl-dev (+0/-6)
lib/ubuntuone/supervisor/config_helpers.py (+3/-1)
lib/ubuntuone/supervisor/heartbeat_listener.py (+1/-1)
lib/ubuntuone/supervisor/start-supervisord.py (+7/-5)
magicicada/metrics/services.py (+0/-34)
magicicada/metrics/tests/test_services.py (+0/-38)
magicicada/server/server.py (+3/-12)
magicicada/server/ssl_proxy.py (+2/-2)
magicicada/server/tests/test_basic.py (+0/-9)
requirements-devel.txt (+8/-0)
requirements.txt (+17/-0)
test (+3/-3)
To merge this branch: bzr merge lp:~nataliabidart/magicicada-server/use-venv-dependencies
Reviewer Review Type Date Requested Status
Facundo Batista Approve
Review via email: mp+342653@code.launchpad.net

Commit message

- Use devel and non-devel dependencies from a virtualenv.
- Clean former usage of revno from versioninfo.
- Provide travis and docker files so tests can be run in Travis using a xenial image.

To post a comment you must log in.
Revision history for this message
Facundo Batista (facundo) wrote :

Looks fine

review: Approve
92. By Natalia Bidart

One extra iteration of cleaning:
- use the storageprotocol from the wheel (dropping build deps for it)
- check the readme.rst with a Makefile file without needing a bash script

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file '.bzrignore'
--- .bzrignore 2016-07-13 22:18:34 +0000
+++ .bzrignore 2018-04-12 02:08:49 +0000
@@ -1,5 +1,4 @@
1env1.env
2lib/versioninfo.py
3tmp/*2tmp/*
4twistd.pid3twistd.pid
5.sourcecode/*4.sourcecode/*
65
=== modified file '.travis.yml'
--- .travis.yml 2016-09-01 17:10:04 +0000
+++ .travis.yml 2018-04-12 02:08:49 +0000
@@ -1,13 +1,13 @@
1addons:1sudo: required
2 postgresql: "9.5"2dist: trusty
3language: bash
34
4services:5services:
5 - postgresql6 - docker
67
7before_install:8before_install:
8 - sudo apt-get update9 - docker pull ubuntu:16.04
9 - make bootstrap10 - docker build -t magicicada-test-run .
1011
11script:12script:
12 - make clean-sourcedeps13 - docker run magicicada-test-run make test SOURCEDEPS_DIR=sourcedeps
13 - make test SOURCEDEPS_DIR=sourcedeps
1414
=== added file 'Dockerfile'
--- Dockerfile 1970-01-01 00:00:00 +0000
+++ Dockerfile 2018-04-12 02:08:49 +0000
@@ -0,0 +1,15 @@
1FROM ubuntu:16.04
2
3ADD . /home/ubuntu/magicicada
4COPY . /home/ubuntu/magicicada
5WORKDIR /home/ubuntu/magicicada
6
7RUN apt-get update && apt-get install make -y
8RUN make docker-bootstrap
9
10RUN useradd -ms /bin/bash ubuntu
11RUN chown -R ubuntu:ubuntu /home/ubuntu
12
13USER ubuntu
14ENV HOME /home/ubuntu
15ENV PG_HOST /home/ubuntu/pg_data
016
=== modified file 'Makefile'
--- Makefile 2018-04-05 20:57:19 +0000
+++ Makefile 2018-04-12 02:08:49 +0000
@@ -17,11 +17,11 @@
17# For further info, check http://launchpad.net/magicicada-server17# For further info, check http://launchpad.net/magicicada-server
1818
19DJANGO_SETTINGS_MODULE ?= magicicada.settings19DJANGO_SETTINGS_MODULE ?= magicicada.settings
20FLAKE8 = flake820ENV = $(CURDIR)/.env
21PYTHON = python21PYTHON = $(ENV)/bin/python
22SRC_DIR = $(CURDIR)/magicicada22SRC_DIR = $(CURDIR)/magicicada
23LIB_DIR = $(CURDIR)/lib23LIB_DIR = $(CURDIR)/lib
24ENV = $(CURDIR)/env24PATH := $(ENV)/bin:$(PATH)
25PYTHONPATH := $(SRC_DIR):$(LIB_DIR):$(CURDIR):$(PYTHONPATH)25PYTHONPATH := $(SRC_DIR):$(LIB_DIR):$(CURDIR):$(PYTHONPATH)
26DJANGO_ADMIN = $(LIB_DIR)/django/bin/django-admin.py26DJANGO_ADMIN = $(LIB_DIR)/django/bin/django-admin.py
27DJANGO_MANAGE = $(PYTHON) manage.py27DJANGO_MANAGE = $(PYTHON) manage.py
@@ -32,7 +32,9 @@
32PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION_VERSION=232PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION_VERSION=2
3333
34START_SUPERVISORD = lib/ubuntuone/supervisor/start-supervisord.py34START_SUPERVISORD = lib/ubuntuone/supervisor/start-supervisord.py
35SUPERVISOR_CTL = $(ENV)/bin/supervisorctl
3536
37export PATH
36export PYTHONPATH38export PYTHONPATH
37export DJANGO_SETTINGS_MODULE39export DJANGO_SETTINGS_MODULE
38export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION40export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION
@@ -44,8 +46,6 @@
44SOURCEDEPS_SOURCECODE_DIR = $(SOURCEDEPS_DIR)/sourcecode46SOURCEDEPS_SOURCECODE_DIR = $(SOURCEDEPS_DIR)/sourcecode
45TARGET_SOURCECODE_DIR = $(CURDIR)/.sourcecode47TARGET_SOURCECODE_DIR = $(CURDIR)/.sourcecode
4648
47BUILD_DEPLOY_SOURCEDEPS=magicicada-protocol
48
49TESTFLAGS=49TESTFLAGS=
5050
51TAR_EXTRA = --exclude 'tmp/*' --exclude tags51TAR_EXTRA = --exclude 'tmp/*' --exclude tags
@@ -65,53 +65,49 @@
65ifndef EXPORT_FROM_BZR65ifndef EXPORT_FROM_BZR
66 $(MAKE) link-sourcedeps66 $(MAKE) link-sourcedeps
67endif67endif
68 $(MAKE) build-sourcedeps
69 touch $(SOURCEDEPS_TAG)68 touch $(SOURCEDEPS_TAG)
7069
71build: link-sourcedeps build-sourcedeps version
72
73link-sourcedeps:70link-sourcedeps:
74 @echo "Checking out external source dependencies..."71 @echo "Checking out external source dependencies..."
75 dev-scripts/link-external-sourcecode -p $(SOURCEDEPS_SOURCECODE_DIR)/ \72 dev-scripts/link-external-sourcecode -p $(SOURCEDEPS_SOURCECODE_DIR)/ \
76 -t $(TARGET_SOURCECODE_DIR) -c config-manager.txt73 -t $(TARGET_SOURCECODE_DIR) -c config-manager.txt
7774
78# no need to link sourcedeps before building them, as rollout process75build-clientdefs:
79# handles config-manager.txt automatically
80build-for-deployment: build-deploy-sourcedeps version
81
82build-sourcedeps: build-deploy-sourcedeps
83 @echo "Building client clientdefs.py"76 @echo "Building client clientdefs.py"
84 @cd .sourcecode/magicicada-client/ubuntuone/ && sed \77 @cd $(TARGET_SOURCECODE_DIR)/magicicada-client/ubuntuone/ && sed \
85 -e 's|\@localedir\@|/usr/local/share/locale|g' \78 -e 's|\@localedir\@|/usr/local/share/locale|g' \
86 -e 's|\@libexecdir\@|/usr/local/libexec|g' \79 -e 's|\@libexecdir\@|/usr/local/libexec|g' \
87 -e 's|\@GETTEXT_PACKAGE\@|ubuntuone-client|g' \80 -e 's|\@GETTEXT_PACKAGE\@|ubuntuone-client|g' \
88 -e 's|\@VERSION\@|0.0.0|g' < clientdefs.py.in > clientdefs.py81 -e 's|\@VERSION\@|0.0.0|g' < clientdefs.py.in > clientdefs.py
8982
90build-deploy-sourcedeps:
91 @echo "Building Python extensions"
92
93 @for sourcedep in $(BUILD_DEPLOY_SOURCEDEPS) ; do \
94 d=".sourcecode/$$sourcedep" ; \
95 if test -e "$$d/setup.py" ; then \
96 (cd "$$d" && $(PYTHON) \
97 setup.py build build_ext --inplace > /dev/null) ; \
98 fi ; \
99 done
100
101 @echo "Generating twistd plugin cache"
102 @$(PYTHON) -c "from twisted.plugin import IPlugin, getPlugins; list(getPlugins(IPlugin));"
103
104tarball: build-for-deployment
105 tar czf ../filesync-server.tgz $(TAR_EXTRA) .
106
107bootstrap:83bootstrap:
108 cat dependencies.txt | sudo xargs apt-get install -y --no-install-recommends84 cat dependencies.txt | sudo xargs apt-get install -y --no-install-recommends
109 cat dependencies-devel.txt | sudo xargs apt-get install -y --no-install-recommends85 cat dependencies-devel.txt | sudo xargs apt-get install -y --no-install-recommends
86 $(MAKE) $(ENV)
87 $(MAKE) sourcedeps build-clientdefs
88 mkdir -p tmp
89
90docker-bootstrap: clean
91 cat dependencies.txt | xargs apt-get install -y --no-install-recommends
92 cat dependencies-devel.txt | xargs apt-get install -y --no-install-recommends
93 $(MAKE) $(ENV)
94 $(MAKE) sourcedeps build-clientdefs
95 mkdir -p tmp
96
97$(ENV): $(ENV)/bin/activate
98
99# only runs when requirements.txt or requirements-devel.txt changes
100$(ENV)/bin/activate: requirements.txt requirements-devel.txt
101 test -d $(ENV) || virtualenv $(ENV)
102 $(ENV)/bin/pip install -Ur requirements.txt
103 $(ENV)/bin/pip install -Ur requirements-devel.txt
104 $(ENV)/bin/pip install ubuntuone-storageprotocol --no-deps -t $(TARGET_SOURCECODE_DIR)
105 touch $(ENV)/bin/activate
110106
111raw-test:107raw-test:
112 ./test $(TESTFLAGS)108 $(PYTHON) test $(TESTFLAGS)
113109
114test: lint sourcedeps clean version start-db start-base start-dbus raw-test stop110test: lint sourcedeps start-db start-base start-dbus raw-test stop
115111
116ci-test:112ci-test:
117 $(MAKE) test TESTFLAGS="-1 $(TESTFLAGS)"113 $(MAKE) test TESTFLAGS="-1 $(TESTFLAGS)"
@@ -119,16 +115,13 @@
119clean:115clean:
120 rm -rf tmp/* _trial_temp $(ENV)116 rm -rf tmp/* _trial_temp $(ENV)
121117
122lint:118check-readme:
123 virtualenv $(ENV)119 $(ENV)/bin/rst2html5 README.rst --exit-status=warning > /dev/null && echo "README.rst OK"|| ( echo "ERROR: README.rst format is incorrect!!!!!" && exit 1)
124 $(ENV)/bin/pip install flake8 rst2html5120
121lint: $(ENV) check-readme
125 $(ENV)/bin/flake8 --filename='*.py' --exclude='migrations' $(SRC_DIR)122 $(ENV)/bin/flake8 --filename='*.py' --exclude='migrations' $(SRC_DIR)
126 dev-scripts/check_readme.sh123
127124start: $(ENV) start-base start-filesync-server-group publish-api-port
128version:
129 bzr version-info --format=python > lib/versioninfo.py || true
130
131start: build start-base start-filesync-server-group publish-api-port
132125
133resume: start-base start-filesync-server-group126resume: start-base start-filesync-server-group
134127
@@ -138,7 +131,7 @@
138start-base:131start-base:
139 $(MAKE) start-supervisor && $(MAKE) start-dbus || ( $(MAKE) stop ; exit 1 )132 $(MAKE) start-supervisor && $(MAKE) start-dbus || ( $(MAKE) stop ; exit 1 )
140133
141stop: stop-filesync-dummy-group stop-supervisor stop-dbus134stop: stop-supervisor stop-dbus
142135
143start-dbus:136start-dbus:
144 dev-scripts/start-dbus.sh137 dev-scripts/start-dbus.sh
@@ -147,28 +140,28 @@
147 dev-scripts/stop-dbus.sh140 dev-scripts/stop-dbus.sh
148141
149start-supervisor:142start-supervisor:
150 @python dev-scripts/supervisor-config-dev.py143 $(PYTHON) dev-scripts/supervisor-config-dev.py
151 -@$(START_SUPERVISORD) dev-scripts/supervisor-dev.conf.tpl144 -@$(START_SUPERVISORD) dev-scripts/supervisor-dev.conf.tpl
152145
153stop-supervisor:146stop-supervisor:
154 -@dev-scripts/supervisorctl-dev shutdown147 $(SUPERVISOR_CTL) -c $(CURDIR)/tmp/supervisor-dev.conf shutdown
155148
156start-%-group:149start-%-group:
157 -@dev-scripts/supervisorctl-dev start $*:150 $(SUPERVISOR_CTL) -c $(CURDIR)/tmp/supervisor-dev.conf start $*:
158151
159stop-%-group:152stop-%-group:
160 -@dev-scripts/supervisorctl-dev stop $*:153 $(SUPERVISOR_CTL) -c $(CURDIR)/tmp/supervisor-dev.conf stop $*:
161154
162start-%:155start-%:
163 -@dev-scripts/supervisorctl-dev start $*156 $(SUPERVISOR_CTL) -c $(CURDIR)/tmp/supervisor-dev.conf start $*
164157
165stop-%:158stop-%:
166 -@dev-scripts/supervisorctl-dev stop $*159 $(SUPERVISOR_CTL) -c $(CURDIR)/tmp/supervisor-dev.conf stop $*
167160
168publish-api-port:161publish-api-port:
169 python -c 'from magicicada import settings; print >> file("tmp/filesyncserver.port", "w"), settings.TCP_PORT'162 $(PYTHON) -c 'from magicicada import settings; print >> file("tmp/filesyncserver.port", "w"), settings.TCP_PORT'
170 python -c 'from magicicada import settings; print >> file("tmp/filesyncserver.port.ssl", "w"), settings.SSL_PORT'163 $(PYTHON) -c 'from magicicada import settings; print >> file("tmp/filesyncserver.port.ssl", "w"), settings.SSL_PORT'
171 python -c 'from magicicada import settings; print >> file("tmp/filesyncserver-status.port", "w"), settings.API_STATUS_PORT'164 $(PYTHON) -c 'from magicicada import settings; print >> file("tmp/filesyncserver-status.port", "w"), settings.API_STATUS_PORT'
172165
173shell:166shell:
174 $(DJANGO_MANAGE) shell167 $(DJANGO_MANAGE) shell
@@ -179,7 +172,6 @@
179admin:172admin:
180 $(DJANGO_ADMIN) $(ARGS)173 $(DJANGO_ADMIN) $(ARGS)
181174
182.PHONY: sourcedeps link-sourcedeps build-sourcedeps build-deploy-sourcedeps \175.PHONY: sourcedeps link-sourcedeps clean lint test ci-test clean-sourcedeps \
183 build clean version lint test ci-test build-for-deployment \176 start stop publish-api-port start-supervisor stop-supervisor \
184 clean-sourcedeps tarball start stop publish-api-port start-supervisor \177 start-dbus stop-dbus start-heapy check-readme
185 stop-supervisor start-dbus stop-dbus start-heapy
186178
=== modified file 'README.rst'
--- README.rst 2017-04-22 21:07:36 +0000
+++ README.rst 2018-04-12 02:08:49 +0000
@@ -75,12 +75,6 @@
75access)::75access)::
7676
77 make bootstrap77 make bootstrap
78 make sourcedeps
79
80If you are in Xenial, please also install virtualenv (didn't include it in
81the previous step as it doesn't exist as a separate package in older systems)::
82
83 sudo apt-get install virtualenv
8478
85Ensure the files 'privkey.pem' and 'cacert.pem' produced in the "Before server79Ensure the files 'privkey.pem' and 'cacert.pem' produced in the "Before server
86or client" section are copied into the ~/magicicada/magicicada-server/certs80or client" section are copied into the ~/magicicada/magicicada-server/certs
8781
=== modified file 'config-manager.txt'
--- config-manager.txt 2018-04-05 20:57:19 +0000
+++ config-manager.txt 2018-04-12 02:08:49 +0000
@@ -21,9 +21,5 @@
21#21#
22# make clean-sourcedeps sourcedeps22# make clean-sourcedeps sourcedeps
2323
24./.sourcecode/configglue ~configglue/configglue/trunk;revno=1
25./.sourcecode/dirspec ~ubuntuone-control-tower/dirspec/trunk;revno=14
26./.sourcecode/django ~ubuntuone-pqm-team/django/stable;revno=17
27./.sourcecode/u1sync ~facundo/u1sync/opensourcing;revno=1024./.sourcecode/u1sync ~facundo/u1sync/opensourcing;revno=10
28./.sourcecode/magicicada-client ~chicharreros/magicicada-client/trunk;revno=144025./.sourcecode/magicicada-client ~chicharreros/magicicada-client/trunk;revno=1440
29./.sourcecode/magicicada-protocol ~chicharreros/magicicada-protocol/trunk;revno=169
3026
=== modified file 'dependencies-devel.txt'
--- dependencies-devel.txt 2017-04-22 21:07:36 +0000
+++ dependencies-devel.txt 2018-04-12 02:08:49 +0000
@@ -1,12 +1,7 @@
1dbus1dbus
2openssl2libcairo2-dev
3libdbus-1-dev
4libdbus-glib-1-dev
5libgirepository1.0-dev
6pkg-config
3postgresql-client-9.57postgresql-client-9.5
4python-dbus
5python-gobject
6python-httplib2
7python-mock
8python-mocker
9python-pyinotify
10python-testtools
11python-twisted-names
12python-virtualenv
138
=== modified file 'dependencies.txt'
--- dependencies.txt 2017-04-22 21:07:36 +0000
+++ dependencies.txt 2018-04-12 02:08:49 +0000
@@ -4,19 +4,5 @@
4postgresql-9.54postgresql-9.5
5postgresql-contrib5postgresql-contrib
6postgresql-plpython-9.56postgresql-plpython-9.5
7protobuf-compiler
8python-boto
9python-bson
10python-dev7python-dev
11python-iso86018virtualenv
12python-meliae
13python-openssl
14python-protobuf
15python-psutil
16python-psycopg2
17python-setuptools
18python-twisted-web
19python-tz
20python-virtualenv
21python-yaml
22supervisor
239
=== removed file 'dev-scripts/check_readme.sh'
--- dev-scripts/check_readme.sh 2015-12-27 22:18:59 +0000
+++ dev-scripts/check_readme.sh 1970-01-01 00:00:00 +0000
@@ -1,8 +0,0 @@
1#/bin/bash
2
3OUTPUT=$(env/bin/rst2html5 README.rst 2>&1 >/dev/null)
4if [ -n "$OUTPUT" ]; then
5 echo -e "README.rst format is incorrect!!!!!\n"
6 echo -e "Errors: \n$OUTPUT"
7 exit 1
8fi
90
=== modified file 'dev-scripts/cmd_client.py'
--- dev-scripts/cmd_client.py 2018-04-05 20:57:19 +0000
+++ dev-scripts/cmd_client.py 2018-04-12 02:08:49 +0000
@@ -33,12 +33,8 @@
33from threading import Thread33from threading import Thread
34from optparse import OptionParser34from optparse import OptionParser
3535
36try:36from twisted.internet import gireactor
37 from twisted.internet import gireactor37gireactor.install()
38 gireactor.install()
39except ImportError:
40 from twisted.internet import glib2reactor
41 glib2reactor.install()
4238
43from dbus.mainloop.glib import DBusGMainLoop39from dbus.mainloop.glib import DBusGMainLoop
44DBusGMainLoop(set_as_default=True)40DBusGMainLoop(set_as_default=True)
4541
=== removed file 'dev-scripts/dev_launcher.py'
--- dev-scripts/dev_launcher.py 2018-04-05 20:58:20 +0000
+++ dev-scripts/dev_launcher.py 1970-01-01 00:00:00 +0000
@@ -1,87 +0,0 @@
1#!/usr/bin/env python
2
3# Copyright 2008-2015 Canonical
4# Copyright 2015-2018 Chicharreros (https://launchpad.net/~chicharreros)
5#
6# This program is free software: you can redistribute it and/or modify
7# it under the terms of the GNU Affero General Public License as
8# published by the Free Software Foundation, either version 3 of the
9# License, or (at your option) any later version.
10#
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU Affero General Public License for more details.
15#
16# You should have received a copy of the GNU Affero General Public License
17# along with this program. If not, see <http://www.gnu.org/licenses/>.
18#
19# For further info, check http://launchpad.net/magicicada-server
20
21"""Script to execute client stuff in dev environment."""
22
23import os
24import sys
25
26import _pythonpath
27
28# fix environment before further imports
29os.environ["DJANGO_SETTINGS_MODULE"] = "magicicada.settings"
30
31from utilities import dev_launcher
32
33
34def usage():
35 """Return the usage."""
36 return ("dev_launcher PROGNAME USERNAME [--machine=N] [args*]\n"
37 "runs PROGNAME with args plus:\n"
38 " --port with the local server port\n"
39 " --host localhost\n"
40 " --auth username and password for user USERNAME\n")
41
42
43def main(args):
44 """run devlauncher"""
45 from optparse import OptionParser
46 if len(args) < 3:
47 print usage()
48 return
49
50 parser = OptionParser(usage=usage())
51 parser.add_option('-p', '--port', dest='port',
52 help="The port to where connect")
53 parser.add_option('-t', '--host', dest='host',
54 help="The host to where connect")
55 parser.add_option('-a', '--auth', dest='auth',
56 help="Auth data")
57 parser.add_option('-m', '--machine', dest='machine',
58 help="Machine number (to have multiple launchers with "
59 "the same user)")
60
61 # check to see if we have extra params for the command to execute
62 if "--" in args:
63 pos = args.index("--")
64 params = args[pos + 1:]
65 args = args[:pos]
66 else:
67 params = []
68
69 (options, pargs) = parser.parse_args(args[1:])
70 progname, username = pargs
71 if options.machine:
72 machine_suffix = "_" + options.machine
73 else:
74 machine_suffix = None
75
76 lib_dir = _pythonpath.get_lib_dir()
77 d = dict(
78 PYTHONPATH=lib_dir,
79 XDG_CACHE_HOME="tmp/xdg_cache",
80 )
81
82 dev_launcher.launch(progname, username, params, environ=d, verbose=True,
83 machine_suffix=machine_suffix, host=options.host,
84 api_port=options.port, auth_data=options.auth)
85
86if __name__ == "__main__":
87 main(sys.argv)
880
=== removed file 'dev-scripts/sd_test.sh'
--- dev-scripts/sd_test.sh 2018-04-05 20:57:19 +0000
+++ dev-scripts/sd_test.sh 1970-01-01 00:00:00 +0000
@@ -1,29 +0,0 @@
1#!/bin/bash
2
3# Copyright 2008-2015 Canonical
4# Copyright 2015-2018 Chicharreros (https://launchpad.net/~chicharreros)
5#
6# This program is free software: you can redistribute it and/or modify
7# it under the terms of the GNU Affero General Public License as
8# published by the Free Software Foundation, either version 3 of the
9# License, or (at your option) any later version.
10#
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU Affero General Public License for more details.
15#
16# You should have received a copy of the GNU Affero General Public License
17# along with this program. If not, see <http://www.gnu.org/licenses/>.
18#
19# For further info, check http://launchpad.net/magicicada-server
20
21# run the minimal infraestructure to run the sdtests isolated from the current session
22ROOTDIR=${ROOTDIR:-`bzr root`}
23ADDRESS_FILE="${ROOTDIR}/tmp/dbus.address"
24make start-dbus
25env DEBUG="file $DEBUG" SERVER_DEBUG="$SERVER_DEBUG" ROOTDIR=$ROOTDIR DBUS_SESSION_BUS_ADDRESS=$(cat $ADDRESS_FILE) XDG_CACHE_HOME="${ROOTDIR}/tmp/xdg_cache" \
26${PYTHON:-python} -Wignore ./test $@
27EXIT_VAL=$?
28make stop-dbus
29exit $EXIT_VAL
300
=== modified file 'dev-scripts/start-dbus.sh'
--- dev-scripts/start-dbus.sh 2018-04-05 20:57:19 +0000
+++ dev-scripts/start-dbus.sh 2018-04-12 02:08:49 +0000
@@ -41,4 +41,3 @@
41exec 4>&-41exec 4>&-
4242
43echo "DBUS_SESSION_BUS_ADDRESS=$(cat $ADDRESS_FILE)"43echo "DBUS_SESSION_BUS_ADDRESS=$(cat $ADDRESS_FILE)"
44
4544
=== modified file 'dev-scripts/stop-dbus.sh'
--- dev-scripts/stop-dbus.sh 2018-04-05 20:57:19 +0000
+++ dev-scripts/stop-dbus.sh 2018-04-12 02:08:49 +0000
@@ -23,7 +23,6 @@
23ADDRESS_FILE="${ROOTDIR}/tmp/dbus.address"23ADDRESS_FILE="${ROOTDIR}/tmp/dbus.address"
2424
25/sbin/start-stop-daemon -v --stop --oknodo --pidfile $PID_FILE25/sbin/start-stop-daemon -v --stop --oknodo --pidfile $PID_FILE
26kill `cat $PID_FILE`26kill `cat $PID_FILE` || true
27# cleanup the files created on start27# cleanup the files created on start
28rm -f $PID_FILE $ADDRESS_FILE28rm -f $PID_FILE $ADDRESS_FILE
29
3029
=== modified file 'dev-scripts/supervisor-config-dev.py'
--- dev-scripts/supervisor-config-dev.py 2018-04-05 20:57:19 +0000
+++ dev-scripts/supervisor-config-dev.py 2018-04-12 02:08:49 +0000
@@ -20,24 +20,68 @@
2020
21import os21import os
22import socket22import socket
23import sys
2324
24import _pythonpath # NOQA25import _pythonpath # NOQA
2526
26from ubuntuone.supervisor.config_helpers import generate_server_config27from ubuntuone.supervisor.config_helpers import generate_server_config
27from utilities import utils28from utilities.utils import get_rootdir, get_tmpdir
2829
29from supervisor_templates import TEMPLATES30
3031ROOT_DIR = get_rootdir()
31ROOTDIR = utils.get_rootdir()32TMP_DIR = get_tmpdir()
32TMPDIR = os.path.join(ROOTDIR, 'tmp')33
33if not os.path.exists(TMPDIR):34
34 os.mkdir(TMPDIR)35FILESYNC_TEMPLATE = (
3536 '[program:%(instance_name)s]\n'
37 'command=%(basepath)s/dev-scripts/set_rlimits.sh -d %(fs_memory_limit)s '
38 '-m %(fs_memory_limit)s -v %(fs_memory_limit)s -n %(open_fds)s '
39 '%(basepath)s/.env/bin/twistd --pidfile %(pid_folder)s/fsync_slave_%(instance)s.pid '
40 '-n -y %(basepath)s/magicicada/server/server.tac '
41 '--reactor=epoll\n'
42 'environment=DJANGO_SETTINGS_MODULE="magicicada.settings",'
43 'PYTHONPATH="%(pythonpath)s",'
44 'FSYNC_INSTANCE_ID=%(instance)03d,'
45 'CONFIG="%(basepath)s/configs/%(config)s"%(environment_vars)s\n'
46 'autostart=false\n'
47 'stdout_capture_maxbytes=%(stdout_capture_maxbytes)s\n'
48 'stopsignal=INT\n'
49)
50
51SSL_PROXY_TEMPLATE = (
52 '[program:%(instance_name)s]\n'
53 'command=%(basepath)s/dev-scripts/set_rlimits.sh -d %(ssl_memory_limit)s '
54 '-m %(ssl_memory_limit)s -v %(ssl_memory_limit)s -n %(open_fds)s '
55 '%(basepath)s/.env/bin/twistd --pidfile %(pid_folder)s/ssl-proxy-%(instance)s.pid '
56 '-n -y %(basepath)s/magicicada/server/ssl_proxy.tac '
57 '--reactor=epoll\n'
58 'environment=DJANGO_SETTINGS_MODULE="magicicada.settings",'
59 'PYTHONPATH="%(pythonpath)s",'
60 'FSYNC_INSTANCE_ID=%(instance)03d,'
61 'CONFIG="%(basepath)s/configs/%(config)s",'
62 'FSYNC_SERVICE_NAME="ssl-proxy"%(environment_vars)s\n'
63 'autostart=false\n'
64 'stdout_capture_maxbytes=%(stdout_capture_maxbytes)s\n'
65 'stopsignal=INT\n'
66)
67
68
69TEMPLATES = {
70 'filesync': {
71 'name': "filesync-worker-%(instance)d",
72 'config': FILESYNC_TEMPLATE,
73 },
74 'ssl-proxy': {
75 'name': "ssl-proxy-%(instance)d",
76 'config': SSL_PROXY_TEMPLATE,
77 },
78}
3679
37config_spec = {80config_spec = {
38 "basepath": ROOTDIR,81 "basepath": ROOT_DIR,
39 "log_folder": TMPDIR,82 "log_folder": TMP_DIR,
40 "pid_folder": TMPDIR,83 "pid_folder": TMP_DIR,
84 "pythonpath": ':'.join(filter(None, sys.path)),
41}85}
4286
43workers = {}87workers = {}
@@ -52,5 +96,5 @@
52 config_content = generate_server_config(96 config_content = generate_server_config(
53 hostname, services, config_spec, TEMPLATES, None,97 hostname, services, config_spec, TEMPLATES, None,
54 with_heartbeat=False, with_header=False)98 with_heartbeat=False, with_header=False)
55 with open(os.path.join(TMPDIR, 'services-supervisor.conf'), 'w') as f:99 with open(os.path.join(TMP_DIR, 'services-supervisor.conf'), 'w') as f:
56 f.write(config_content)100 f.write(config_content)
57101
=== modified file 'dev-scripts/supervisor-dev.conf.tpl'
--- dev-scripts/supervisor-dev.conf.tpl 2017-04-22 21:07:36 +0000
+++ dev-scripts/supervisor-dev.conf.tpl 2018-04-12 02:08:49 +0000
@@ -25,20 +25,20 @@
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-server27command=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="%(pythonpath)s"
29events=PROCESS_COMMUNICATION,TICK_529events=PROCESS_COMMUNICATION,TICK_5
30buffer_size=4230buffer_size=42
3131
32[program:filesync]32[program:filesync]
33command=/usr/bin/twistd --pidfile %(tmp_dir)s/filesync.pid -n -y %(basepath)s/magicicada/server/server.tac --reactor=epoll33command=%(basepath)s/.env/bin/twistd --pidfile %(tmp_dir)s/filesync.pid -n -y %(basepath)s/magicicada/server/server.tac --reactor=epoll
34environment=PYTHONPATH="%(basepath)s:%(basepath)s/lib",DJANGO_SETTINGS_MODULE="magicicada.settings",PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp34environment=PYTHONPATH="%(pythonpath)s",DJANGO_SETTINGS_MODULE="magicicada.settings",PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp
35stdout_capture_maxbytes=1638435stdout_capture_maxbytes=16384
36autostart=false36autostart=false
37stopsignal=INT37stopsignal=INT
3838
39[program:ssl-proxy]39[program:ssl-proxy]
40command=/usr/bin/twistd --pidfile %(tmp_dir)s/ssl-proxy.pid -n -y %(basepath)s/magicicada/server/ssl_proxy.tac --reactor=epoll40command=%(basepath)s/.env/bin/twistd --pidfile %(tmp_dir)s/ssl-proxy.pid -n -y %(basepath)s/magicicada/server/ssl_proxy.tac --reactor=epoll
41environment=PYTHONPATH="%(basepath)s:%(basepath)s/lib",DJANGO_SETTINGS_MODULE="magicicada.settings"41environment=PYTHONPATH="%(pythonpath)s",DJANGO_SETTINGS_MODULE="magicicada.settings"
42stdout_capture_maxbytes=1638442stdout_capture_maxbytes=16384
43autostart=false43autostart=false
44stopsignal=INT44stopsignal=INT
4545
=== removed file 'dev-scripts/supervisor_templates.py'
--- dev-scripts/supervisor_templates.py 2018-04-05 20:57:19 +0000
+++ dev-scripts/supervisor_templates.py 1970-01-01 00:00:00 +0000
@@ -1,65 +0,0 @@
1# Copyright 2008-2015 Canonical
2# Copyright 2015-2018 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/magicicada-server
18
19"""Templates to generate supervisor config."""
20
21FILESYNC_TEMPLATE = (
22 '[program:%(instance_name)s]\n'
23 'command=%(basepath)s/dev-scripts/set_rlimits.sh -d %(fs_memory_limit)s '
24 '-m %(fs_memory_limit)s -v %(fs_memory_limit)s -n %(open_fds)s '
25 '/usr/bin/twistd --pidfile %(pid_folder)s/fsync_slave_%(instance)s.pid '
26 '-n -y %(basepath)s/magicicada/server/server.tac '
27 '--reactor=epoll\n'
28 'environment=DJANGO_SETTINGS_MODULE="magicicada.settings",'
29 'PYTHONPATH="%(basepath)s/lib",'
30 'FSYNC_INSTANCE_ID=%(instance)03d,'
31 'CONFIG="%(basepath)s/configs/%(config)s"%(environment_vars)s\n'
32 'autostart=false\n'
33 'stdout_capture_maxbytes=%(stdout_capture_maxbytes)s\n'
34 'stopsignal=INT\n'
35)
36
37SSL_PROXY_TEMPLATE = (
38 '[program:%(instance_name)s]\n'
39 'command=%(basepath)s/dev-scripts/set_rlimits.sh -d %(ssl_memory_limit)s '
40 '-m %(ssl_memory_limit)s -v %(ssl_memory_limit)s -n %(open_fds)s '
41 '/usr/bin/twistd '
42 '--pidfile %(pid_folder)s/ssl-proxy-%(instance)s.pid '
43 '-n -y %(basepath)s/magicicada/server/ssl_proxy.tac '
44 '--reactor=epoll\n'
45 'environment=DJANGO_SETTINGS_MODULE="magicicada.settings",'
46 'PYTHONPATH="%(basepath)s/lib",'
47 'FSYNC_INSTANCE_ID=%(instance)03d,'
48 'CONFIG="%(basepath)s/configs/%(config)s",'
49 'FSYNC_SERVICE_NAME="ssl-proxy"%(environment_vars)s\n'
50 'autostart=false\n'
51 'stdout_capture_maxbytes=%(stdout_capture_maxbytes)s\n'
52 'stopsignal=INT\n'
53)
54
55
56TEMPLATES = {
57 'filesync': {
58 'name': "filesync-worker-%(instance)d",
59 'config': FILESYNC_TEMPLATE,
60 },
61 'ssl-proxy': {
62 'name': "ssl-proxy-%(instance)d",
63 'config': SSL_PROXY_TEMPLATE,
64 },
65}
660
=== removed file 'dev-scripts/supervisorctl-dev'
--- dev-scripts/supervisorctl-dev 2015-08-05 13:10:02 +0000
+++ dev-scripts/supervisorctl-dev 1970-01-01 00:00:00 +0000
@@ -1,6 +0,0 @@
1#!/bin/bash
2ROOT=$(dirname $0)/..
3NAME=$(basename $0)
4
5export PYTHONPATH="$ROOT/lib"
6/usr/bin/supervisorctl -c $ROOT/tmp/${NAME/supervisorctl/supervisor}.conf $*
70
=== removed symlink 'lib/configglue'
=== target was u'../.sourcecode/configglue/configglue/'
=== removed symlink 'lib/dirspec'
=== target was u'../.sourcecode/dirspec/dirspec'
=== removed symlink 'lib/django'
=== target was u'../.sourcecode/django/django'
=== removed symlink 'lib/mock.py'
=== target was u'../.sourcecode/mock/mock.py'
=== removed symlink 'lib/oauthlib'
=== target was u'../.sourcecode/oauthlib/oauthlib/'
=== removed symlink 'lib/requests'
=== target was u'../.sourcecode/requests/requests'
=== removed symlink 'lib/requests_oauthlib'
=== target was u'../.sourcecode/requests_oauthlib/requests_oauthlib'
=== removed symlink 'lib/ubuntuone/status'
=== target was u'../../.sourcecode/magicicada-client/ubuntuone/status/'
=== modified symlink 'lib/ubuntuone/storageprotocol'
=== target changed u'../../.sourcecode/magicicada-protocol/ubuntuone/storageprotocol' => u'../../.sourcecode/ubuntuone/storageprotocol'
=== modified file 'lib/ubuntuone/supervisor/config_helpers.py'
--- lib/ubuntuone/supervisor/config_helpers.py 2018-04-05 20:57:19 +0000
+++ lib/ubuntuone/supervisor/config_helpers.py 2018-04-12 02:08:49 +0000
@@ -20,6 +20,7 @@
2020
21import os21import os
22import platform22import platform
23import sys
2324
24from utilities.utils import get_rootdir25from utilities.utils import get_rootdir
2526
@@ -34,7 +35,7 @@
34HEARTBEAT_LISTENER_TEMPLATE = '\n'.join((35HEARTBEAT_LISTENER_TEMPLATE = '\n'.join((
35 "[eventlistener:heartbeat]",36 "[eventlistener:heartbeat]",
36 "command=python %(basepath)s/lib/ubuntuone/supervisor/heartbeat_listener.py --interval=%(interval)s --timeout=%(timeout)s --log_level=%(log_level)s --log_file=%(log_folder)s/heartbeat_listener.log --groups=%(groups)s %(processes)s", # NOQA37 "command=python %(basepath)s/lib/ubuntuone/supervisor/heartbeat_listener.py --interval=%(interval)s --timeout=%(timeout)s --log_level=%(log_level)s --log_file=%(log_folder)s/heartbeat_listener.log --groups=%(groups)s %(processes)s", # NOQA
37 'environment=PYTHONPATH="%(basepath)s:%(basepath)s/lib",DJANGO_SETTINGS_MODULE="magicicada.settings"', # NOQA38 'environment=PYTHONPATH="%(pythonpath)s",DJANGO_SETTINGS_MODULE="magicicada.settings"', # NOQA
38 "events=PROCESS_COMMUNICATION,TICK_5",39 "events=PROCESS_COMMUNICATION,TICK_5",
39 "buffer_size=%(buffer_size)s",40 "buffer_size=%(buffer_size)s",
40))41))
@@ -68,6 +69,7 @@
68 "log_folder": "/srv/%(base_dir)s/%(env)s-logs",69 "log_folder": "/srv/%(base_dir)s/%(env)s-logs",
69 "pid_folder": "/srv/%(base_dir)s/var",70 "pid_folder": "/srv/%(base_dir)s/var",
70 "stdout_capture_maxbytes": 16384,71 "stdout_capture_maxbytes": 16384,
72 "pythonpath": ':'.join(filter(None, sys.path)),
71}73}
7274
73base_heartbeat_listener_spec = {75base_heartbeat_listener_spec = {
7476
=== modified file 'lib/ubuntuone/supervisor/heartbeat_listener.py'
--- lib/ubuntuone/supervisor/heartbeat_listener.py 2018-04-05 20:57:19 +0000
+++ lib/ubuntuone/supervisor/heartbeat_listener.py 2018-04-12 02:08:49 +0000
@@ -219,7 +219,7 @@
219219
220# main entry point, parse args and start the service.220# main entry point, parse args and start the service.
221if __name__ == '__main__':221if __name__ == '__main__':
222 from configglue import configglue222 from configglue.inischema.glue import configglue
223 from StringIO import StringIO223 from StringIO import StringIO
224 config_file = StringIO()224 config_file = StringIO()
225 config_file.write(default_config)225 config_file.write(default_config)
226226
=== modified file 'lib/ubuntuone/supervisor/start-supervisord.py'
--- lib/ubuntuone/supervisor/start-supervisord.py 2018-04-05 20:57:19 +0000
+++ lib/ubuntuone/supervisor/start-supervisord.py 2018-04-12 02:08:49 +0000
@@ -36,10 +36,12 @@
36 """Write out filled in conf template in tmp."""36 """Write out filled in conf template in tmp."""
37 template = open(os.path.join(ROOT_DIR, tpl)).read()37 template = open(os.path.join(ROOT_DIR, tpl)).read()
3838
39 template_vars = {}39 template_vars = {
40 template_vars['inet_http_server_port'] = inet_http_server_port40 'inet_http_server_port': inet_http_server_port,
41 template_vars['basepath'] = ROOT_DIR41 'basepath': ROOT_DIR,
42 template_vars['tmp_dir'] = TMP_DIR42 'tmp_dir': TMP_DIR,
43 'pythonpath': ':'.join(filter(None, sys.path)),
44 }
4345
44 conf = template % template_vars46 conf = template % template_vars
4547
@@ -79,7 +81,7 @@
79 except OSError:81 except OSError:
80 pass82 pass
8183
82 os_exec("/usr/bin/supervisord", "-c", conf_file_path)84 os_exec(".env/bin/supervisord", "-c", conf_file_path)
8385
8486
85if __name__ == "__main__":87if __name__ == "__main__":
8688
=== removed file 'magicicada/metrics/services.py'
--- magicicada/metrics/services.py 2018-04-05 20:57:19 +0000
+++ magicicada/metrics/services.py 1970-01-01 00:00:00 +0000
@@ -1,34 +0,0 @@
1# Copyright 2008-2015 Canonical
2# Copyright 2015-2018 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/magicicada-server
18
19"""Metric services."""
20
21from __future__ import unicode_literals
22
23from metrics import get_meter
24try:
25 from versioninfo import version_info
26except ImportError:
27 version_info = {'revno': 'Undefined'}
28
29meter = get_meter('service')
30
31
32def revno():
33 """Trigger a service revision number update."""
34 meter.gauge('revno', version_info['revno'])
350
=== removed file 'magicicada/metrics/tests/test_services.py'
--- magicicada/metrics/tests/test_services.py 2018-04-05 20:57:19 +0000
+++ magicicada/metrics/tests/test_services.py 1970-01-01 00:00:00 +0000
@@ -1,38 +0,0 @@
1# Copyright 2008-2015 Canonical
2# Copyright 2015-2018 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/magicicada-server
18
19"""Tests for metric services."""
20
21from __future__ import unicode_literals
22
23from mock import patch
24from testtools import TestCase
25
26from metrics import get_meter
27from metrics.services import revno, version_info
28
29
30class ServicesTest(TestCase):
31 """Tests for metric services."""
32
33 def test_meters_revno_with_gauge_meter(self):
34 """The service is able to meter a revision by gauge meter."""
35 service_meter = get_meter('service')
36 with patch.object(service_meter, 'gauge') as gauge:
37 revno()
38 gauge.assert_called_with('revno', version_info['revno'])
390
=== modified file 'magicicada/server/server.py'
--- magicicada/server/server.py 2018-04-05 20:57:19 +0000
+++ magicicada/server/server.py 2018-04-12 02:08:49 +0000
@@ -41,7 +41,6 @@
41import twisted.web.error41import twisted.web.error
4242
43import metrics43import metrics
44import metrics.services
4544
46from twisted.application.service import MultiService, Service45from twisted.application.service import MultiService, Service
47from twisted.application.internet import TCPServer46from twisted.application.internet import TCPServer
@@ -60,14 +59,6 @@
60from magicicada.server import auth, content, errors, stats59from magicicada.server import auth, content, errors, stats
61from magicicada.server.diskstorage import DiskStorage60from magicicada.server.diskstorage import DiskStorage
6261
63try:
64 from versioninfo import version_info
65except ImportError:
66 version_info = {
67 'branch_nick': 'Unavailable',
68 'revno': 'Unavailable',
69 }
70
7162
72# this is the minimal cap we support (to avoid hardcoding it in the code)63# this is the minimal cap we support (to avoid hardcoding it in the code)
73MIN_CAP = frozenset(['no-content', 'account-info', 'resumable-uploads',64MIN_CAP = frozenset(['no-content', 'account-info', 'resumable-uploads',
@@ -85,6 +76,8 @@
85 # frozenset(['example2']): dict(srv_record='_https._tcp.fs.server.com')76 # frozenset(['example2']): dict(srv_record='_https._tcp.fs.server.com')
86}77}
8778
79FILESYNC_STATUS_MSG = 'filesync server'
80
88logger = logging.getLogger(__name__)81logger = logging.getLogger(__name__)
8982
9083
@@ -381,8 +374,7 @@
381 request.RequestHandler.connectionMade(self)374 request.RequestHandler.connectionMade(self)
382 self.factory.protocols.append(self)375 self.factory.protocols.append(self)
383 self.log.info('Connection Made')376 self.log.info('Connection Made')
384 msg = '%d filesync server revision %s.\r\n' % (377 msg = '%d %s.\r\n' % (self.PROTOCOL_VERSION, FILESYNC_STATUS_MSG)
385 self.PROTOCOL_VERSION, version_info['revno'])
386 self.transport.write(msg)378 self.transport.write(msg)
387 self.ping_loop.start()379 self.ping_loop.start()
388 self.factory.metrics.meter('connection_made', 1)380 self.factory.metrics.meter('connection_made', 1)
@@ -2685,7 +2677,6 @@
2685 self.factory.rpc_dal = self.rpc_dal2677 self.factory.rpc_dal = self.rpc_dal
2686 self.metrics.meter('server_start')2678 self.metrics.meter('server_start')
2687 self.metrics.increment('services_active')2679 self.metrics.increment('services_active')
2688 metrics.services.revno()
26892680
2690 self._reactor_inspector.start()2681 self._reactor_inspector.start()
2691 # only start the HeartbeatWriter if the interval is > 02682 # only start the HeartbeatWriter if the interval is > 0
26922683
=== modified file 'magicicada/server/ssl_proxy.py'
--- magicicada/server/ssl_proxy.py 2018-04-05 20:57:19 +0000
+++ magicicada/server/ssl_proxy.py 2018-04-12 02:08:49 +0000
@@ -34,7 +34,7 @@
34import metrics34import metrics
3535
36from magicicada import settings36from magicicada import settings
37from magicicada.server.server import get_service_port37from magicicada.server.server import FILESYNC_STATUS_MSG, get_service_port
38from magicicada.server.ssl import disable_ssl_compression38from magicicada.server.ssl import disable_ssl_compression
39from ubuntuone.supervisor import utils as supervisor_utils39from ubuntuone.supervisor import utils as supervisor_utils
4040
@@ -164,7 +164,7 @@
164164
165 def lineReceived(self, line):165 def lineReceived(self, line):
166 """Handle a single line received."""166 """Handle a single line received."""
167 if "filesync server revision" in line:167 if FILESYNC_STATUS_MSG in line:
168 self.factory.deferred.callback(line)168 self.factory.deferred.callback(line)
169 else:169 else:
170 self.factory.deferred.errback(ValueError(line))170 self.factory.deferred.errback(ValueError(line))
171171
=== modified file 'magicicada/server/tests/test_basic.py'
--- magicicada/server/tests/test_basic.py 2018-04-05 20:57:19 +0000
+++ magicicada/server/tests/test_basic.py 2018-04-12 02:08:49 +0000
@@ -35,9 +35,6 @@
35from ubuntuone.storageprotocol import request35from ubuntuone.storageprotocol import request
36from ubuntuone.supervisor import utils as supervisor_utils36from ubuntuone.supervisor import utils as supervisor_utils
3737
38import metrics
39import metrics.services
40
41from magicicada.filesync.models import StorageUser38from magicicada.filesync.models import StorageUser
42from magicicada.server.server import logger39from magicicada.server.server import logger
43from magicicada.server.testing.testcase import TestWithDatabase40from magicicada.server.testing.testcase import TestWithDatabase
@@ -120,9 +117,6 @@
120 service_meter = mocker.mock(name='meter')117 service_meter = mocker.mock(name='meter')
121 self.service.metrics = service_meter118 self.service.metrics = service_meter
122119
123 revno = mocker.mock(name='revno')
124 self.patch(metrics.services, 'revno', revno)
125
126 service_meter.meter('server_stop')120 service_meter.meter('server_stop')
127 service_meter.decrement('services_active')121 service_meter.decrement('services_active')
128 service_meter.meter('server_start')122 service_meter.meter('server_start')
@@ -131,9 +125,6 @@
131 service_meter.timing("busy.ping", ANY)125 service_meter.timing("busy.ping", ANY)
132 mocker.count(0, None)126 mocker.count(0, None)
133127
134 revno()
135 mocker.count(0, None)
136
137 with mocker:128 with mocker:
138 yield self.service.stopService()129 yield self.service.stopService()
139 yield self.service.startService()130 yield self.service.startService()
140131
=== added file 'requirements-devel.txt'
--- requirements-devel.txt 1970-01-01 00:00:00 +0000
+++ requirements-devel.txt 2018-04-12 02:08:49 +0000
@@ -0,0 +1,8 @@
1flake8
2dbus-python
3pygobject
4meliae
5mock
6mocker
7pyinotify
8rst2html5
09
=== added file 'requirements.txt'
--- requirements.txt 1970-01-01 00:00:00 +0000
+++ requirements.txt 2018-04-12 02:08:49 +0000
@@ -0,0 +1,17 @@
1Django<1.10
2bzr
3configglue
4cython
5pyOpenSSL
6protobuf
7psycopg2-binary
8# From twisted UserWarning: You do not have a working installation of the
9# service_identity module: 'No module named service_identity'. Please install
10# it from <https://pypi.python.org/pypi/service_identity> and make sure all of
11# its dependencies are satisfied. Without the service_identity module, Twisted
12# can perform only rudimentary TLS client hostname verification. Many valid
13# certificate/hostname mappings may be rejected.
14service_identity
15supervisor
16twisted
17https://launchpad.net/dirspec/stable-13-10/13.10/+download/dirspec-13.10.tar.gz
018
=== modified file 'test'
--- test 2018-04-05 20:57:19 +0000
+++ test 2018-04-12 02:08:49 +0000
@@ -54,10 +54,10 @@
54 with open(dbus_address_file) as fh:54 with open(dbus_address_file) as fh:
55 os.environ["DBUS_SESSION_BUS_ADDRESS"] = fh.read().strip()55 os.environ["DBUS_SESSION_BUS_ADDRESS"] = fh.read().strip()
5656
57 # install the glib2reactor before any import of the reactor to avoid57 # install the twisted reactor before any import of the reactor to avoid
58 # using the default SelectReactor and be able to run the dbus tests58 # using the default SelectReactor and be able to run the dbus tests
59 from twisted.internet import glib2reactor59 from twisted.internet import gireactor
60 glib2reactor.install()60 gireactor.install()
6161
6262
63if __name__ == "__main__":63if __name__ == "__main__":

Subscribers

People subscribed via source and target branches

to all changes: