v1.7.2 Merge

v1.7.2 Merge
This commit is contained in:
Nicholas St. Germain 2019-06-23 23:24:15 -05:00 committed by GitHub
commit 73410dbee5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 225 additions and 68 deletions

View file

@ -1,7 +1,22 @@
# Change Log # Change Log
## [v1.7.1](https://github.com/Boerderij/Varken/tree/v1.7.1) (2019-06-03) ## [v1.7.2](https://github.com/Boerderij/Varken/tree/v1.7.2) (2019-06-23)
[Full Changelog](https://github.com/Boerderij/Varken/compare/1.7.0...v1.7.1) [Full Changelog](https://github.com/Boerderij/Varken/compare/1.7.1...v1.7.2)
**Implemented enhancements:**
- Allow configuration via environment variables [\#137](https://github.com/Boerderij/Varken/issues/137)
**Fixed bugs:**
- \[BUG\] logger invoked before initialization in dbmanager [\#138](https://github.com/Boerderij/Varken/issues/138)
**Merged pull requests:**
- v1.7.2 Merge [\#144](https://github.com/Boerderij/Varken/pull/144) ([DirtyCajunRice](https://github.com/DirtyCajunRice))
## [1.7.1](https://github.com/Boerderij/Varken/tree/1.7.1) (2019-06-04)
[Full Changelog](https://github.com/Boerderij/Varken/compare/1.7.0...1.7.1)
**Fixed bugs:** **Fixed bugs:**
@ -273,7 +288,7 @@
**Merged pull requests:** **Merged pull requests:**
- v0.1 [\#20](https://github.com/Boerderij/Varken/pull/20) ([samwiseg0](https://github.com/samwiseg0)) - v0.1 [\#20](https://github.com/Boerderij/Varken/pull/20) ([samwiseg0](https://github.com/samwiseg0))
- Added selfplug [\#19](https://github.com/Boerderij/Varken/pull/19) ([si0972](https://github.com/si0972)) - Added selfplug [\#19](https://github.com/Boerderij/Varken/pull/19) ([Roxedus](https://github.com/Roxedus))
- Major rework of the scripts [\#14](https://github.com/Boerderij/Varken/pull/14) ([samwiseg0](https://github.com/samwiseg0)) - Major rework of the scripts [\#14](https://github.com/Boerderij/Varken/pull/14) ([samwiseg0](https://github.com/samwiseg0))
- fix worldmap after change to maxmind local db [\#11](https://github.com/Boerderij/Varken/pull/11) ([madbuda](https://github.com/madbuda)) - fix worldmap after change to maxmind local db [\#11](https://github.com/Boerderij/Varken/pull/11) ([madbuda](https://github.com/madbuda))
- Update sonarr.py [\#7](https://github.com/Boerderij/Varken/pull/7) ([ghost](https://github.com/ghost)) - Update sonarr.py [\#7](https://github.com/Boerderij/Varken/pull/7) ([ghost](https://github.com/ghost))

View file

@ -1,9 +1,11 @@
FROM amd64/python:3.7.2-alpine FROM amd64/python:3.7.3-alpine
LABEL maintainers="dirtycajunrice,samwiseg0" LABEL maintainers="dirtycajunrice,samwiseg0"
ENV DEBUG="True" ENV DEBUG="True"
ENV DATA_FOLDER="/config"
WORKDIR /app WORKDIR /app
COPY /requirements.txt /Varken.py /app/ COPY /requirements.txt /Varken.py /app/
@ -15,8 +17,8 @@ COPY /data /app/data
COPY /utilities /app/data/utilities COPY /utilities /app/data/utilities
RUN apk add --no-cache tzdata && \ RUN apk add --no-cache tzdata && \
python3 -m pip install -r /app/requirements.txt pip install --no-cache-dir -r /app/requirements.txt
CMD cp /app/data/varken.example.ini /config/varken.example.ini && python3 /app/Varken.py --data-folder /config CMD cp /app/data/varken.example.ini /config/varken.example.ini && python3 /app/Varken.py
VOLUME /config VOLUME /config

View file

@ -1,9 +1,11 @@
FROM arm32v6/python:3.7.2-alpine FROM arm32v6/python:3.7.3-alpine
LABEL maintainers="dirtycajunrice,samwiseg0" LABEL maintainers="dirtycajunrice,samwiseg0"
ENV DEBUG="True" ENV DEBUG="True"
ENV DATA_FOLDER="/config"
WORKDIR /app WORKDIR /app
COPY /requirements.txt /Varken.py /app/ COPY /requirements.txt /Varken.py /app/
@ -13,8 +15,8 @@ COPY /varken /app/varken
COPY /data /app/data COPY /data /app/data
RUN apk add --no-cache tzdata && \ RUN apk add --no-cache tzdata && \
python3 -m pip install -r /app/requirements.txt pip install --no-cache-dir -r /app/requirements.txt
CMD cp /app/data/varken.example.ini /config/varken.example.ini && python3 /app/Varken.py --data-folder /config CMD cp /app/data/varken.example.ini /config/varken.example.ini && python3 /app/Varken.py
VOLUME /config VOLUME /config

View file

@ -1,9 +1,11 @@
FROM arm64v8/python:3.7.2-alpine FROM arm64v8/python:3.7.3-alpine
LABEL maintainers="dirtycajunrice,samwiseg0" LABEL maintainers="dirtycajunrice,samwiseg0"
ENV DEBUG="True" ENV DEBUG="True"
ENV DATA_FOLDER="/config"
WORKDIR /app WORKDIR /app
COPY /requirements.txt /Varken.py /app/ COPY /requirements.txt /Varken.py /app/
@ -13,8 +15,8 @@ COPY /varken /app/varken
COPY /data /app/data COPY /data /app/data
RUN apk add --no-cache tzdata && \ RUN apk add --no-cache tzdata && \
python3 -m pip install -r /app/requirements.txt pip install --no-cache-dir -r /app/requirements.txt
CMD cp /app/data/varken.example.ini /config/varken.example.ini && python3 /app/Varken.py --data-folder /config CMD cp /app/data/varken.example.ini /config/varken.example.ini && python3 /app/Varken.py
VOLUME /config VOLUME /config

View file

@ -1,5 +1,5 @@
<p align="center"> <p align="center">
<img width="800" src="https://raw.githubusercontent.com/Boerderij/Varken/develop/assets/varken_full_banner.jpg" alt="Logo Banner"> <img width="800" src="https://raw.githubusercontent.com/Boerderij/Varken/master/assets/varken_full_banner.jpg" alt="Logo Banner">
</p> </p>
[![Build Status](https://jenkins.cajun.pro/buildStatus/icon?job=Varken/master)](https://jenkins.cajun.pro/job/Varken/job/master/) [![Build Status](https://jenkins.cajun.pro/buildStatus/icon?job=Varken/master)](https://jenkins.cajun.pro/job/Varken/job/master/)

View file

@ -4,6 +4,7 @@ from time import sleep
from queue import Queue from queue import Queue
from sys import version from sys import version
from threading import Thread from threading import Thread
from os import environ as env
from os import access, R_OK, getenv from os import access, R_OK, getenv
from distro import linux_distribution from distro import linux_distribution
from os.path import isdir, abspath, dirname, join from os.path import isdir, abspath, dirname, join
@ -45,8 +46,6 @@ if __name__ == "__main__":
opts = parser.parse_args() opts = parser.parse_args()
DATA_FOLDER = abspath(join(dirname(__file__), 'data'))
templogger = getLogger('temp') templogger = getLogger('temp')
templogger.setLevel(DEBUG) templogger.setLevel(DEBUG)
tempch = StreamHandler() tempch = StreamHandler()
@ -54,17 +53,15 @@ if __name__ == "__main__":
tempch.setFormatter(tempformatter) tempch.setFormatter(tempformatter)
templogger.addHandler(tempch) templogger.addHandler(tempch)
if opts.data_folder: DATA_FOLDER = env.get('DATA_FOLDER', vars(opts).get('data_folder') or abspath(join(dirname(__file__), 'data')))
ARG_FOLDER = opts.data_folder
if isdir(ARG_FOLDER): if isdir(DATA_FOLDER):
DATA_FOLDER = ARG_FOLDER if not access(DATA_FOLDER, R_OK):
if not access(DATA_FOLDER, R_OK): templogger.error("Read permission error for %s", DATA_FOLDER)
templogger.error("Read permission error for %s", DATA_FOLDER)
exit(1)
else:
templogger.error("%s does not exist", ARG_FOLDER)
exit(1) exit(1)
else:
templogger.error("%s does not exist", DATA_FOLDER)
exit(1)
# Set Debug to True if DEBUG env is set # Set Debug to True if DEBUG env is set
enable_opts = ['True', 'true', 'yes'] enable_opts = ['True', 'true', 'yes']

View file

@ -21,9 +21,99 @@ services:
volumes: volumes:
- /path/to/docker-varken/config-folder:/config - /path/to/docker-varken/config-folder:/config
environment: environment:
- PGID=911
- PUID=911
- TZ=America/Chicago - TZ=America/Chicago
- VRKN_GLOBAL_SONARR_SERVER_IDS=1,2
- VRKN_GLOBAL_RADARR_SERVER_IDS=1,2
- VRKN_GLOBAL_LIDARR_SERVER_IDS=false
- VRKN_GLOBAL_TAUTULLI_SERVER_IDS=1
- VRKN_GLOBAL_OMBI_SERVER_IDS=1
- VRKN_GLOBAL_SICKCHILL_SERVER_IDS=false
- VRKN_GLOBAL_UNIFI_SERVER_IDS=false
- VRKN_INFLUXDB_URL=influxdb.domain.tld
- VRKN_INFLUXDB_PORT=8086
- VRKN_INFLUXDB_SSL=false
- VRKN_INFLUXDB_VERIFY_SSL=false
- VRKN_INFLUXDB_USERNAME=root
- VRKN_INFLUXDB_PASSWORD=root
- VRKN_TAUTULLI_1_URL=tautulli.domain.tld:8181
- VRKN_TAUTULLI_1_FALLBACK_IP=1.1.1.1
- VRKN_TAUTULLI_1_APIKEY=xxxxxxxxxxxxxxxx
- VRKN_TAUTULLI_1_SSL=false
- VRKN_TAUTULLI_1_VERIFY_SSL=false
- VRKN_TAUTULLI_1_GET_ACTIVITY=true
- VRKN_TAUTULLI_1_GET_ACTIVITY_RUN_SECONDS=30
- VRKN_TAUTULLI_1_GET_STATS=true
- VRKN_TAUTULLI_1_GET_STATS_RUN_SECONDS=3600
- VRKN_SONARR_1_URL=sonarr1.domain.tld:8989
- VRKN_SONARR_1_APIKEY=xxxxxxxxxxxxxxxx
- VRKN_SONARR_1_SSL=false
- VRKN_SONARR_1_VERIFY_SSL=false
- VRKN_SONARR_1_MISSING_DAYS=7
- VRKN_SONARR_1_MISSING_DAYS_RUN_SECONDS=300
- VRKN_SONARR_1_FUTURE_DAYS=1
- VRKN_SONARR_1_FUTURE_DAYS_RUN_SECONDS=300
- VRKN_SONARR_1_QUEUE=true
- VRKN_SONARR_1_QUEUE_RUN_SECONDS=300
- VRKN_SONARR_2_URL=sonarr2.domain.tld:8989
- VRKN_SONARR_2_APIKEY=yyyyyyyyyyyyyyyy
- VRKN_SONARR_2_SSL=false
- VRKN_SONARR_2_VERIFY_SSL=false
- VRKN_SONARR_2_MISSING_DAYS=7
- VRKN_SONARR_2_MISSING_DAYS_RUN_SECONDS=300
- VRKN_SONARR_2_FUTURE_DAYS=1
- VRKN_SONARR_2_FUTURE_DAYS_RUN_SECONDS=300
- VRKN_SONARR_2_QUEUE=true
- VRKN_SONARR_2_QUEUE_RUN_SECONDS=300
- VRKN_RADARR_1_URL=radarr1.domain.tld
- VRKN_RADARR_1_APIKEY=xxxxxxxxxxxxxxxx
- VRKN_RADARR_1_SSL=false
- VRKN_RADARR_1_VERIFY_SSL=false
- VRKN_RADARR_1_QUEUE=true
- VRKN_RADARR_1_QUEUE_RUN_SECONDS=300
- VRKN_RADARR_1_GET_MISSING=true
- VRKN_RADARR_1_GET_MISSING_RUN_SECONDS=300
- VRKN_RADARR_2_URL=radarr2.domain.tld
- VRKN_RADARR_2_APIKEY=yyyyyyyyyyyyyyyy
- VRKN_RADARR_2_SSL=false
- VRKN_RADARR_2_VERIFY_SSL=false
- VRKN_RADARR_2_QUEUE=true
- VRKN_RADARR_2_QUEUE_RUN_SECONDS=300
- VRKN_RADARR_2_GET_MISSING=true
- VRKN_RADARR_2_GET_MISSING_RUN_SECONDS=300
- VRKN_LIDARR_1_URL=lidarr1.domain.tld:8686
- VRKN_LIDARR_1_APIKEY=xxxxxxxxxxxxxxxx
- VRKN_LIDARR_1_SSL=false
- VRKN_LIDARR_1_VERIFY_SSL=false
- VRKN_LIDARR_1_MISSING_DAYS=30
- VRKN_LIDARR_1_MISSING_DAYS_RUN_SECONDS=300
- VRKN_LIDARR_1_FUTURE_DAYS=30
- VRKN_LIDARR_1_FUTURE_DAYS_RUN_SECONDS=300
- VRKN_LIDARR_1_QUEUE=true
- VRKN_LIDARR_1_QUEUE_RUN_SECONDS=300
- VRKN_OMBI_1_URL=ombi.domain.tld
- VRKN_OMBI_1_APIKEY=xxxxxxxxxxxxxxxx
- VRKN_OMBI_1_SSL=false
- VRKN_OMBI_1_VERIFY_SSL=false
- VRKN_OMBI_1_GET_REQUEST_TYPE_COUNTS=true
- VRKN_OMBI_1_REQUEST_TYPE_RUN_SECONDS=300
- VRKN_OMBI_1_GET_REQUEST_TOTAL_COUNTS=true
- VRKN_OMBI_1_REQUEST_TOTAL_RUN_SECONDS=300
- VRKN_OMBI_1_GET_ISSUE_STATUS_COUNTS=true
- VRKN_OMBI_1_ISSUE_STATUS_RUN_SECONDS=300
- VRKN_SICKCHILL_1_URL=sickchill.domain.tld:8081
- VRKN_SICKCHILL_1_APIKEY=xxxxxxxxxxxxxxxx
- VRKN_SICKCHILL_1_SSL=false
- VRKN_SICKCHILL_1_VERIFY_SSL=false
- VRKN_SICKCHILL_1_GET_MISSING=true
- VRKN_SICKCHILL_1_GET_MISSING_RUN_SECONDS=300
- VRKN_UNIFI_1_URL=unifi.domain.tld:8443
- VRKN_UNIFI_1_USERNAME=ubnt
- VRKN_UNIFI_1_PASSWORD=ubnt
- VRKN_UNIFI_1_SITE=default
- VRKN_UNIFI_1_USG_NAME=MyRouter
- VRKN_UNIFI_1_SSL=false
- VRKN_UNIFI_1_VERIFY_SSL=false
- VRKN_UNIFI_1_GET_USG_STATS_RUN_SECONDS=300
depends_on: depends_on:
- influxdb - influxdb
restart: unless-stopped restart: unless-stopped

View file

@ -1,2 +1,2 @@
VERSION = "1.7.1" VERSION = "1.7.2"
BRANCH = 'master' BRANCH = 'master'

View file

@ -8,13 +8,13 @@ from influxdb.exceptions import InfluxDBServerError
class DBManager(object): class DBManager(object):
def __init__(self, server): def __init__(self, server):
self.server = server self.server = server
self.logger = getLogger()
if self.server.url == "influxdb.domain.tld": if self.server.url == "influxdb.domain.tld":
self.logger.critical("You have not configured your varken.ini. Please read Wiki page for configuration") self.logger.critical("You have not configured your varken.ini. Please read Wiki page for configuration")
exit() exit()
self.influx = InfluxDBClient(host=self.server.url, port=self.server.port, username=self.server.username, self.influx = InfluxDBClient(host=self.server.url, port=self.server.port, username=self.server.username,
password=self.server.password, ssl=self.server.ssl, database='varken', password=self.server.password, ssl=self.server.ssl, database='varken',
verify_ssl=self.server.verify_ssl) verify_ssl=self.server.verify_ssl)
self.logger = getLogger()
try: try:
version = self.influx.request('ping', expected_response_code=204).headers['X-Influxdb-Version'] version = self.influx.request('ping', expected_response_code=204).headers['X-Influxdb-Version']
self.logger.info('Influxdb version: %s', version) self.logger.info('Influxdb version: %s', version)

View file

@ -196,3 +196,10 @@ def clean_sid_check(server_id_list, server_type=None):
else: else:
logger.error('No valid %s', t.upper()) logger.error('No valid %s', t.upper())
return False return False
def boolcheck(var):
if var.lower() in ['true', 'yes']:
return True
else:
return False

View file

@ -1,4 +1,5 @@
from shutil import copyfile from shutil import copyfile
from os import environ as env
from logging import getLogger from logging import getLogger
from os.path import join, exists from os.path import join, exists
from re import match, compile, IGNORECASE from re import match, compile, IGNORECASE
@ -6,7 +7,7 @@ from configparser import ConfigParser, NoOptionError, NoSectionError
from varken.varkenlogger import BlacklistFilter from varken.varkenlogger import BlacklistFilter
from varken.structures import SickChillServer, UniFiServer from varken.structures import SickChillServer, UniFiServer
from varken.helpers import clean_sid_check, rfc1918_ip_check from varken.helpers import clean_sid_check, rfc1918_ip_check, boolcheck
from varken.structures import SonarrServer, RadarrServer, OmbiServer, TautulliServer, InfluxServer from varken.structures import SonarrServer, RadarrServer, OmbiServer, TautulliServer, InfluxServer
@ -42,8 +43,8 @@ class INIParser(object):
def enable_check(self, server_type=None): def enable_check(self, server_type=None):
t = server_type t = server_type
global_server_ids = self.config.get('global', t) global_server_ids = env.get(f'VRKN_GLOBAL_{t.upper()}', self.config.get('global', t))
if global_server_ids.lower() in ['false', 'no', '0']: if global_server_ids.lower() in ['false', 'no']:
self.logger.info('%s disabled.', t.upper()) self.logger.info('%s disabled.', t.upper())
else: else:
sids = clean_sid_check(global_server_ids, t) sids = clean_sid_check(global_server_ids, t)
@ -141,13 +142,14 @@ class INIParser(object):
self.config_blacklist() self.config_blacklist()
# Parse InfluxDB options # Parse InfluxDB options
try: try:
url = self.url_check(self.config.get('influxdb', 'url'), include_port=False, section='influxdb') url = self.url_check(env.get('VRKN_INFLUXDB_URL', self.config.get('influxdb', 'url')),
port = self.config.getint('influxdb', 'port') include_port=False, section='influxdb')
ssl = self.config.getboolean('influxdb', 'ssl') port = int(env.get('VRKN_INFLUXDB_PORT', self.config.getint('influxdb', 'port')))
verify_ssl = self.config.getboolean('influxdb', 'verify_ssl') ssl = boolcheck(env.get('VRKN_INFLUXDB_SSL', self.config.get('influxdb', 'ssl')))
verify_ssl = boolcheck(env.get('VRKN_INFLUXDB_VERIFY_SSL', self.config.get('influxdb', 'verify_ssl')))
username = self.config.get('influxdb', 'username') username = env.get('VRKN_INFLUXDB_USERNAME', self.config.get('influxdb', 'username'))
password = self.config.get('influxdb', 'password') password = env.get('VRKN_INFLUXDB_PASSWORD', self.config.get('influxdb', 'password'))
except NoOptionError as e: except NoOptionError as e:
self.logger.error('Missing key in %s. Error: %s', "influxdb", e) self.logger.error('Missing key in %s. Error: %s', "influxdb", e)
self.rectify_ini() self.rectify_ini()
@ -170,29 +172,40 @@ class INIParser(object):
for server_id in service_enabled: for server_id in service_enabled:
server = None server = None
section = f"{service}-{server_id}" section = f"{service}-{server_id}"
envsection = f"{service}_{server_id}".upper()
try: try:
url = self.url_check(self.config.get(section, 'url'), section=section) url = self.url_check(env.get(f'VRKN_{envsection}_URL', self.config.get(section, 'url')),
section=section)
apikey = None apikey = None
if service != 'unifi': if service != 'unifi':
apikey = self.config.get(section, 'apikey') apikey = env.get(f'VRKN_{envsection}_APIKEY', self.config.get(section, 'apikey'))
ssl_scheme = boolcheck(env.get(f'VRKN_{envsection}_SSL', self.config.get(section, 'ssl')))
scheme = 'https://' if self.config.getboolean(section, 'ssl') else 'http://' scheme = 'https://' if ssl_scheme else 'http://'
verify_ssl = self.config.getboolean(section, 'verify_ssl') verify_ssl = boolcheck(env.get(f'VRKN_{envsection}_VERIFY_SSL',
self.config.get(section, 'verify_ssl')))
if scheme != 'https://': if scheme != 'https://':
verify_ssl = False verify_ssl = False
if service in ['sonarr', 'radarr', 'lidarr']: if service in ['sonarr', 'radarr', 'lidarr']:
queue = self.config.getboolean(section, 'queue') queue = boolcheck(env.get(f'VRKN_{envsection}_QUEUE',
queue_run_seconds = self.config.getint(section, 'queue_run_seconds') self.config.get(section, 'queue')))
queue_run_seconds = int(env.get(f'VRKN_{envsection}_QUEUE_RUN_SECONDS',
self.config.getint(section, 'queue_run_seconds')))
if service in ['sonarr', 'lidarr']: if service in ['sonarr', 'lidarr']:
missing_days = self.config.getint(section, 'missing_days') missing_days = int(env.get(f'VRKN_{envsection}_MISSING_DAYS',
future_days = self.config.getint(section, 'future_days') self.config.getint(section, 'missing_days')))
future_days = int(env.get(f'VRKN_{envsection}_FUTURE_DAYS',
self.config.getint(section, 'future_days')))
missing_days_run_seconds = self.config.getint(section, 'missing_days_run_seconds') missing_days_run_seconds = int(env.get(
future_days_run_seconds = self.config.getint(section, 'future_days_run_seconds') f'VRKN_{envsection}_MISSING_DAYS_RUN_SECONDS',
self.config.getint(section, 'missing_days_run_seconds')))
future_days_run_seconds = int(env.get(
f'VRKN_{envsection}_FUTURE_DAYS_RUN_SECONDS',
self.config.getint(section, 'future_days_run_seconds')))
server = SonarrServer(id=server_id, url=scheme + url, api_key=apikey, verify_ssl=verify_ssl, server = SonarrServer(id=server_id, url=scheme + url, api_key=apikey, verify_ssl=verify_ssl,
missing_days=missing_days, future_days=future_days, missing_days=missing_days, future_days=future_days,
@ -201,21 +214,31 @@ class INIParser(object):
queue=queue, queue_run_seconds=queue_run_seconds) queue=queue, queue_run_seconds=queue_run_seconds)
if service == 'radarr': if service == 'radarr':
get_missing = self.config.getboolean(section, 'get_missing') get_missing = boolcheck(env.get(f'VRKN_{envsection}_GET_MISSING',
get_missing_run_seconds = self.config.getint(section, 'get_missing_run_seconds') self.config.get(section, 'get_missing')))
get_missing_run_seconds = int(env.get(
f'VRKN_{envsection}_GET_MISSING_RUN_SECONDS',
self.config.getint(section, 'get_missing_run_seconds')))
server = RadarrServer(id=server_id, url=scheme + url, api_key=apikey, verify_ssl=verify_ssl, server = RadarrServer(id=server_id, url=scheme + url, api_key=apikey, verify_ssl=verify_ssl,
queue_run_seconds=queue_run_seconds, get_missing=get_missing, queue_run_seconds=queue_run_seconds, get_missing=get_missing,
queue=queue, get_missing_run_seconds=get_missing_run_seconds) queue=queue, get_missing_run_seconds=get_missing_run_seconds)
if service == 'tautulli': if service == 'tautulli':
fallback_ip = self.config.get(section, 'fallback_ip') fallback_ip = env.get(f'VRKN_{envsection}_FALLBACK_IP',
self.config.get(section, 'fallback_ip'))
get_stats = self.config.getboolean(section, 'get_stats') get_stats = boolcheck(env.get(f'VRKN_{envsection}_GET_STATS',
get_activity = self.config.getboolean(section, 'get_activity') self.config.get(section, 'get_stats')))
get_activity = boolcheck(env.get(f'VRKN_{envsection}_GET_ACTIVITY',
self.config.get(section, 'get_activity')))
get_activity_run_seconds = self.config.getint(section, 'get_activity_run_seconds') get_activity_run_seconds = int(env.get(
get_stats_run_seconds = self.config.getint(section, 'get_stats_run_seconds') f'VRKN_{envsection}_GET_ACTIVITY_RUN_SECONDS',
self.config.getint(section, 'get_activity_run_seconds')))
get_stats_run_seconds = int(env.get(
f'VRKN_{envsection}_GET_STATS_RUN_SECONDS',
self.config.getint(section, 'get_stats_run_seconds')))
invalid_wan_ip = rfc1918_ip_check(fallback_ip) invalid_wan_ip = rfc1918_ip_check(fallback_ip)
@ -231,13 +254,25 @@ class INIParser(object):
get_stats_run_seconds=get_stats_run_seconds) get_stats_run_seconds=get_stats_run_seconds)
if service == 'ombi': if service == 'ombi':
issue_status_counts = self.config.getboolean(section, 'get_issue_status_counts') issue_status_counts = boolcheck(env.get(
request_type_counts = self.config.getboolean(section, 'get_request_type_counts') f'VRKN_{envsection}_GET_ISSUE_STATUS_COUNTS',
request_total_counts = self.config.getboolean(section, 'get_request_total_counts') self.config.get(section, 'get_issue_status_counts')))
request_type_counts = boolcheck(env.get(
f'VRKN_{envsection}_GET_REQUEST_TYPE_COUNTS',
self.config.get(section, 'get_request_type_counts')))
request_total_counts = boolcheck(env.get(
f'VRKN_{envsection}_GET_REQUEST_TOTAL_COUNTS',
self.config.get(section, 'get_request_total_counts')))
issue_status_run_seconds = self.config.getint(section, 'issue_status_run_seconds') issue_status_run_seconds = int(env.get(
request_type_run_seconds = self.config.getint(section, 'request_type_run_seconds') f'VRKN_{envsection}_ISSUE_STATUS_RUN_SECONDS',
request_total_run_seconds = self.config.getint(section, 'request_total_run_seconds') self.config.getint(section, 'issue_status_run_seconds')))
request_type_run_seconds = int(env.get(
f'VRKN_{envsection}_REQUEST_TYPE_RUN_SECONDS',
self.config.getint(section, 'request_type_run_seconds')))
request_total_run_seconds = int(env.get(
f'VRKN_{envsection}_REQUEST_TOTAL_RUN_SECONDS',
self.config.getint(section, 'request_total_run_seconds')))
server = OmbiServer(id=server_id, url=scheme + url, api_key=apikey, verify_ssl=verify_ssl, server = OmbiServer(id=server_id, url=scheme + url, api_key=apikey, verify_ssl=verify_ssl,
request_type_counts=request_type_counts, request_type_counts=request_type_counts,
@ -248,19 +283,24 @@ class INIParser(object):
issue_status_run_seconds=issue_status_run_seconds) issue_status_run_seconds=issue_status_run_seconds)
if service == 'sickchill': if service == 'sickchill':
get_missing = self.config.getboolean(section, 'get_missing') get_missing = boolcheck(env.get(f'VRKN_{envsection}_GET_MISSING',
get_missing_run_seconds = self.config.getint(section, 'get_missing_run_seconds') self.config.get(section, 'get_missing')))
get_missing_run_seconds = int(env.get(
f'VRKN_{envsection}_GET_MISSING_RUN_SECONDS',
self.config.getint(section, 'get_missing_run_seconds')))
server = SickChillServer(id=server_id, url=scheme + url, api_key=apikey, server = SickChillServer(id=server_id, url=scheme + url, api_key=apikey,
verify_ssl=verify_ssl, get_missing=get_missing, verify_ssl=verify_ssl, get_missing=get_missing,
get_missing_run_seconds=get_missing_run_seconds) get_missing_run_seconds=get_missing_run_seconds)
if service == 'unifi': if service == 'unifi':
username = self.config.get(section, 'username') username = env.get(f'VRKN_{envsection}_USERNAME', self.config.get(section, 'username'))
password = self.config.get(section, 'password') password = env.get(f'VRKN_{envsection}_PASSWORD', self.config.get(section, 'password'))
site = self.config.get(section, 'site').lower() site = env.get(f'VRKN_{envsection}_SITE', self.config.get(section, 'site')).lower()
usg_name = self.config.get(section, 'usg_name') usg_name = env.get(f'VRKN_{envsection}_USG_NAME', self.config.get(section, 'usg_name'))
get_usg_stats_run_seconds = self.config.getint(section, 'get_usg_stats_run_seconds') get_usg_stats_run_seconds = int(env.get(
f'VRKN_{envsection}_GET_USG_STATS_RUN_SECONDS',
self.config.getint(section, 'get_usg_stats_run_seconds')))
server = UniFiServer(id=server_id, url=scheme + url, verify_ssl=verify_ssl, site=site, server = UniFiServer(id=server_id, url=scheme + url, verify_ssl=verify_ssl, site=site,
username=username, password=password, usg_name=usg_name, username=username, password=password, usg_name=usg_name,
@ -271,3 +311,5 @@ class INIParser(object):
self.logger.error('Missing key in %s. Error: %s', section, e) self.logger.error('Missing key in %s. Error: %s', section, e)
self.rectify_ini() self.rectify_ini()
return return
except ValueError as e:
self.logger.error("Invalid configuration value in %s. Error: %s", section, e)