diff --git a/.docker-base/Dockerfile b/.docker-base/Dockerfile index 923924e75e03c6ca8346b17cdf87eda78efd766f..02c7d5c3045f527c1f17c678633c0f42ee8ce3a5 100644 --- a/.docker-base/Dockerfile +++ b/.docker-base/Dockerfile @@ -1,12 +1,12 @@ # Use docker as parent image -FROM docker:19.03.0 +FROM docker:20.10 # http://bugs.python.org/issue19846 ENV LANG C.UTF-8 # install dependencies RUN apk add --no-cache py3-pip python3 python3-dev gcc make \ - git bash curl gettext py3-requests + git bash curl gettext py3-requests RUN apk add --no-cache libffi-dev openssl-dev libc-dev libxslt libxslt-dev \ libxml2 libxml2-dev diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8ebbefaa39650ddaff45b856a8a4d44a2ac495d1..73a9abb0b5a525ddb74ddbf33003b03e35c1cacf 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -58,8 +58,8 @@ test: - cd .docker - /bin/sh ./run.sh - cd .. - - docker logs docker_caosdb-server_1 &> caosdb_log.txt - - docker logs docker_sqldb_1 &> mariadb_log.txt + - docker logs docker-caosdb-server-1 &> caosdb_log.txt + - docker logs docker-sqldb-1 &> mariadb_log.txt - docker-compose -f .docker/docker-compose.yml down - rc=`cat .docker/result` - exit $rc diff --git a/src/caosadvancedtools/crawler.py b/src/caosadvancedtools/crawler.py index 0159688c7c7d59e779d576aed54b176e802fca85..099b8fd86656bd326c91e7754fa32a3d4ba76564 100644 --- a/src/caosadvancedtools/crawler.py +++ b/src/caosadvancedtools/crawler.py @@ -428,9 +428,9 @@ class Crawler(object): # only done in SSS mode if "SHARED_DIR" in os.environ: - filename = self.save_form([el[3] - for el in pending_changes], path) - self.send_mail([el[3] for el in pending_changes], filename) + filename = Crawler.save_form([el[3] + for el in pending_changes], path, self.run_id) + Crawler.send_mail([el[3] for el in pending_changes], filename) for i, el in enumerate(pending_changes): @@ -441,8 +441,7 @@ ____________________\n""".format(i+1, len(pending_changes)) + str(el[3])) logger.info("There where unauthorized changes (see above). An " "email was sent to the curator.\n" "You can authorize the updates by invoking the crawler" - " with the run id: {rid}\n".format(rid=self.run_id, - path=path)) + " with the run id: {rid}\n".format(rid=self.run_id)) if len(DataModelProblems.missing) > 0: err_msg = ("There were problems with one or more RecordType or " @@ -465,7 +464,8 @@ ____________________\n""".format(i+1, len(pending_changes)) + str(el[3])) else: logger.info("Crawler terminated successfully!") - def save_form(self, changes, path): + @staticmethod + def save_form(changes, path, run_id): """ Saves an html website to a file that contains a form with a button to authorize the given changes. @@ -547,13 +547,13 @@ ____________________\n""".format(i+1, len(pending_changes)) + str(el[3])) </body> </html> """.format(url=db.configuration.get_config()["Connection"]["url"], - rid=self.run_id, + rid=run_id, changes=escape("\n".join(changes)), path=path) if "SHARED_DIR" in os.environ: directory = os.environ["SHARED_DIR"] - filename = str(self.run_id)+".html" + filename = str(run_id)+".html" randname = os.path.basename(os.path.abspath(directory)) filepath = os.path.abspath(os.path.join(directory, filename)) filename = os.path.join(randname, filename) @@ -561,7 +561,8 @@ ____________________\n""".format(i+1, len(pending_changes)) + str(el[3])) f.write(form) return filename - def send_mail(self, changes, filename): + @staticmethod + def send_mail(changes, filename): """ calls sendmail in order to send a mail to the curator about pending changes