當前位置: 首頁>>代碼示例>>Python>>正文


Python ISODistributor._export_distributions方法代碼示例

本文整理匯總了Python中iso_distributor.distributor.ISODistributor._export_distributions方法的典型用法代碼示例。如果您正苦於以下問題:Python ISODistributor._export_distributions方法的具體用法?Python ISODistributor._export_distributions怎麽用?Python ISODistributor._export_distributions使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在iso_distributor.distributor.ISODistributor的用法示例。


在下文中一共展示了ISODistributor._export_distributions方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_distribution_exports

# 需要導入模塊: from iso_distributor.distributor import ISODistributor [as 別名]
# 或者: from iso_distributor.distributor.ISODistributor import _export_distributions [as 別名]
 def test_distribution_exports(self):
     feed_url = "file://%s/pulp_unittest/" % self.data_dir
     repo = mock.Mock(spec=Repository)
     repo.working_dir = self.repo_working_dir
     repo.id = "pulp_unittest"
     repo.checksumtype = 'sha'
     sync_conduit = importer_mocks.get_sync_conduit(type_id=TYPE_ID_RPM, existing_units=[], pkg_dir=self.pkg_dir)
     config = importer_mocks.get_basic_config(feed_url=feed_url)
     importerRPM = importer_rpm.ImporterRPM()
     status, summary, details = importerRPM.sync(repo, sync_conduit, config)
     dunit_key = {}
     dunit_key['id'] = "ks-TestFamily-TestVariant-16-x86_64"
     dunit_key['version'] = "16"
     dunit_key['arch'] = "x86_64"
     dunit_key['family'] = "TestFamily"
     dunit_key['variant'] = "TestVariant"
     metadata = { "files" : [{"checksumtype" : "sha256", 	"relativepath" : "images/fileA.txt", 	"fileName" : "fileA.txt",
                 "downloadurl" : "http://repos.fedorapeople.org/repos/pulp/pulp/demo_repos/pulp_unittest//images/fileA.txt",
                 "item_type" : "tree_file",
                 "savepath" : "%s/testr1/images" % self.repo_working_dir,
                 "checksum" : "22603a94360ee24b7034c74fa13d70dd122aa8c4be2010fc1361e1e6b0b410ab",
                 "filename" : "fileA.txt",
                 "pkgpath" : "%s/ks-TestFamily-TestVariant-16-x86_64/images" % self.pkg_dir,
                 "size" : 0 },
             { 	"checksumtype" : "sha256", 	"relativepath" : "images/fileB.txt", 	"fileName" : "fileB.txt",
                 "downloadurl" : "http://repos.fedorapeople.org/repos/pulp/pulp/demo_repos/pulp_unittest//images/fileB.txt",
                 "item_type" : "tree_file",
                 "savepath" : "%s/testr1/images" % self.repo_working_dir,
                 "checksum" : "8dc89e9883c098443f6616e60a8e489254bf239eeade6e4b4943b7c8c0c345a4",
                 "filename" : "fileB.txt",
                 "pkgpath" : "%s/ks-TestFamily-TestVariant-16-x86_64/images" % self.pkg_dir, 	"size" : 0 },
             { 	"checksumtype" : "sha256", 	"relativepath" : "images/fileC.iso", 	"fileName" : "fileC.iso",
                 "downloadurl" : "http://repos.fedorapeople.org/repos/pulp/pulp/demo_repos/pulp_unittest//images/fileC.iso",
                 "item_type" : "tree_file",
                 "savepath" : "%s/testr1/images" % self.repo_working_dir,
                 "checksum" : "099f2bafd533e97dcfee778bc24138c40f114323785ac1987a0db66e07086f74",
                 "filename" : "fileC.iso",
                 "pkgpath" : "%s/ks-TestFamily-TestVariant-16-x86_64/images" % self.pkg_dir, 	"size" : 0 } ],}
     distro_unit = Unit(distribution.TYPE_ID_DISTRO, dunit_key, metadata, '')
     distro_unit.storage_path = "%s/ks-TestFamily-TestVariant-16-x86_64" % self.pkg_dir
     symlink_dir = "%s/%s" % (self.repo_working_dir, "isos")
     iso_distributor = ISODistributor()
     publish_conduit = distributor_mocks.get_publish_conduit(existing_units=[distro_unit], pkg_dir=self.pkg_dir)
     config = distributor_mocks.get_basic_config(https_publish_dir=self.https_publish_dir, http=False, https=True)
     status, errors = iso_distributor._export_distributions([distro_unit], symlink_dir)
     print status, errors
     self.assertTrue(status)
     for file in metadata['files']:
         print os.path.isfile("%s/%s" % (symlink_dir, file['relativepath']))
         self.assertTrue(os.path.isfile("%s/%s" % (symlink_dir, file['relativepath'])))
開發者ID:stpierre,項目名稱:pulp,代碼行數:52,代碼來源:test_iso_distributor.py


注:本文中的iso_distributor.distributor.ISODistributor._export_distributions方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。