def rpm_uploader(pulp, url, repo, distributor):
     '''perform an upload'''
     # create an already fed upload object
     with deleting(pulp, upload_url_rpm(pulp, url)) as upload:
         # assing upload to repo
         Task.wait_for_report(pulp, upload.import_to(pulp, repo))
         # publish the content
         Task.wait_for_report(pulp, repo.publish(pulp, distributor.id))
         # download the rpm from pulp now
         pulp_rpm_url = distributor.content_url(pulp, url_basename(url))
         with closing(temp_url(pulp_rpm_url)) as tmpfile:
             # make sure the rpm fetched has the same name as the one uploaded
             assert url_basename(url).startswith(rpm_metadata(tmpfile)['unit_key']['name'])
 def rpm_uploader(pulp, url, repo, distributor):
     '''perform an upload'''
     # create an already fed upload object
     with deleting(pulp, upload_url_rpm(pulp, url)) as (upload, ):
         # assing upload to repo
         Task.wait_for_report(pulp, upload.import_to(pulp, repo))
         # publish the content
         Task.wait_for_report(pulp, repo.publish(pulp, distributor.id))
         # download the rpm from pulp now
         pulp_rpm_url = distributor.content_url(pulp, url_basename(url))
         with closing(temp_url(pulp_rpm_url)) as tmpfile:
             # make sure the rpm fetched has the same name as the one uploaded
             assert url_basename(url).startswith(
                 rpm_metadata(tmpfile)['unit_key']['name'])
예제 #3
0
 def testcase_01_upload_and_download_using_dnf_rpm(self):
     # create yum-repo, -importer, -distributor
     with deleting(self.pulp, *create_yum_repo(self.pulp, 'test_22_rpm_repo_for_dnf')) as (repo, (importer, (distributor))):
         # create and perform an rpm url upload
         with deleting(self.pulp, upload_url_rpm(self.pulp, self.rpm_url)) as upload:
             # assign the upload to the repo
             response = upload.import_to(self.pulp, repo)
             self.assertPulpOK()
             Task.wait_for_report(self.pulp, response)
             # check the content is accessible
             response = repo.publish(self.pulp, distributor.id)
             self.assertPulpOK()
             Task.wait_for_report(self.pulp, response)
             # fetch the package through the repo
             pulp_rpm_url = distributor.content_url(self.pulp, url_basename(self.rpm_url))
             pulp_repo = distributor.content_url(self.pulp)
             with closing(temp_url(pulp_rpm_url)) as tmpfile:
                 assert url_basename(self.rpm_url).startswith(rpm_metadata(tmpfile)['unit_key']['name'])
             assert "bear" == download_package_with_dnf(self.pulp, pulp_repo, "bear")
예제 #4
0
 def testcase_01_upload_and_download_using_dnf_rpm(self):
     # create yum-repo, -importer, -distributor
     repo, importer, [distributor] = YumRepo(id='test_22_rpm_repo_for_dnf', importer=YumImporter(feed=None),
                                         distributors=[YumDistributor(relative_url='xyz')]).create(self.pulp)
     with deleting(self.pulp, repo, importer, distributor):
         # create and perform an rpm url upload
         with deleting(self.pulp, upload_url_rpm(self.pulp, self.rpm_url)) as (upload,):
             # assign the upload to the repo
             response = upload.import_to(self.pulp, repo)
             self.assertPulpOK()
             Task.wait_for_report(self.pulp, response)
             # check the content is accessible
             response = repo.publish(self.pulp, distributor.id)
             self.assertPulpOK()
             Task.wait_for_report(self.pulp, response)
             # fetch the package through the repo
             pulp_rpm_url = distributor.content_url(self.pulp, url_basename(self.rpm_url))
             pulp_repo = distributor.content_url(self.pulp)
             with closing(temp_url(pulp_rpm_url)) as tmpfile:
                 assert url_basename(self.rpm_url).startswith(rpm_metadata(tmpfile)['unit_key']['name'])
             assert "bear" == download_package_with_dnf(self.pulp, pulp_repo, "bear")