From 211513b2a4e2cfcaeb3814bc1391365e9ac00c61 Mon Sep 17 00:00:00 2001 From: Matthew Duggan Date: Mon, 21 Oct 2019 11:32:36 +0900 Subject: [PATCH] Upgrade vagrant config to Ubuntu 18.04 and fix mongo 3 incompatibility (fixes #491) --- Vagrantfile | 2 +- bootstrap.sh | 20 ++++++++------------ tapiriik/services/Dropbox/dropbox.py | 5 ++++- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index 444ee9d88..ca9629196 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -10,7 +10,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # please see the online documentation at vagrantup.com. # Every Vagrant virtual environment requires a box to build off of. - config.vm.box = "bento/ubuntu-14.04" + config.vm.box = "bento/ubuntu-18.04" # Disable automatic box update checking. If you disable this, then # boxes will only be checked for updates when the user runs diff --git a/bootstrap.sh b/bootstrap.sh index ea1bd4f71..c6654a364 100644 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -1,25 +1,21 @@ #!/usr/bin/env bash # Install system requirements - -# mongodb multipolygon geojson support needs at least mongodb 2.6. trusty has 2.4 by default -sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10 -echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list - - sudo apt-get update -sudo apt-get install -y python3-pip libxml2-dev libxslt-dev zlib1g-dev git redis-server rabbitmq-server mongodb-org=2.6.9 +sudo apt-get install -y python3-pip libxml2-dev libxslt-dev zlib1g-dev git redis-server rabbitmq-server mongodb-server -# Fix pip +# upgrade pip pip3 install --upgrade pip +# Fix the default python and pip instance +update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1 +update-alternatives --install /usr/bin/python python /usr/bin/python3.6 2 +update-alternatives --install /usr/bin/pip pip /usr/local/bin/pip3 1 +update-alternatives --force --install /usr/bin/pip3 pip3 /usr/local/bin/pip3 1 + # Install app requirements pip install --upgrade -r /vagrant/requirements.txt -# Fix the default python instance -update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1 -update-alternatives --install /usr/bin/python python /usr/bin/python3.4 2 - # Put in a default local_settings.py (if one doesn't exist) if [ ! -f /vagrant/tapiriik/local_settings.py ]; then cp /vagrant/tapiriik/local_settings.py.example /vagrant/tapiriik/local_settings.py diff --git a/tapiriik/services/Dropbox/dropbox.py b/tapiriik/services/Dropbox/dropbox.py index 2c53e68e9..364b6bdb0 100644 --- a/tapiriik/services/Dropbox/dropbox.py +++ b/tapiriik/services/Dropbox/dropbox.py @@ -178,7 +178,10 @@ def cache_writeback(): cachedb.dropbox_cache.save(cache) else: insert_result = cachedb.dropbox_cache.insert(cache) - cache["_id"] = insert_result.inserted_id + if hasattr(insert_result, 'inserted_id'): + cache["_id"] = insert_result.inserted_id + else: + cache["_id"] = insert_result activities = []