forked from p15670423/monkey
Delete old Monkey Island-centric version and replace with common.version
This commit is contained in:
parent
a7aeb7d7ff
commit
fcef4f154f
|
@ -26,8 +26,6 @@ class Environment(object, metaclass=ABCMeta):
|
||||||
def testing(self, value):
|
def testing(self, value):
|
||||||
self._testing = value
|
self._testing = value
|
||||||
|
|
||||||
_MONKEY_VERSION = "1.7.0"
|
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.config = None
|
self.config = None
|
||||||
self._testing = False # Assume env is not for unit testing.
|
self._testing = False # Assume env is not for unit testing.
|
||||||
|
@ -58,9 +56,6 @@ class Environment(object, metaclass=ABCMeta):
|
||||||
def is_develop(self):
|
def is_develop(self):
|
||||||
return self.get_deployment() == 'develop'
|
return self.get_deployment() == 'develop'
|
||||||
|
|
||||||
def get_version(self):
|
|
||||||
return self._MONKEY_VERSION + ('-dev' if self.is_develop() else '')
|
|
||||||
|
|
||||||
def _get_from_config(self, key, default_value=None):
|
def _get_from_config(self, key, default_value=None):
|
||||||
val = default_value
|
val = default_value
|
||||||
if self.config is not None:
|
if self.config is not None:
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import flask_restful
|
import flask_restful
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from monkey_island.cc.environment.environment import env
|
from common.version import get_version
|
||||||
from monkey_island.cc.services.version_update import VersionUpdateService
|
from monkey_island.cc.services.version_update import VersionUpdateService
|
||||||
|
|
||||||
__author__ = 'itay.mizeretz'
|
__author__ = 'itay.mizeretz'
|
||||||
|
@ -17,7 +17,7 @@ class VersionUpdate(flask_restful.Resource):
|
||||||
# even when not authenticated
|
# even when not authenticated
|
||||||
def get(self):
|
def get(self):
|
||||||
return {
|
return {
|
||||||
'current_version': env.get_version(),
|
'current_version': get_version(),
|
||||||
'newer_version': VersionUpdateService.get_newer_version(),
|
'newer_version': VersionUpdateService.get_newer_version(),
|
||||||
'download_link': VersionUpdateService.get_download_link()
|
'download_link': VersionUpdateService.get_download_link()
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ import logging
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
|
from common.version import get_version
|
||||||
from monkey_island.cc.environment.environment import env
|
from monkey_island.cc.environment.environment import env
|
||||||
|
|
||||||
__author__ = "itay.mizeretz"
|
__author__ = "itay.mizeretz"
|
||||||
|
@ -39,7 +40,7 @@ class VersionUpdateService:
|
||||||
Checks if newer monkey version is available
|
Checks if newer monkey version is available
|
||||||
:return: False if not, version in string format ('1.6.2') otherwise
|
:return: False if not, version in string format ('1.6.2') otherwise
|
||||||
"""
|
"""
|
||||||
url = VersionUpdateService.VERSION_SERVER_CHECK_NEW_URL % (env.get_deployment(), env.get_version())
|
url = VersionUpdateService.VERSION_SERVER_CHECK_NEW_URL % (env.get_deployment(), get_version())
|
||||||
|
|
||||||
reply = requests.get(url, timeout=15)
|
reply = requests.get(url, timeout=15)
|
||||||
|
|
||||||
|
@ -53,4 +54,4 @@ class VersionUpdateService:
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_download_link():
|
def get_download_link():
|
||||||
return VersionUpdateService.VERSION_SERVER_DOWNLOAD_URL % (env.get_deployment(), env.get_version())
|
return VersionUpdateService.VERSION_SERVER_DOWNLOAD_URL % (env.get_deployment(), get_version())
|
||||||
|
|
Loading…
Reference in New Issue