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")
 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 upload_url_rpm(pulp, url):
    '''create an upload object fed from the url'''
    # get basename for upload purpose
    basename = url_basename(url)
    with closing(temp_url(url)) as tmpfile:
        data = rpm_metadata(tmpfile.file)
        # augment rpm file name
        data['unit_metadata']['relativepath'] = basename
        data['unit_metadata']['filename'] = basename
        upload = Upload.create(pulp, data=data)
        # feed the data
        tmpfile.file.seek(0)
        upload.file(pulp, tmpfile.file)
    return upload
 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 upload_url_rpm(pulp, url):
    '''create an upload object fed from the url'''
    # get basename for upload purpose
    basename = url_basename(url)
    with closing(temp_url(url)) as tmpfile:
        data = rpm_metadata(tmpfile.file)
        # augment rpm file name
        data['unit_metadata']['relativepath'] = basename
        data['unit_metadata']['filename'] = basename
        upload = Upload.create(pulp, data=data)
        # feed the data
        tmpfile.file.seek(0)
        upload.file(pulp, tmpfile.file)
    return upload
 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")
예제 #7
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")