From 995de1e1fba53dc15ec35a61059c8b82eb3a5f42 Mon Sep 17 00:00:00 2001 From: Markus Birth Date: Sat, 3 Feb 2018 02:37:55 +0100 Subject: [PATCH] Cleanup. --- tcllib/__init__.py | 14 +------------- tcllib/dumpmgr.py | 3 +++ tcllib/servervote.py | 14 ++++++++++++++ 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/tcllib/__init__.py b/tcllib/__init__.py index 69b378e..b8a82d2 100644 --- a/tcllib/__init__.py +++ b/tcllib/__init__.py @@ -37,6 +37,7 @@ class FotaCheck( CKOT = default_enum("CKOT", ["ALL", "AOTA_ONLY", "FOTA_ONLY"]) def __init__(self): + super().__init__() self.serid = "543212345000000" self.curef = "PRD-63117-011" self.fv = "AAM481" @@ -48,19 +49,6 @@ class FotaCheck( self.ckot = self.CKOT.ALL self.rtd = self.RTD.UNROOTED self.chnl = self.CHNL.WIFI - self.g2master = None - self.master_servers = [ - "g2master-us-east.tclclouds.com", - "g2master-us-west.tclclouds.com", - "g2master-eu-west.tclclouds.com", - "g2master-ap-south.tclclouds.com", - "g2master-ap-north.tclclouds.com", - "g2master-sa-east.tclclouds.com", - ] - self.master_servers_weights = [3] * len(self.master_servers) - self.check_time_sum = 3 - self.check_time_count = 1 - self.last_dump_filename = None self.reset_session() def reset_session(self): diff --git a/tcllib/dumpmgr.py b/tcllib/dumpmgr.py index 1be192a..04ad79f 100644 --- a/tcllib/dumpmgr.py +++ b/tcllib/dumpmgr.py @@ -6,6 +6,9 @@ import os from . import ansi class DumpMgr: + def __init__(self): + self.last_dump_filename = None + def write_dump(self, data): outfile = os.path.normpath("logs/{}.xml".format(self.get_salt())) if not os.path.exists(os.path.dirname(outfile)): diff --git a/tcllib/servervote.py b/tcllib/servervote.py index 405c727..57acbdc 100644 --- a/tcllib/servervote.py +++ b/tcllib/servervote.py @@ -3,6 +3,20 @@ import numpy class ServerVote: + def __init__(self): + self.g2master = None + self.master_servers = [ + "g2master-us-east.tclclouds.com", + "g2master-us-west.tclclouds.com", + "g2master-eu-west.tclclouds.com", + "g2master-ap-south.tclclouds.com", + "g2master-ap-north.tclclouds.com", + "g2master-sa-east.tclclouds.com", + ] + self.master_servers_weights = [3] * len(self.master_servers) + self.check_time_sum = 3 + self.check_time_count = 1 + def get_master_server(self): weight_sum = 0 for i in self.master_servers_weights: