From 4903e521423635b20c6d1bfdb7b59fc05cc5675f Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Tue, 25 Feb 2020 13:39:12 +0100 Subject: [PATCH 01/27] fix typo --- docu/docs/plugin/telegram.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docu/docs/plugin/telegram.md b/docu/docs/plugin/telegram.md index 1eb5a01..cc5f0b2 100644 --- a/docu/docs/plugin/telegram.md +++ b/docu/docs/plugin/telegram.md @@ -3,7 +3,7 @@ ## Beschreibung Mit diesem Plugin ist es moeglich, Telegram-Nachrichten für POCSAG-Alarmierungen zu senden. -Außerdem werden Locations versenden, wenn die Felder `lat` und `lon` im Paket definiert sind. (beispielsweise durch das [Geocoding](../modul/geocoding.md) Modul) +Außerdem werden Locations versendet, wenn die Felder `lat` und `lon` im Paket definiert sind. (beispielsweise durch das [Geocoding](../modul/geocoding.md) Modul) ## Unterstütze Alarmtypen - Pocsag From 514a142521035d01eefae4441c71d3c97a6150f8 Mon Sep 17 00:00:00 2001 From: Philipp von Kirschbaum Date: Sat, 11 Apr 2020 15:00:49 +0200 Subject: [PATCH 02/27] fixed zvei bug - issue #23 --- boswatch/decoder/zveiDecoder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boswatch/decoder/zveiDecoder.py b/boswatch/decoder/zveiDecoder.py index 312435a..9bfd9d7 100644 --- a/boswatch/decoder/zveiDecoder.py +++ b/boswatch/decoder/zveiDecoder.py @@ -42,7 +42,7 @@ class ZveiDecoder: bwPacket = Packet() bwPacket.set("mode", "zvei") - bwPacket.set("zvei", ZveiDecoder._solveDoubleTone(data[7:12])) + bwPacket.set("tone", ZveiDecoder._solveDoubleTone(data[7:12])) return bwPacket From 61312b76deea4e3d052911d9ff89b4c3b393b9af Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Sat, 11 Apr 2020 15:11:18 +0200 Subject: [PATCH 03/27] run pytest also on PRs --- .github/workflows/run_pytest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run_pytest.yml b/.github/workflows/run_pytest.yml index 0b059ff..1b12138 100644 --- a/.github/workflows/run_pytest.yml +++ b/.github/workflows/run_pytest.yml @@ -1,6 +1,6 @@ name: pytest -on: [push] +on: [push, pull_request] jobs: build: From 78958b1795d7f2ffa4d7ab795f293c87f1bfa78b Mon Sep 17 00:00:00 2001 From: Jan Speller Date: Sat, 11 Apr 2020 21:43:43 +0200 Subject: [PATCH 04/27] add assert and warning for python version --- bw_client.py | 5 +++++ bw_server.py | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/bw_client.py b/bw_client.py index 14da3af..69b953b 100644 --- a/bw_client.py +++ b/bw_client.py @@ -16,6 +16,11 @@ """ # pylint: disable=wrong-import-position # pylint: disable=wrong-import-order + +import sys +major_version = sys.version_info.major +assert major_version >= 3, "please use python3 to run BosWatch 3" + from boswatch.utils import paths if not paths.makeDirIfNotExist(paths.LOG_PATH): diff --git a/bw_server.py b/bw_server.py index 5b0e6af..d84c8d1 100644 --- a/bw_server.py +++ b/bw_server.py @@ -16,6 +16,11 @@ """ # pylint: disable=wrong-import-position # pylint: disable=wrong-import-order + +import sys +major_version = sys.version_info.major +assert major_version >= 3, "please use python3 to run BosWatch 3" + from boswatch.utils import paths if not paths.makeDirIfNotExist(paths.LOG_PATH): From be898b8a1e60f65ff44d13208dafc5835e80d040 Mon Sep 17 00:00:00 2001 From: Smeti <31766315+Smeti1@users.noreply.github.com> Date: Mon, 13 Apr 2020 16:18:18 +0200 Subject: [PATCH 05/27] Create install.sh (#27) * Create install.sh sudo bash install.sh * Update install.sh * Update install.sh * Update install.sh * Update install.sh * Update install.sh * Update install.sh * Update install.sh * Update install.sh --- install.sh | 226 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 226 insertions(+) create mode 100644 install.sh diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..7c0611c --- /dev/null +++ b/install.sh @@ -0,0 +1,226 @@ +#!/bin/bash +# -*- coding: utf-8 -*- +""" + ____ ____ ______ __ __ __ _____ + / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / + / __ / / / /\__ \| | /| / / __ / __/ ___/ __ \ /_ < + / /_/ / /_/ /___/ /| |/ |/ / /_/ / /_/ /__/ / / / ___/ / +/_____/\____//____/ |__/|__/\__,_/\__/\___/_/ /_/ /____/ + German BOS Information Script + by Bastian Schroll +@file: install.sh +@date: 14.04.2020 +@author: Bastian Schroll, Smeti +@description: Installation File for BOSWatch3 +""" + +""" +Die Installation von BOSWatch3 wird mittels diesem bash-Skript weitestgehend automatisiert durchgeführt. +Zunächst wird das aktuelle Installationsskript heruntergeladen: +wget https://github.com/BOSWatch/BW3-Core/raw/master/install.sh +Im Anschluss wird das Skript mit dem Kommando +sudo bash install.sh +ausgeführt. +Standardmäßig wird das Programm nach /opt/boswatch3 installiert. Folgende Parameter stehen zur Installation zur Verfügung: +Parameter zulässige Werte Funktion +-r / --reboot - Reboot nach Installation (Ohne Angabe: Kein Reboot) +-b / --branch dev Installiert einen anderen Branch (dev nicht empfohlen!) +-p / --path /your/path Installiert in ein anderes Verzeichnis (nicht empfohlen!) + master ist der stabile, zur allgemeinen Nutzung vorgesehene Branch + develop ist der aktuelle Entwicklungs-Branch (Nur für Entwickler empfohlen) +""" + + +function exitcodefunction { + errorcode=$1 + action=$2 + module=$3 + + if [ $errorcode -ne "0" ]; then + echo "Action: $action on $module failed." >> $boswatchpath/install/setup_log.txt + echo "Exitcode: $errorcode" >> $boswatchpath/install/setup_log.txt + echo "" + echo "Action: $action on $module failed." + echo "Exitcode: $errorcode" + echo "" + echo " -> If you want to open an issue at https://github.com/BOSWatch/BW3-Core/issues" + echo " please post the logfile, located at $boswatchpath/install/setup_log.txt" + exit 1 + else + echo "Action: $action on $module ok." >> $boswatchpath/install/setup_log.txt + fi + } + +tput clear +tput civis +echo " ____ ____ ______ __ __ __ _____ " +echo " / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / " +echo " / __ / / / /\__ \| | /| / / __ / __/ ___/ __ \ /_ < " +echo " / /_/ / /_/ /___/ /| |/ |/ / /_/ / /_/ /__/ / / / ___/ / " +echo "/_____/\____//____/ |__/|__/\__,_/\__/\___/_/ /_/ /____/ " +echo " German BOS Information Script " +echo " by Bastian Schroll " +echo "" + + + +# Make sure only root can run our script +if [[ $EUID -ne 0 ]]; then + echo "This script must be run as root!" 1>&2 + exit 1 +fi + +echo "This may take several minutes... Don't panic!" +echo "" +echo "Caution, script does not install a webserver with PHP and MySQL" +echo "So you have to make up manually if you want to use MySQL support" + +boswatchpath=/opt/boswatch3 +reboot=false + +for (( i=1; i<=$#; i=$i+2 )); do + t=$((i + 1)) + eval arg=\$$i + eval arg2=\$$t + + case $arg in + -r|--reboot) reboot=true ;; + + -b|--branch) + case $arg2 in + dev|develop) echo " !!! WARNING: you are using the DEV BRANCH !!! "; branch=dev ;; + *) branch=master ;; + esac ;; + + -p|--path) echo " !!! WARNING: you'll install BOSWATCH to alternative path !!! "; boswatchpath=$arg2 ;; + + *) echo "Internal error!" ; exit 1 ;; + esac +done + +mkdir -p $boswatchpath +mkdir -p $boswatchpath/install + +echo "" + +tput cup 13 15 +echo "[ 1/9] [#--------]" +tput cup 15 5 +echo "-> make an apt-get update................" +apt-get update -y > $boswatchpath/install/setup_log.txt 2>&1 + +tput cup 13 15 +echo "[ 2/9] [##-------]" +tput cup 15 5 +echo "-> download GIT and other stuff.........." +apt-get -y install git cmake build-essential libusb-1.0 qt4-qmake qt4-default libpulse-dev libx11-dev sox >> $boswatchpath/install/setup_log.txt 2>&1 +exitcodefunction $? download stuff + +tput cup 13 15 +echo "[ 3/9] [###------]" +tput cup 15 5 +echo "-> download Python, Yaml and other stuff.." +sudo apt-get -y install python3 python3-yaml >> $boswatchpath/install/setup_log.txt 2>&1 +exitcodefunction $? download python + +tput cup 13 15 +echo "[ 4/9] [####-----]" +tput cup 15 5 +echo "-> download rtl_fm........................." +cd $boswatchpath/install +git clone --branch v0.5.4 https://github.com/osmocom/rtl-sdr.git rtl-sdr >> $boswatchpath/install/setup_log.txt 2>&1 +exitcodefunction $? git-clone rtl-sdr +cd $boswatchpath/install/rtl-sdr/ + +tput cup 13 15 +echo "[ 5/9] [#####----]" +tput cup 15 5 +echo "-> compile rtl_fm......................" +mkdir -p build && cd build +cmake ../ -DINSTALL_UDEV_RULES=ON >> $boswatchpath/install/setup_log.txt 2>&1 +exitcodefunction $? cmake rtl-sdr + +make >> $boswatchpath/install/setup_log.txt 2>&1 +exitcodefunction $? make rtl-sdr + +make install >> $boswatchpath/install/setup_log.txt 2>&1 +exitcodefunction $? make-install rtl-sdr + +ldconfig >> $boswatchpath/install/setup_log.txt 2>&1 +exitcodefunction $? ldconfig rtl-sdr + +tput cup 13 15 +echo "[ 6/9] [######---]" +tput cup 15 5 +echo "-> download multimon-ng................" +cd $boswatchpath/install +git clone --branch 1.1.8 https://github.com/EliasOenal/multimon-ng.git multimonNG >> $boswatchpath/install/setup_log.txt 2>&1 +exitcodefunction $? git-clone multimonNG + +cd $boswatchpath/install/multimonNG/ + +tput cup 13 15 +echo "[ 7/9] [#######--]" +tput cup 15 5 +echo "-> compile multimon-ng................." +mkdir -p build +cd build +qmake ../multimon-ng.pro >> $boswatchpath/install/setup_log.txt 2>&1 +exitcodefunction $? qmake multimonNG + +make >> $boswatchpath/install/setup_log.txt 2>&1 +exitcodefunction $? make multimonNG + +make install >> $boswatchpath/install/setup_log.txt 2>&1 +exitcodefunction $? qmakeinstall multimonNG + +tput cup 13 15 +echo "[ 8/9] [########-]" +tput cup 15 5 +echo "-> download BOSWatch3.................." +cd $boswatchpath/ + +case $branch in + "dev") git clone -b develop https://github.com/BOSWatch/BW3-Core >> $boswatchpath/install/setup_log.txt 2>&1 && \ + exitcodefunction $? git-clone BW3-Core-develop ;; + *) git clone -b master https://github.com/BOSWatch/BW3-Core >> $boswatchpath/install/setup_log.txt 2>&1 && \ + exitcodefunction $? git-clone BW3-Core ;; +esac + +tput cup 13 15 +echo "[9/9] [#########]" +tput cup 15 5 +echo "-> configure..........................." +cd $boswatchpath/ +chmod +x * +echo $'# BOSWatch3 - blacklist the DVB drivers to avoid conflicts with the SDR driver\n blacklist dvb_usb_rtl28xxu \n blacklist rtl2830\n blacklist dvb_usb_v2\n blacklist dvb_core' >> /etc/modprobe.d/boswatch_blacklist_sdr.conf + +tput cup 17 1 +tput rev # Schrift zur besseren lesbarkeit Revers +echo "BOSWatch is now installed in $boswatchpath/ Installation ready!" +tput sgr0 # Schrift wieder Normal +tput cup 19 3 +echo "Watch out: to run BOSWatch3 you have to modify the server.yaml and client.yaml!" +echo "Do the following step to do so:" +echo "sudo nano $boswatchpath/config/client.yaml eg. server.yaml" +echo "and modify the config as you need. This step is optional if you are upgrading an old version of BOSWatch3." +echo "You can read the instructions on https://docs.boswatch.de/" +tput setaf 1 # Rote Schrift +echo "Please REBOOT bevor the first start" +tput setaf 9 # Schrift zurücksetzen +echo "start Boswatch3 with" +echo "sudo python3 bw_client.py -c client.yaml and sudo python3 bw_server.py -c server.yaml" + +tput cnorm + +# cleanup +mkdir $boswatchpath/log/install -p +mv $boswatchpath/install/setup_log.txt $boswatchpath/log/install/ +rm $boswatchpath/install/ -R + +mv $boswatchpath/BW3-Core/* $boswatchpath/ +rm $boswatchpath/BW3-Core -R + +if [ $reboot = "true" ]; then + /sbin/reboot +fi From fc2b23891e8627388a73a5fb6cf6a1f9907902dd Mon Sep 17 00:00:00 2001 From: Jan Speller Date: Mon, 13 Apr 2020 18:38:00 +0200 Subject: [PATCH 06/27] change telegram docu for better understandability --- docu/docs/plugin/telegram.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docu/docs/plugin/telegram.md b/docu/docs/plugin/telegram.md index cc5f0b2..c072556 100644 --- a/docu/docs/plugin/telegram.md +++ b/docu/docs/plugin/telegram.md @@ -26,9 +26,9 @@ Außerdem werden Locations versendet, wenn die Felder `lat` und `lon` im Paket d res: telegram config: message: "{RIC}({SRIC})\n{MSG}" - botToken: "{{ Telegram Bot Token }}" - chatIds: - - "{{ Telegram Chat Id }}" + botToken: "BOT_TOKEN" + chatIds: + - "CHAT_ID" ``` --- From 370ad5ac85232e79b3c953417c29ba86611e2d09 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Tue, 14 Apr 2020 18:33:49 +0200 Subject: [PATCH 07/27] add descriptor unit test --- test/module/test_descriptor.py | 61 ++++++++++++++++++++++++++++++++++ test/pytest.ini | 2 +- test/test_config.yaml | 9 +++++ 3 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 test/module/test_descriptor.py diff --git a/test/module/test_descriptor.py b/test/module/test_descriptor.py new file mode 100644 index 0000000..c064170 --- /dev/null +++ b/test/module/test_descriptor.py @@ -0,0 +1,61 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +"""! + ____ ____ ______ __ __ __ _____ + / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ |__ / + / __ / / / /\__ \| | /| / / __ `/ __/ ___/ __ \ /_ < + / /_/ / /_/ /___/ /| |/ |/ / /_/ / /_/ /__/ / / / ___/ / +/_____/\____//____/ |__/|__/\__,_/\__/\___/_/ /_/ /____/ + German BOS Information Script + by Bastian Schroll + +@file: test_descriptor.py +@date: 14.04.2020 +@author: Bastian Schroll +@description: Unittests for BOSWatch. File have to run as "pytest" unittest +""" +# problem of the pytest fixtures +# pylint: disable=redefined-outer-name +import logging +import pytest +from boswatch.utils import paths + +from boswatch.configYaml import ConfigYAML +from boswatch.packet import Packet +from module.descriptor import BoswatchModule as Descriptor + + +def setup_method(method): + logging.debug("[TEST] %s.%s", method.__module__, method.__name__) + + +@pytest.fixture +def makeDescriptor(): + config = ConfigYAML() + assert config.loadConfigFile(paths.TEST_PATH + "test_config.yaml") is True + descriptor = Descriptor(config.get("descriptor_test")) + return descriptor + + +@pytest.fixture +def makePacket(): + packet = Packet() + return packet + + +def test_descriptorFoundFirst(makeDescriptor, makePacket): + makePacket.set("tone", "12345") + makePacket = makeDescriptor.doWork(makePacket) + assert makePacket.get("description") == "Test 12345" + + +def test_descriptorFoundSecond(makeDescriptor, makePacket): + makePacket.set("tone", "23456") + makePacket = makeDescriptor.doWork(makePacket) + assert makePacket.get("description") == "Test 23456" + + +def test_descriptorNotFound(makeDescriptor, makePacket): + makePacket.set("tone", "99999") + makePacket = makeDescriptor.doWork(makePacket) + assert makePacket.get("description") == "99999" diff --git a/test/pytest.ini b/test/pytest.ini index 6e8fc02..e5d4311 100644 --- a/test/pytest.ini +++ b/test/pytest.ini @@ -8,7 +8,7 @@ # by Bastian Schroll [pytest] -addopts = -v --pep8 --flakes --cov=boswatch/ --cov-report=term-missing --log-level=CRITICAL +addopts = -v --pep8 --flakes --cov=boswatch/ --cov=module/ --cov plugin/ --cov-report=term-missing --log-level=CRITICAL # classic or progress console_output_style = progress diff --git a/test/test_config.yaml b/test/test_config.yaml index 6840f26..f20f454 100644 --- a/test/test_config.yaml +++ b/test/test_config.yaml @@ -30,3 +30,12 @@ list1: - two - three - string1 + +descriptor_test: + - scanField: tone + descrField: description + descriptions: + - for: 12345 + add: Test 12345 + - for: 23456 + add: Test 23456 \ No newline at end of file From e5141c186d3dfad983eac9c3fb6ea420a0507f4e Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Tue, 14 Apr 2020 18:47:12 +0200 Subject: [PATCH 08/27] add comments --- test/module/test_descriptor.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/module/test_descriptor.py b/test/module/test_descriptor.py index c064170..6309e79 100644 --- a/test/module/test_descriptor.py +++ b/test/module/test_descriptor.py @@ -31,6 +31,7 @@ def setup_method(method): @pytest.fixture def makeDescriptor(): + """!Build a descriptor object with loaded configuration""" config = ConfigYAML() assert config.loadConfigFile(paths.TEST_PATH + "test_config.yaml") is True descriptor = Descriptor(config.get("descriptor_test")) @@ -39,23 +40,27 @@ def makeDescriptor(): @pytest.fixture def makePacket(): + """!Build a BW Packet object""" packet = Packet() return packet def test_descriptorFoundFirst(makeDescriptor, makePacket): + """!Run descriptor on the first entry in list""" makePacket.set("tone", "12345") makePacket = makeDescriptor.doWork(makePacket) assert makePacket.get("description") == "Test 12345" def test_descriptorFoundSecond(makeDescriptor, makePacket): + """!Run descriptor on the second entry in list""" makePacket.set("tone", "23456") makePacket = makeDescriptor.doWork(makePacket) assert makePacket.get("description") == "Test 23456" def test_descriptorNotFound(makeDescriptor, makePacket): + """!Run descriptor on a non existent field""" makePacket.set("tone", "99999") makePacket = makeDescriptor.doWork(makePacket) assert makePacket.get("description") == "99999" From 7ee5df0616c01ac6ee99b3deb5ddd5cba00ff6e6 Mon Sep 17 00:00:00 2001 From: Jan Speller Date: Tue, 14 Apr 2020 22:17:53 +0200 Subject: [PATCH 09/27] fix docu zvei->tone --- docu/docs/modul/descriptor.md | 2 +- docu/docs/modul/regex_filter.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docu/docs/modul/descriptor.md b/docu/docs/modul/descriptor.md index a472b0f..73cdc50 100644 --- a/docu/docs/modul/descriptor.md +++ b/docu/docs/modul/descriptor.md @@ -34,7 +34,7 @@ Informationen zum Aufbau eines [BOSWatch Pakets](../develop/packet.md) - type: module res: descriptor config: - - scanField: zvei + - scanField: tone descrField: description wildcard: "{DESCR}" descriptions: diff --git a/docu/docs/modul/regex_filter.md b/docu/docs/modul/regex_filter.md index 77e0a1d..9e69db2 100644 --- a/docu/docs/modul/regex_filter.md +++ b/docu/docs/modul/regex_filter.md @@ -43,7 +43,7 @@ Vereinfacht kann man sagen, dass einzelnen Router ODER-verknüpft und die jeweil config: - name: "Zvei filter" checks: - - field: zvei + - field: tone regex: "65[0-9]{3}" # all zvei with starting 65 - name: "FMS Stat 3" checks: From 806a3d866921deb10c819fbc68e6eda758196419 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Wed, 15 Apr 2020 08:35:00 +0200 Subject: [PATCH 10/27] add non existent field test --- test/module/test_descriptor.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/module/test_descriptor.py b/test/module/test_descriptor.py index 6309e79..67cd4e3 100644 --- a/test/module/test_descriptor.py +++ b/test/module/test_descriptor.py @@ -60,7 +60,13 @@ def test_descriptorFoundSecond(makeDescriptor, makePacket): def test_descriptorNotFound(makeDescriptor, makePacket): - """!Run descriptor on a non existent field""" + """!Run descriptor no matching data found""" makePacket.set("tone", "99999") makePacket = makeDescriptor.doWork(makePacket) assert makePacket.get("description") == "99999" + + +def test_descriptorScanFieldNotAvailable(makeDescriptor, makePacket): + """!Run descriptor on a non existent scanField""" + makePacket = makeDescriptor.doWork(makePacket) + assert makePacket.get("description") == None \ No newline at end of file From 61819cda0879761255d66461934fec5daa458ea1 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Wed, 15 Apr 2020 08:52:44 +0200 Subject: [PATCH 11/27] little fix --- test/module/test_descriptor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/module/test_descriptor.py b/test/module/test_descriptor.py index 67cd4e3..48bb2eb 100644 --- a/test/module/test_descriptor.py +++ b/test/module/test_descriptor.py @@ -69,4 +69,4 @@ def test_descriptorNotFound(makeDescriptor, makePacket): def test_descriptorScanFieldNotAvailable(makeDescriptor, makePacket): """!Run descriptor on a non existent scanField""" makePacket = makeDescriptor.doWork(makePacket) - assert makePacket.get("description") == None \ No newline at end of file + assert makePacket.get("description") is None \ No newline at end of file From 8e4dba28e3480384c7139fd43aa0b29aef06ba5b Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Wed, 15 Apr 2020 09:24:02 +0200 Subject: [PATCH 12/27] PEP8 new line at end --- test/module/test_descriptor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/module/test_descriptor.py b/test/module/test_descriptor.py index 48bb2eb..c2d63a2 100644 --- a/test/module/test_descriptor.py +++ b/test/module/test_descriptor.py @@ -69,4 +69,4 @@ def test_descriptorNotFound(makeDescriptor, makePacket): def test_descriptorScanFieldNotAvailable(makeDescriptor, makePacket): """!Run descriptor on a non existent scanField""" makePacket = makeDescriptor.doWork(makePacket) - assert makePacket.get("description") is None \ No newline at end of file + assert makePacket.get("description") is None From 79b66a8668b94403ed4878d3ca8e095f13763e9f Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Fri, 17 Apr 2020 09:44:00 +0200 Subject: [PATCH 13/27] add basic docs build workflow --- .github/workflows/build_docs.yml | 33 ++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/build_docs.yml diff --git a/.github/workflows/build_docs.yml b/.github/workflows/build_docs.yml new file mode 100644 index 0000000..7634d46 --- /dev/null +++ b/.github/workflows/build_docs.yml @@ -0,0 +1,33 @@ +name: build_docs + +#on: push +on: [push, pull_request] + branches: + - master + - develop + paths: + - 'docu/**' + +jobs: + + build_docs: + name: Build documentation + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v1 + + - name: Build doxygen + uses: mattnotmitt/doxygen-action@v1 + with: + working-directory: './' + doxyfile-path: 'docu/doxygen.ini' + + - name: Build mkdocs + run: | + python -m pip install --upgrade pip + pip install mkdocs + mkdocs build -f docu/mkdocs.yml + + - name: Upload to docs-server From 61a61d1f25e87b3059938aeb1d6d0fb3ec414af3 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Fri, 17 Apr 2020 09:55:40 +0200 Subject: [PATCH 14/27] basic test --- .github/workflows/build_docs.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/build_docs.yml b/.github/workflows/build_docs.yml index 7634d46..a7f438b 100644 --- a/.github/workflows/build_docs.yml +++ b/.github/workflows/build_docs.yml @@ -1,12 +1,6 @@ name: build_docs -#on: push on: [push, pull_request] - branches: - - master - - develop - paths: - - 'docu/**' jobs: From 195215ac464dc515d7d73ea8ddc536a5a3ffe087 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Fri, 17 Apr 2020 09:56:31 +0200 Subject: [PATCH 15/27] add missing run --- .github/workflows/build_docs.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build_docs.yml b/.github/workflows/build_docs.yml index a7f438b..8ed2b59 100644 --- a/.github/workflows/build_docs.yml +++ b/.github/workflows/build_docs.yml @@ -25,3 +25,4 @@ jobs: mkdocs build -f docu/mkdocs.yml - name: Upload to docs-server + run: echo 'test' From 2767b6f60301cc2397ba55d98bff5e55363ea642 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Fri, 17 Apr 2020 09:58:17 +0200 Subject: [PATCH 16/27] fix mkdocs call --- .github/workflows/build_docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_docs.yml b/.github/workflows/build_docs.yml index 8ed2b59..51e1c62 100644 --- a/.github/workflows/build_docs.yml +++ b/.github/workflows/build_docs.yml @@ -22,7 +22,7 @@ jobs: run: | python -m pip install --upgrade pip pip install mkdocs - mkdocs build -f docu/mkdocs.yml + python -m mkdocs build -f docu/mkdocs.yml - name: Upload to docs-server run: echo 'test' From 985820540dfc8ed2800ca84c9c3c4a222010fdd6 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Fri, 17 Apr 2020 10:13:24 +0200 Subject: [PATCH 17/27] add SCP upload --- .github/workflows/build_docs.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_docs.yml b/.github/workflows/build_docs.yml index 51e1c62..984e59a 100644 --- a/.github/workflows/build_docs.yml +++ b/.github/workflows/build_docs.yml @@ -25,4 +25,11 @@ jobs: python -m mkdocs build -f docu/mkdocs.yml - name: Upload to docs-server - run: echo 'test' + uses: appleboy/scp-action@master + with: + host: ${{ secrets.SCP_HOST }} + port: ${{ secrets.SCP_PORT }} + username: ${{ secrets.SCP_USERNAME }} + password: ${{ secrets.SCP_PASSWORD }} + source: "docu/site/**" + target: ${{ secrets.SCP_TARGET_PATH }} \ No newline at end of file From 4170e31355a67b91284bf8d525f718af7834c6fe Mon Sep 17 00:00:00 2001 From: Schrolli91 Date: Fri, 17 Apr 2020 23:17:27 +0200 Subject: [PATCH 18/27] update workflow --- .github/workflows/build_docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_docs.yml b/.github/workflows/build_docs.yml index 984e59a..0270ece 100644 --- a/.github/workflows/build_docs.yml +++ b/.github/workflows/build_docs.yml @@ -1,6 +1,6 @@ name: build_docs -on: [push, pull_request] +on: [push] jobs: From b2beafe190484f5b1ef9712f48150c7e3cc67069 Mon Sep 17 00:00:00 2001 From: Schrolli91 Date: Fri, 17 Apr 2020 23:19:16 +0200 Subject: [PATCH 19/27] test --- docu/docs/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docu/docs/index.md b/docu/docs/index.md index 114a3a5..7401f93 100644 --- a/docu/docs/index.md +++ b/docu/docs/index.md @@ -1,4 +1,4 @@ -#
BOSWatch 3
+#
BOSWatch 3 test
---
From 6b0724baf5e17cf1336f0e60c57577346e8cf41d Mon Sep 17 00:00:00 2001 From: Schrolli91 Date: Fri, 17 Apr 2020 23:22:09 +0200 Subject: [PATCH 20/27] test --- docu/docs/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docu/docs/index.md b/docu/docs/index.md index 7401f93..114a3a5 100644 --- a/docu/docs/index.md +++ b/docu/docs/index.md @@ -1,4 +1,4 @@ -#
BOSWatch 3 test
+#
BOSWatch 3
---
From 72c795562b6224d8038763ecb95cbe6fdef65107 Mon Sep 17 00:00:00 2001 From: Schrolli91 Date: Fri, 17 Apr 2020 23:26:09 +0200 Subject: [PATCH 21/27] add strip_components --- .github/workflows/build_docs.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_docs.yml b/.github/workflows/build_docs.yml index 0270ece..dccc187 100644 --- a/.github/workflows/build_docs.yml +++ b/.github/workflows/build_docs.yml @@ -32,4 +32,5 @@ jobs: username: ${{ secrets.SCP_USERNAME }} password: ${{ secrets.SCP_PASSWORD }} source: "docu/site/**" - target: ${{ secrets.SCP_TARGET_PATH }} \ No newline at end of file + target: ${{ secrets.SCP_TARGET_PATH }} + strip_components: 2 \ No newline at end of file From 85b7cb34685a73cbbcb2c086c93d212dbd4e7526 Mon Sep 17 00:00:00 2001 From: Schrolli91 Date: Fri, 17 Apr 2020 23:38:14 +0200 Subject: [PATCH 22/27] add py 3.8 for tests --- .github/workflows/run_pytest.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/run_pytest.yml b/.github/workflows/run_pytest.yml index 1b12138..cd60fa9 100644 --- a/.github/workflows/run_pytest.yml +++ b/.github/workflows/run_pytest.yml @@ -9,22 +9,27 @@ jobs: max-parallel: 3 matrix: os: [ubuntu-latest] - python-version: [3.5, 3.6, 3.7] + python-version: [3.5, 3.6, 3.7, 3.8] runs-on: ${{matrix.os}} + steps: - uses: actions/checkout@v1 + - name: Set up Python ${{matrix.python-version}} at ${{matrix.os}} uses: actions/setup-python@v1 with: python-version: ${{matrix.python-version}} + - name: Install dependencies run: | python -m pip install --upgrade pip pip install -r requirements.txt mkdir log/ + - name: Test with pytest run: | pytest -c 'test/pytest.ini' + - name: Save artifacts uses: actions/upload-artifact@master with: From af2fa094a05e2a2603407de3aace1297903b7fd3 Mon Sep 17 00:00:00 2001 From: Schrolli91 Date: Fri, 17 Apr 2020 23:40:43 +0200 Subject: [PATCH 23/27] remove max parallel --- .github/workflows/run_pytest.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/run_pytest.yml b/.github/workflows/run_pytest.yml index cd60fa9..30b9fe5 100644 --- a/.github/workflows/run_pytest.yml +++ b/.github/workflows/run_pytest.yml @@ -6,7 +6,6 @@ jobs: build: strategy: - max-parallel: 3 matrix: os: [ubuntu-latest] python-version: [3.5, 3.6, 3.7, 3.8] @@ -29,7 +28,7 @@ jobs: - name: Test with pytest run: | pytest -c 'test/pytest.ini' - + - name: Save artifacts uses: actions/upload-artifact@master with: From 940075ed85d0c6cff2beffd206a031041046e791 Mon Sep 17 00:00:00 2001 From: Jan Speller Date: Tue, 14 Apr 2020 22:34:17 +0200 Subject: [PATCH 24/27] Add Fix for descriptor --- module/descriptor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/descriptor.py b/module/descriptor.py index 77a28f8..f14f153 100644 --- a/module/descriptor.py +++ b/module/descriptor.py @@ -42,10 +42,10 @@ class BoswatchModule(ModuleBase): @param bwPacket: A BOSWatch packet instance""" for descriptor in self.config: + bwPacket.set(descriptor.get("descrField"), bwPacket.get(descriptor.get("scanField"))) for description in descriptor.get("descriptions"): if not bwPacket.get(descriptor.get("scanField")): break # scanField is not available in this packet - bwPacket.set(descriptor.get("descrField"), description.get("for")) if str(description.get("for")) == bwPacket.get(descriptor.get("scanField")): logging.debug("Description '%s' added in packet field '%s'", description.get("add"), descriptor.get("descrField")) From bfa9b0b3ceec08871c2cf3dfe9a9a241209aebc2 Mon Sep 17 00:00:00 2001 From: Jan Speller Date: Sat, 18 Apr 2020 14:09:59 +0200 Subject: [PATCH 25/27] return bwpacket if scanField is None --- module/descriptor.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/module/descriptor.py b/module/descriptor.py index f14f153..b470c83 100644 --- a/module/descriptor.py +++ b/module/descriptor.py @@ -42,6 +42,8 @@ class BoswatchModule(ModuleBase): @param bwPacket: A BOSWatch packet instance""" for descriptor in self.config: + if bwPacket.get(descriptor.get("scanField")) is None: + return bwPacket bwPacket.set(descriptor.get("descrField"), bwPacket.get(descriptor.get("scanField"))) for description in descriptor.get("descriptions"): if not bwPacket.get(descriptor.get("scanField")): From fde99396b8cdc1a742aaa4bd61f0c7d98e0046e2 Mon Sep 17 00:00:00 2001 From: Jan Speller Date: Sat, 18 Apr 2020 14:14:56 +0200 Subject: [PATCH 26/27] fix error --- module/descriptor.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/module/descriptor.py b/module/descriptor.py index b470c83..cf17530 100644 --- a/module/descriptor.py +++ b/module/descriptor.py @@ -42,12 +42,10 @@ class BoswatchModule(ModuleBase): @param bwPacket: A BOSWatch packet instance""" for descriptor in self.config: - if bwPacket.get(descriptor.get("scanField")) is None: - return bwPacket + if not bwPacket.get(descriptor.get("scanField")): + break # scanField is not available in this packet bwPacket.set(descriptor.get("descrField"), bwPacket.get(descriptor.get("scanField"))) for description in descriptor.get("descriptions"): - if not bwPacket.get(descriptor.get("scanField")): - break # scanField is not available in this packet if str(description.get("for")) == bwPacket.get(descriptor.get("scanField")): logging.debug("Description '%s' added in packet field '%s'", description.get("add"), descriptor.get("descrField")) From 1680490ca14edf9cfaac7c9eed38a9c1ac549bfe Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Sat, 18 Apr 2020 15:18:30 +0200 Subject: [PATCH 27/27] Update .github/workflows/build_docs.yml Co-Authored-By: Jan Speller --- .github/workflows/build_docs.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_docs.yml b/.github/workflows/build_docs.yml index dccc187..dfb0de3 100644 --- a/.github/workflows/build_docs.yml +++ b/.github/workflows/build_docs.yml @@ -1,6 +1,9 @@ name: build_docs -on: [push] +on: + push: + branches: + - master jobs: @@ -33,4 +36,4 @@ jobs: password: ${{ secrets.SCP_PASSWORD }} source: "docu/site/**" target: ${{ secrets.SCP_TARGET_PATH }} - strip_components: 2 \ No newline at end of file + strip_components: 2