commit
9590839b75
7 changed files with 40 additions and 20 deletions
21
CHANGELOG.md
21
CHANGELOG.md
|
@ -1,7 +1,20 @@
|
|||
# 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)
|
||||
|
||||
**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)
|
||||
[Full Changelog](https://github.com/Boerderij/Varken/compare/v1.6.4...1.6.5)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
|
@ -19,8 +32,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:**
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
VOLUME /config
|
||||
|
|
|
@ -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
|
||||
VOLUME /config
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
VERSION = "1.6.5"
|
||||
VERSION = "1.6.6"
|
||||
BRANCH = 'master'
|
||||
|
|
|
@ -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):
|
||||
|
@ -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:
|
||||
|
@ -151,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
|
||||
|
||||
|
|
|
@ -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')}
|
||||
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue