Пример #1
0
    def _doMirror(self, mirrorCfg, sourceRepos, targetRepos, fullSync = False):

        from conary.conaryclient import mirror
        from conary.lib import util

        # set the correct tmpdir to use
        tmpDir = os.path.join(self.cfg.dataPath, 'tmp')
        if os.access(tmpDir, os.W_OK):
            util.settempdir(tmpDir)
            log.info("Using %s as tmpDir", tmpDir)
        else:
            log.warning("Using system temporary directory")

        fullSync = self.options.sync or fullSync
        if fullSync:
            log.info("Full sync requested on this mirror")
        if self.options.syncSigs:
            log.info("Full signature sync requested on this mirror")

        # first time through, we should pass in sync options;
        # subsequent passes should use the mirror marks
        passNumber = 1

        if self.options.test:
            # If we are testing, print the configuration
            if not self.options.showConfig:
                log.info("--test implies --show-config")
                self.options.showConfig = True

        if self.options.showConfig:
            print >> sys.stdout, "-- Start Mirror Configuration File --"
            mirrorCfg.display()
            print >> sys.stdout, "-- End Mirror Configuration File --"
            sys.stdout.flush()

        if self.options.test:
            log.info("Testing mode, not actually mirroring")
            return

        log.info("Beginning pass %d", passNumber)
        callAgain = mirror.mirrorRepository(sourceRepos, targetRepos,
            mirrorCfg, sync = self.options.sync or fullSync,
            syncSigs = self.options.syncSigs)
        log.info("Completed pass %d", passNumber)

        while callAgain:
            passNumber += 1
            log.info("Beginning pass %d", passNumber)
            callAgain = mirror.mirrorRepository(sourceRepos,
                targetRepos, mirrorCfg)
            log.info("Completed pass %d", passNumber)
Пример #2
0
 def _runMirrorCfg(self, src, dst, cfg, verbose=False):
     if verbose:
         from conary.lib import log
         log.setVerbosity(log.DEBUG)
     while 1:
         ret = mirror.mirrorRepository(src, dst, cfg)
         if not ret:
             break
     return
Пример #3
0
 def _runMirrorCfg(self, src, dst, cfg, verbose=False):
     if verbose:
         from conary.lib import log
         log.setVerbosity(log.DEBUG)
     while 1:
         ret = mirror.mirrorRepository(src, dst, cfg)
         if not ret:
             break
     return
Пример #4
0
    def testMirrorAccess(self):
        src, dst = self.createRepositories()
        mirrorFile = self.createConfigurationFile()
        cfg = mirror.MirrorFileConfiguration()
        cfg.host = "localhost"
        # get a non-mirror user access
        src1 = self.getRepositoryClient("nomirror", "nomirror", serverIdx=0)
        dst1 = self.getRepositoryClient("nomirror", "nomirror", serverIdx=1)
        self.createTroves(src, 10, 2)
        self.createTroves(src1, 20, 2)
        self.assertRaises(AssertionError, self.compareRepositories, src, dst)
        # this needs to raise an assertionerror before insufficient permission
        self.assertRaises(AssertionError, self.compareRepositories, src1, dst1)

        # test acess permissions
        self.assertRaises(errors.InsufficientPermission,
                          mirror.mirrorRepository, src1, dst, cfg)
        self.assertRaises(errors.InsufficientPermission,
                          mirror.mirrorRepository, src, dst1, cfg)
        mirror.mirrorRepository(src, dst, cfg)
        self.compareRepositories(src, dst)
Пример #5
0
    def testMirrorAccess(self):
        src, dst = self.createRepositories()
        mirrorFile = self.createConfigurationFile()
        cfg = mirror.MirrorFileConfiguration()
        cfg.host = "localhost"
        # get a non-mirror user access
        src1 = self.getRepositoryClient("nomirror", "nomirror", serverIdx=0)
        dst1 = self.getRepositoryClient("nomirror", "nomirror", serverIdx=1)
        self.createTroves(src, 10, 2)
        self.createTroves(src1, 20, 2)
        self.assertRaises(AssertionError, self.compareRepositories, src, dst)
        # this needs to raise an assertionerror before insufficient permission
        self.assertRaises(AssertionError, self.compareRepositories, src1, dst1)

        # test acess permissions
        self.assertRaises(errors.InsufficientPermission, mirror.mirrorRepository,
                              src1, dst, cfg)
        self.assertRaises(errors.InsufficientPermission, mirror.mirrorRepository,
                              src, dst1, cfg)
        mirror.mirrorRepository(src, dst, cfg)
        self.compareRepositories(src, dst)