def __init__(self, config, onUpdateConfig = None):
#disable debug after testing is finished
#setDebug()
Thread.__init__(self, name='updater')
self.setDaemon(True)
self.appSettings = config
self.onUpdateConfig = onUpdateConfig
self.env = self.appSettings.get('Agent','Environment', fallback='live')
global SETUP_URL
global UPDATE_URL
global TIME_TO_CHECK
if self.env == "live":
SETUP_URL = SETUP_URL + SETUP_NAME
else:
SETUP_URL = SETUP_URL + self.env + "_" + SETUP_NAME
UPDATE_URL = UPDATE_URL + self.env
if 'UpdateUrl' in config.cloudConfig:
UPDATE_URL = config.cloudConfig.UpdateUrl
if 'UpdateCheckRate' in config.cloudConfig:
interval = int(config.cloudConfig.UpdateCheckRate)
TIME_TO_CHECK = interval + random.randint(0, interval*10)
if 'SetupUrl' in config.cloudConfig:
SETUP_URL = config.cloudConfig.SetupUrl
self.scheduler = scheduler(time, sleep)
self.Continue = True
self.currentVersion = ''
self.newVersion = ''
self.downloadUrl = ''
self.UpdateCleanup()
self.startTime = datetime.now() - timedelta(days=1)
评论列表
文章目录