Exemplo n.º 1
0
 def test_import(self):
     # Setup
     self.populate()
     pulp_conf.set('server', 'storage_dir', self.upfs)
     dist = CitrusHttpDistributor()
     repo = Repository(self.REPO_ID)
     cfg = {
         'protocol':'file',
         'http':{'alias':self.alias},
         'https':{'alias':self.alias},
         'file':{'alias':self.alias},
     }
     conduit = RepoPublishConduit(self.REPO_ID, CITRUS_DISTRUBUTOR)
     dist.publish_repo(repo, conduit, cfg)
     Repo.get_collection().remove()
     RepoDistributor.get_collection().remove()
     RepoContentUnit.get_collection().remove()
     unit_db.clean()
     # Test
     importer = CitrusHttpImporter()
     publisher = dist.publisher(repo, cfg)
     manifest_url = 'file://' + publisher.manifest_path()
     cfg = dict(manifest_url=manifest_url, strategy='mirror')
     conduit = RepoSyncConduit(
         self.REPO_ID,
         CITRUS_IMPORTER,
         RepoContentUnit.OWNER_TYPE_IMPORTER,
         CITRUS_IMPORTER)
     importer.sync_repo(repo, conduit, cfg)
     # Verify
     units = conduit.get_units()
     self.assertEquals(len(units), self.NUM_UNITS)
Exemplo n.º 2
0
 def test_payload_with_ssl(self):
     # Setup
     self.populate()
     pulp_conf.set('server', 'storage_dir', self.upfs)
     # Test
     dist = CitrusHttpDistributor()
     repo = Repository(self.REPO_ID)
     payload = dist.create_consumer_payload(repo, self.dist_conf_with_ssl())
Exemplo n.º 3
0
 def test_handler(*unused):
     # publish
     self.populate(ssl=True)
     pulp_conf.set('server', 'storage_dir', self.upfs)
     dist = CitrusHttpDistributor()
     repo = Repository(self.REPO_ID)
     conduit = RepoPublishConduit(self.REPO_ID, CITRUS_DISTRUBUTOR)
     dist.publish_repo(repo, conduit, self.dist_conf())
     units = []
     options = {}
     handler = NodeHandler(self)
     pulp_conf.set('server', 'storage_dir', self.downfs)
     report = handler.update(Conduit(), units, options)
     _report.append(report)
Exemplo n.º 4
0
 def test_handler(*unused):
     # publish
     self.populate()
     pulp_conf.set('server', 'storage_dir', self.upfs)
     dist = CitrusHttpDistributor()
     repo = Repository(self.REPO_ID)
     conduit = RepoPublishConduit(self.REPO_ID, CITRUS_DISTRUBUTOR)
     dist.publish_repo(repo, conduit, self.dist_conf())
     options = dict(strategy='additive')
     units = [{'type_id':'node', 'unit_key':None}]
     pulp_conf.set('server', 'storage_dir', self.downfs)
     container = Container(self.upfs)
     dispatcher = Dispatcher(container)
     container.handlers[CONTENT]['node'] = NodeHandler(self)
     container.handlers[CONTENT]['repository'] = RepositoryHandler(self)
     report = dispatcher.update(Conduit(), units, options)
     _report.append(report)
Exemplo n.º 5
0
 def test_handler(*unused):
     # publish
     self.populate()
     pulp_conf.set('server', 'storage_dir', self.upfs)
     dist = CitrusHttpDistributor()
     repo = Repository(self.REPO_ID)
     cfg = {
         'protocol':'file',
         'http':{'alias':self.alias},
         'https':{'alias':self.alias},
         'file':{'alias':self.alias},
     }
     conduit = RepoPublishConduit(self.REPO_ID, CITRUS_DISTRUBUTOR)
     dist.publish_repo(repo, conduit, cfg)
     units = []
     options = {}
     handler = NodeHandler(self)
     pulp_conf.set('server', 'storage_dir', self.downfs)
     os.makedirs(os.path.join(self.downfs, 'content'))
     report = handler.update(Conduit(), units, options)
     _report.append(report)
Exemplo n.º 6
0
 def test_publish(self):
     # Setup
     self.populate()
     pulp_conf.set('server', 'storage_dir', self.upfs)
     # Test
     dist = CitrusHttpDistributor()
     repo = Repository(self.REPO_ID)
     conduit = RepoPublishConduit(self.REPO_ID, CITRUS_DISTRUBUTOR)
     dist.publish_repo(repo, conduit, self.dist_conf())
     # Verify
     conf = DownloaderConfig('http')
     downloader = factory.get_downloader(conf)
     manifest = Manifest()
     pub = dist.publisher(repo, self.dist_conf())
     url = '/'.join((pub.base_url, pub.manifest_path()))
     units = manifest.read(url, downloader)
     self.assertEqual(len(units), self.NUM_UNITS)
     for n in range(0, self.NUM_UNITS):
         unit = units[n]
         created = self.units[n]
         for p, v in unit['metadata'].items():
             if p.startswith('_'):
                 continue
             self.assertEqual(created[p], v)