Пример #1
0
class Common(pulse2.utils.Singleton):
    """  Base class
    """

    MD5SUMS = "MD5SUMS"
    CONFXML = "conf.xml"

    SMART_DETECT_NOTPLUGGED = 0
    SMART_DETECT_NOCHANGES = 1
    SMART_DETECT_PATHPB = 2
    SMART_DETECT_CHANGES = 3
    SMART_DETECT_ERROR = 4

    def init(self, config):
        self.working = True
        self.working_pkgs = {}
        self.logger = logging.getLogger()
        self.logger.info("Loading PackageServer > Common")
        self.config = config

        self.file_properties = {}
        self.packages = {}
        self.mp2p = {}
        self.reverse = {}
        self.files = {}
        self.fid2file = {}
        self.parser = PackageParser()
        self.parser.init(self.config)
        self.desc = []
        self.already_declared = {}
        self.dontgivepkgs = {}
        self.need_assign = {}
        self.temp_check_changes = {'LAST': {}, 'LOOP': {}, 'SIZE': {}}
        self.packageDetectionDate = {}
        self.newAssociation = {}
        self.inEdition = {}
        self.mp2src = {}

        try:
            self._detectPackages()
            self._buildReverse()
            self._buildFileList()

            self.logger.info("Common : finish loading %d packages" %
                             (len(self.packages)))
            self.working = False
        except Exception, e:
            self.logger.error("Common : failed to finish loading packages")
            self.working = False
            raise e
Пример #2
0
class Common(pulse2.utils.Singleton):
    """  Base class
    """

    MD5SUMS = "MD5SUMS"
    CONFXML = "conf.xml"

    SMART_DETECT_NOTPLUGGED = 0
    SMART_DETECT_NOCHANGES  = 1
    SMART_DETECT_PATHPB     = 2
    SMART_DETECT_CHANGES    = 3
    SMART_DETECT_ERROR      = 4

    def init(self, config):
        self.working = True
        self.working_pkgs = {}
        self.logger = logging.getLogger()
        self.logger.info("Loading PackageServer > Common")
        self.config = config

        self.file_properties = {}
        self.packages = {}
        self.mp2p = {}
        self.reverse = {}
        self.files = {}
        self.fid2file = {}
        self.parser = PackageParser()
        self.parser.init(self.config)
        self.desc = []
        self.already_declared = {}
        self.dontgivepkgs = {}
        self.need_assign = {}
        self.temp_check_changes = {'LAST':{}, 'LOOP':{}, 'SIZE':{}}
        self.packageDetectionDate = {}
        self.newAssociation = {}
        self.inEdition = {}
        self.mp2src = {}

        try:
            self._detectPackages()
            self._buildReverse()
            self._buildFileList()

            self.logger.info("Common : finish loading %d packages" % (len(self.packages)))
            self.working = False
        except Exception, e:
            self.logger.error("Common : failed to finish loading packages")
            self.working = False
            raise e
Пример #3
0
    def init(self, config):
        self.working = True
        self.working_pkgs = {}
        self.logger = logging.getLogger()
        self.logger.info("Loading PackageServer > Common")
        self.config = config

        self.file_properties = {}
        self.packages = {}
        self.mp2p = {}
        self.reverse = {}
        self.files = {}
        self.fid2file = {}
        self.parser = PackageParser()
        self.parser.init(self.config)
        self.desc = []
        self.already_declared = {}
        self.dontgivepkgs = {}
        self.need_assign = {}
        self.temp_check_changes = {'LAST': {}, 'LOOP': {}, 'SIZE': {}}
        self.packageDetectionDate = {}
        self.newAssociation = {}
        self.inEdition = {}
        self.mp2src = {}

        try:
            self._detectPackages()
            self._buildReverse()
            self._buildFileList()

            self.logger.info("Common : finish loading %d packages" %
                             (len(self.packages)))
            self.working = False
        except Exception, e:
            self.logger.error("Common : failed to finish loading packages")
            self.working = False
            raise e
Пример #4
0
    def init(self, config):
        self.working = True
        self.working_pkgs = {}
        self.logger = logging.getLogger()
        self.logger.info("Loading PackageServer > Common")
        self.config = config

        self.file_properties = {}
        self.packages = {}
        self.mp2p = {}
        self.reverse = {}
        self.files = {}
        self.fid2file = {}
        self.parser = PackageParser()
        self.parser.init(self.config)
        self.desc = []
        self.already_declared = {}
        self.dontgivepkgs = {}
        self.need_assign = {}
        self.temp_check_changes = {'LAST':{}, 'LOOP':{}, 'SIZE':{}}
        self.packageDetectionDate = {}
        self.newAssociation = {}
        self.inEdition = {}
        self.mp2src = {}

        try:
            self._detectPackages()
            self._buildReverse()
            self._buildFileList()

            self.logger.info("Common : finish loading %d packages" % (len(self.packages)))
            self.working = False
        except Exception, e:
            self.logger.error("Common : failed to finish loading packages")
            self.working = False
            raise e