From ac05025b412876d419b90514f5c27e48bff40f90 Mon Sep 17 00:00:00 2001 From: samwiseg0 Date: Mon, 11 Mar 2019 19:54:40 -0400 Subject: [PATCH 1/8] Version bump for develop 1.6.5 --- varken/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/varken/__init__.py b/varken/__init__.py index 7bdf047..3e8bc28 100644 --- a/varken/__init__.py +++ b/varken/__init__.py @@ -1,2 +1,2 @@ -VERSION = "1.6.5" -BRANCH = 'master' +VERSION = "1.6.6" +BRANCH = 'develop' From b6a4867d4bd50ddaf44ed1b2e67afad3a47d71d3 Mon Sep 17 00:00:00 2001 From: samwiseg0 Date: Mon, 11 Mar 2019 19:55:04 -0400 Subject: [PATCH 2/8] Add TZDATA to docker. Fixes #112 --- Dockerfile | 3 ++- Dockerfile.arm | 5 +++-- Dockerfile.arm64 | 5 +++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8c84f9c..e635b17 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,7 +12,8 @@ COPY /varken /app/varken COPY /data /app/data -RUN python3 -m pip install -r /app/requirements.txt +RUN apk add --no-cache tzdata && \ + python3 -m pip install -r /app/requirements.txt CMD cp /app/data/varken.example.ini /config/varken.example.ini && python3 /app/Varken.py --data-folder /config diff --git a/Dockerfile.arm b/Dockerfile.arm index 8f12617..da5c42a 100644 --- a/Dockerfile.arm +++ b/Dockerfile.arm @@ -12,8 +12,9 @@ COPY /varken /app/varken COPY /data /app/data -RUN python3 -m pip install -r /app/requirements.txt +RUN apk add --no-cache tzdata && \ + python3 -m pip install -r /app/requirements.txt CMD cp /app/data/varken.example.ini /config/varken.example.ini && python3 /app/Varken.py --data-folder /config -VOLUME /config \ No newline at end of file +VOLUME /config diff --git a/Dockerfile.arm64 b/Dockerfile.arm64 index 98e5ff9..4ae6d4d 100644 --- a/Dockerfile.arm64 +++ b/Dockerfile.arm64 @@ -12,8 +12,9 @@ COPY /varken /app/varken COPY /data /app/data -RUN python3 -m pip install -r /app/requirements.txt +RUN apk add --no-cache tzdata && \ + python3 -m pip install -r /app/requirements.txt CMD cp /app/data/varken.example.ini /config/varken.example.ini && python3 /app/Varken.py --data-folder /config -VOLUME /config \ No newline at end of file +VOLUME /config From d710d2c6212b671b2c9f53279ddb55e6b0acb7f3 Mon Sep 17 00:00:00 2001 From: samwiseg0 Date: Mon, 11 Mar 2019 20:13:50 -0400 Subject: [PATCH 3/8] Make changes to USG to prevent canceling job. Should fix #107 --- varken/unifi.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/varken/unifi.py b/varken/unifi.py index dcb2c50..a8ca60c 100644 --- a/varken/unifi.py +++ b/varken/unifi.py @@ -37,8 +37,8 @@ class UniFiAPI(object): get = connection_handler(self.session, req, self.server.verify_ssl) if not get: - self.logger.error("Canceling Job get_usg_stats for unifi-%s", self.server.id) - return f"unifi-{self.server.id}-get_usg_stats" + self.logger.error("Disregarding Job get_usg_stats for unifi-%s", self.server.id) + return devices = {device['name']: device for device in get['data']} if devices.get(self.server.usg_name): From f48bfa1193cfc686d64a61c60591df50a51a864c Mon Sep 17 00:00:00 2001 From: "Nicholas St. Germain" Date: Mon, 11 Mar 2019 19:37:29 -0500 Subject: [PATCH 4/8] massage unifi --- varken/helpers.py | 7 ++++++- varken/unifi.py | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/varken/helpers.py b/varken/helpers.py index 459b51b..ece4656 100644 --- a/varken/helpers.py +++ b/varken/helpers.py @@ -143,7 +143,12 @@ def connection_handler(session, request, verify, as_is_reply=False): try: get = s.send(r, verify=v) if get.status_code == 401: - logger.info('Your api key is incorrect for %s', r.url) + if 'NoSiteContext' in str(get.content): + logger.info('Your Site is incorrect for %s', r.url) + elif 'LoginRequired' in str(get.content): + logger.info('Your login credentials are incorrect for %s', r.url) + else: + logger.info('Your api key is incorrect for %s', r.url) elif get.status_code == 404: logger.info('This url doesnt even resolve: %s', r.url) elif get.status_code == 200: diff --git a/varken/unifi.py b/varken/unifi.py index a8ca60c..ad829e2 100644 --- a/varken/unifi.py +++ b/varken/unifi.py @@ -24,7 +24,7 @@ class UniFiAPI(object): req = self.session.prepare_request(Request('POST', self.server.url + endpoint, json=pre_cookies)) post = connection_handler(self.session, req, self.server.verify_ssl, as_is_reply=True) - if not post.cookies.get('unifises'): + if not post or not post.cookies.get('unifises'): return cookies = {'unifises': post.cookies.get('unifises')} From dc3918559388daa5d6a61b652031f43974c3574e Mon Sep 17 00:00:00 2001 From: "Nicholas St. Germain" Date: Mon, 11 Mar 2019 19:42:53 -0500 Subject: [PATCH 5/8] fix #106 --- varken/helpers.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/varken/helpers.py b/varken/helpers.py index ece4656..723f39d 100644 --- a/varken/helpers.py +++ b/varken/helpers.py @@ -12,7 +12,7 @@ from urllib.request import urlretrieve from json.decoder import JSONDecodeError from os.path import abspath, join, basename, isdir from urllib3.exceptions import InsecureRequestWarning -from requests.exceptions import InvalidSchema, SSLError, ConnectionError +from requests.exceptions import InvalidSchema, SSLError, ConnectionError, ChunkedEncodingError logger = getLogger() @@ -98,7 +98,7 @@ class GeoIPHandler(object): try: remove(self.dbfile) except FileNotFoundError: - self.logger.warn("Cannot remove GeoLite2 DB as it does not exsist!") + self.logger.warning("Cannot remove GeoLite2 DB as it does not exist!") self.logger.debug("Opening GeoLite2 tar file : %s", tar_dbfile) @@ -115,7 +115,7 @@ class GeoIPHandler(object): remove(tar_dbfile) self.logger.debug('Removed the GeoLite2 DB TAR file.') except FileNotFoundError: - self.logger.warn("Cannot remove GeoLite2 DB TAR file as it does not exsist!") + self.logger.warning("Cannot remove GeoLite2 DB TAR file as it does not exist!") def hashit(string): @@ -156,17 +156,16 @@ def connection_handler(session, request, verify, as_is_reply=False): return_json = get.json() except JSONDecodeError: logger.error('No JSON response. Response is: %s', get.text) - if air: return get except InvalidSchema: logger.error("You added http(s):// in the config file. Don't do that.") - except SSLError as e: logger.error('Either your host is unreachable or you have an SSL issue. : %s', e) - except ConnectionError as e: logger.error('Cannot resolve the url/ip/port. Check connectivity. Error: %s', e) + except ChunkedEncodingError as e: + logger.error('Broken connection during request... oops? Error: %s', e) return return_json From 4572f086ac1ffd202d9baa4c4dff11ed5440fb3d Mon Sep 17 00:00:00 2001 From: samwiseg0 Date: Mon, 11 Mar 2019 21:02:54 -0400 Subject: [PATCH 6/8] Change branch for version --- varken/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/varken/__init__.py b/varken/__init__.py index 3e8bc28..4877873 100644 --- a/varken/__init__.py +++ b/varken/__init__.py @@ -1,2 +1,2 @@ VERSION = "1.6.6" -BRANCH = 'develop' +BRANCH = 'master' From ec48432b49c22381622ffdd2f3e51d5bf134c4e8 Mon Sep 17 00:00:00 2001 From: samwiseg0 Date: Mon, 11 Mar 2019 21:06:06 -0400 Subject: [PATCH 7/8] CHANGELOG for v1.6.6 --- CHANGELOG.md | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 93351f1..769f729 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,18 @@ # Change Log -## [v1.6.5](https://github.com/Boerderij/Varken/tree/v1.6.5) (2019-03-11) -[Full Changelog](https://github.com/Boerderij/Varken/compare/v1.6.4...v1.6.5) +## [v1.6.6](https://github.com/Boerderij/Varken/tree/v1.6.6) (2019-03-11) +[Full Changelog](https://github.com/Boerderij/Varken/compare/1.6.5...v1.6.6) + +**Fixed bugs:** + +- \[BUG\] TZDATA issue in docker images [\#112](https://github.com/Boerderij/Varken/issues/112) +- \[BUG\] Unifi job does not try again after failure [\#107](https://github.com/Boerderij/Varken/issues/107) +- \[BUG\] Catch ChunkError [\#106](https://github.com/Boerderij/Varken/issues/106) + +- v1.6.6 Merge [\#116](https://github.com/Boerderij/Varken/pull/116) ([samwiseg0](https://github.com/samwiseg0)) + +## [1.6.5](https://github.com/Boerderij/Varken/tree/1.6.5) (2019-03-11) +[Full Changelog](https://github.com/Boerderij/Varken/compare/v1.6.4...1.6.5) **Implemented enhancements:** @@ -19,8 +30,8 @@ - v1.6.5 Merge [\#115](https://github.com/Boerderij/Varken/pull/115) ([samwiseg0](https://github.com/samwiseg0)) -## [1.6.4](https://github.com/Boerderij/Varken/tree/1.6.4) (2019-02-04) -[Full Changelog](https://github.com/Boerderij/Varken/compare/1.6.3...1.6.4) +## [v1.6.4](https://github.com/Boerderij/Varken/tree/v1.6.4) (2019-02-04) +[Full Changelog](https://github.com/Boerderij/Varken/compare/1.6.3...v1.6.4) **Fixed bugs:** From fd3e8bb81048565d454bc7ea9d7d191b73b579c4 Mon Sep 17 00:00:00 2001 From: samwiseg0 Date: Mon, 11 Mar 2019 21:10:14 -0400 Subject: [PATCH 8/8] Fix CHANGELOG --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 769f729..df8c9e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ - \[BUG\] Unifi job does not try again after failure [\#107](https://github.com/Boerderij/Varken/issues/107) - \[BUG\] Catch ChunkError [\#106](https://github.com/Boerderij/Varken/issues/106) +**Merged pull requests:** + - v1.6.6 Merge [\#116](https://github.com/Boerderij/Varken/pull/116) ([samwiseg0](https://github.com/samwiseg0)) ## [1.6.5](https://github.com/Boerderij/Varken/tree/1.6.5) (2019-03-11)