From 59dde93b0d707be5c0a4d336b16d8be86ac7ac8a Mon Sep 17 00:00:00 2001 From: Caleb Lemoine <21261388+circa10a@users.noreply.github.com> Date: Sat, 2 Feb 2019 13:45:31 -0600 Subject: [PATCH] V1.1.2 (#179) * Fix default timezone (#177) * add timezone arg, default to UTC if no arg or env var * bump version * v1.1.2 Merge --- pyouroboros/__init__.py | 2 +- pyouroboros/config.py | 7 ++++--- pyouroboros/ouroboros.py | 6 +++++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/pyouroboros/__init__.py b/pyouroboros/__init__.py index 985251cf..aaee78f6 100644 --- a/pyouroboros/__init__.py +++ b/pyouroboros/__init__.py @@ -1,2 +1,2 @@ -VERSION = "1.1.1" +VERSION = "1.1.2" BRANCH = "master" diff --git a/pyouroboros/config.py b/pyouroboros/config.py index c5df05ea..aa354516 100644 --- a/pyouroboros/config.py +++ b/pyouroboros/config.py @@ -6,13 +6,14 @@ class Config(object): options = ['INTERVAL', 'PROMETHEUS', 'DOCKER_SOCKETS', 'MONITOR', 'IGNORE', 'LOG_LEVEL', 'PROMETHEUS_ADDR', 'PROMETHEUS_PORT', 'NOTIFIERS', 'REPO_USER', 'REPO_PASS', 'CLEANUP', 'RUN_ONCE', 'LATEST', 'CRON', - 'INFLUX_URL', 'INFLUX_PORT', 'INFLUX_USERNAME', 'INFLUX_PASSWORD', 'INFLUX_DATABASE', 'INFLUX_SSL', - 'INFLUX_VERIFY_SSL', 'DATA_EXPORT', 'SELF_UPDATE', 'LABEL_ENABLE', 'DOCKER_TLS', 'LABELS_ONLY', - 'DRY_RUN', 'HOSTNAME', 'DOCKER_TLS_VERIFY'] + 'TIMEZONE', 'INFLUX_URL', 'INFLUX_PORT', 'INFLUX_USERNAME', 'INFLUX_PASSWORD', 'INFLUX_DATABASE', + 'INFLUX_SSL', 'INFLUX_VERIFY_SSL', 'DATA_EXPORT', 'SELF_UPDATE', 'LABEL_ENABLE', 'DOCKER_TLS', + 'LABELS_ONLY', 'DRY_RUN', 'HOSTNAME', 'DOCKER_TLS_VERIFY'] hostname = environ.get('HOSTNAME') interval = 300 cron = None + timezone = environ.get('TZ') or 'UTC' docker_sockets = 'unix://var/run/docker.sock' docker_tls = False docker_tls_verify = True diff --git a/pyouroboros/ouroboros.py b/pyouroboros/ouroboros.py index 58ca7f3a..5621472c 100644 --- a/pyouroboros/ouroboros.py +++ b/pyouroboros/ouroboros.py @@ -43,6 +43,10 @@ def main(): help='Cron formatted string for scheduling\n' 'EXAMPLE: "*/5 * * * *"') + core_group.add_argument('-z', '--timezone', default=Config.timezone, dest='TIMEZONE', + help='Timezone for scheduling\n' + 'EXAMPLE: "America/Chicago"') + core_group.add_argument('-l', '--log-level', choices=['debug', 'info', 'warn', 'error', 'critical'], dest='LOG_LEVEL', default=Config.log_level, help='Set logging level\n' 'DEFAULT: info') @@ -145,7 +149,7 @@ def main(): data_manager = DataManager(config) notification_manager = NotificationManager(config, data_manager) - scheduler = BackgroundScheduler() + scheduler = BackgroundScheduler(timezone=config.timezone) scheduler.start() for socket in config.docker_sockets: