本文整理汇总了Python中pulp.plugins.model.Unit.storage_path方法的典型用法代码示例。如果您正苦于以下问题:Python Unit.storage_path方法的具体用法?Python Unit.storage_path怎么用?Python Unit.storage_path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pulp.plugins.model.Unit
的用法示例。
在下文中一共展示了Unit.storage_path方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_repo_export_isos
# 需要导入模块: from pulp.plugins.model import Unit [as 别名]
# 或者: from pulp.plugins.model.Unit import storage_path [as 别名]
def test_repo_export_isos(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)
unit_key_a = {'id' : '','name' :'pulp-dot-2.0-test', 'version' :'0.1.2', 'release' : '1.fc11', 'epoch':'0', 'arch' : 'x86_64', 'checksumtype' : 'sha256',
'checksum': '435d92e6c09248b501b8d2ae786f92ccfad69fab8b1bc774e2b66ff6c0d83979', 'type_id' : 'rpm'}
unit_a = Unit(TYPE_ID_RPM, unit_key_a, {}, '')
unit_a.storage_path = "%s/pulp-dot-2.0-test/0.1.2/1.fc11/x86_64/435d92e6c09248b501b8d2ae786f92ccfad69fab8b1bc774e2b66ff6c0d83979/pulp-dot-2.0-test-0.1.2-1.fc11.x86_64.rpm" % self.pkg_dir
unit_key_b = {'id' : '', 'name' :'pulp-test-package', 'version' :'0.2.1', 'release' :'1.fc11', 'epoch':'0','arch' : 'x86_64', 'checksumtype' :'sha256',
'checksum': '4dbde07b4a8eab57e42ed0c9203083f1d61e0b13935d1a569193ed8efc9ecfd7', 'type_id' : 'rpm', }
unit_b = Unit(TYPE_ID_RPM, unit_key_b, {}, '')
unit_b.storage_path = "%s/pulp-test-package/0.2.1/1.fc11/x86_64/4dbde07b4a8eab57e42ed0c9203083f1d61e0b13935d1a569193ed8efc9ecfd7/pulp-test-package-0.2.1-1.fc11.x86_64.rpm" % self.pkg_dir
unit_key_c = {'id' : '', 'name' :'pulp-test-package', 'version' :'0.3.1', 'release' :'1.fc11', 'epoch':'0','arch' : 'x86_64', 'checksumtype' :'sha256',
'checksum': '6bce3f26e1fc0fc52ac996f39c0d0e14fc26fb8077081d5b4dbfb6431b08aa9f', 'type_id' : 'rpm', }
unit_c = Unit(TYPE_ID_RPM, unit_key_c, {}, '')
unit_c.storage_path = "%s/pulp-test-package/0.3.1/1.fc11/x86_64/6bce3f26e1fc0fc52ac996f39c0d0e14fc26fb8077081d5b4dbfb6431b08aa9f/pulp-test-package-0.3.1-1.fc11.x86_64.rpm" % self.pkg_dir
existing_units = []
for unit in [unit_a, unit_b, unit_c]:
existing_units.append(unit)
sync_conduit = importer_mocks.get_sync_conduit(type_id=TYPE_ID_RPM, existing_units=existing_units, pkg_dir=self.pkg_dir)
importerErrata = errata.ImporterErrata()
importerErrata.sync(repo, sync_conduit, config)
repo.working_dir = "%s/%s" % (self.repo_working_dir, "export")
iso_distributor = ISODistributor()
publish_conduit = distributor_mocks.get_publish_conduit(existing_units=existing_units, pkg_dir=self.pkg_dir)
# test https publish
config = distributor_mocks.get_basic_config(http_publish_dir=self.http_publish_dir, https_publish_dir=self.https_publish_dir, http=False, https=True, generate_metadata=True)
report = iso_distributor.publish_repo(repo, publish_conduit, config)
print report
self.assertTrue(os.path.exists("%s/%s" % (self.https_publish_dir, repo.id)))
self.assertEquals(len(os.listdir(self.http_publish_dir)), 0)
# test http publish
config = distributor_mocks.get_basic_config(http_publish_dir=self.http_publish_dir, https_publish_dir=self.https_publish_dir, http=True, https=False)
report = iso_distributor.publish_repo(repo, publish_conduit, config)
self.assertTrue(os.path.exists("%s/%s" % (self.http_publish_dir, repo.id)))
self.assertEquals(len(os.listdir(self.https_publish_dir)), 0)
isos_list = os.listdir("%s/%s" % (self.http_publish_dir, repo.id))
self.assertEqual(len(isos_list), 1)
# make sure the iso name defaults to repoid
self.assertTrue( isos_list[-1].startswith(repo.id))
# test isoprefix:
iso_prefix = "mock-iso-prefix"
config = distributor_mocks.get_basic_config(http_publish_dir=self.http_publish_dir, https_publish_dir=self.https_publish_dir, http=True, https=False, iso_prefix=iso_prefix)
report = iso_distributor.publish_repo(repo, publish_conduit, config)
self.assertTrue(os.path.exists("%s/%s" % (self.http_publish_dir, repo.id)))
self.assertEquals(len(os.listdir(self.https_publish_dir)), 0)
isos_list = os.listdir("%s/%s" % (self.http_publish_dir, repo.id))
self.assertEqual(len(isos_list), 2)
print isos_list
# make sure the iso name uses the prefix
self.assertTrue( isos_list[-1].startswith(iso_prefix))
示例2: test_generate_isos
# 需要导入模块: from pulp.plugins.model import Unit [as 别名]
# 或者: from pulp.plugins.model.Unit import storage_path [as 别名]
def test_generate_isos(self):
repo = mock.Mock(spec=Repository)
repo.id = "test_repo_for_export"
repo.working_dir = self.repo_iso_working_dir + "/" + repo.id
unit_key_a = {'id' : '','name' :'pulp-dot-2.0-test', 'version' :'0.1.2', 'release' : '1.fc11', 'epoch':'0', 'arch' : 'x86_64', 'checksumtype' : 'sha256',
'checksum': '435d92e6c09248b501b8d2ae786f92ccfad69fab8b1bc774e2b66ff6c0d83979', 'type_id' : 'rpm'}
unit_a = Unit(TYPE_ID_RPM, unit_key_a, {'updated' : ''}, '')
unit_a.storage_path = "%s/pulp-dot-2.0-test/0.1.2/1.fc11/x86_64/435d92e6c09248b501b8d2ae786f92ccfad69fab8b1bc774e2b66ff6c0d83979/pulp-dot-2.0-test-0.1.2-1.fc11.x86_64.rpm" % self.pkg_dir
unit_key_b = {'id' : '', 'name' :'pulp-test-package', 'version' :'0.2.1', 'release' :'1.fc11', 'epoch':'0','arch' : 'x86_64', 'checksumtype' :'sha256',
'checksum': '4dbde07b4a8eab57e42ed0c9203083f1d61e0b13935d1a569193ed8efc9ecfd7', 'type_id' : 'rpm', }
unit_b = Unit(TYPE_ID_RPM, unit_key_b, {'updated' : ''}, '')
unit_b.storage_path = "%s/pulp-test-package/0.2.1/1.fc11/x86_64/4dbde07b4a8eab57e42ed0c9203083f1d61e0b13935d1a569193ed8efc9ecfd7/pulp-test-package-0.2.1-1.fc11.x86_64.rpm" % self.pkg_dir
unit_key_c = {'id' : '', 'name' :'pulp-test-package', 'version' :'0.3.1', 'release' :'1.fc11', 'epoch':'0','arch' : 'x86_64', 'checksumtype' :'sha256',
'checksum': '6bce3f26e1fc0fc52ac996f39c0d0e14fc26fb8077081d5b4dbfb6431b08aa9f', 'type_id' : 'rpm', }
unit_c = Unit(TYPE_ID_RPM, unit_key_c, {'updated' : ''}, '')
unit_c.storage_path = "%s/pulp-test-package/0.3.1/1.fc11/x86_64/6bce3f26e1fc0fc52ac996f39c0d0e14fc26fb8077081d5b4dbfb6431b08aa9f/pulp-test-package-0.3.1-1.fc11.x86_64.rpm" % self.pkg_dir
existing_units = []
for unit in [unit_a, unit_b, unit_c]:
existing_units.append(unit)
global progress_status
progress_status = None
def set_progress(progress):
global progress_status
progress_status = progress
publish_conduit = distributor_mocks.get_publish_conduit(pkg_dir=self.pkg_dir, existing_units=existing_units)
config = distributor_mocks.get_basic_config(https_publish_dir=self.https_publish_dir, http_publish_dir=self.http_publish_dir,
generate_metadata=True, http=True, https=False, iso_prefix="test-isos")
distributor = ISODistributor()
def cleanup(repo_working_dir):
return
iso_util.cleanup_working_dir = mock.Mock()
iso_util.cleanup_working_dir.side_effect = cleanup
publish_conduit.set_progress = mock.Mock()
publish_conduit.set_progress.side_effect = set_progress
progress_status = distributor.init_progress()
distributor.publish_repo(repo, publish_conduit, config)
self.assertTrue("isos" in progress_status)
self.assertTrue(progress_status["isos"].has_key("state"))
self.assertEqual(progress_status["isos"]["state"], "FINISHED")
self.assertEqual(progress_status["isos"]["num_success"], 1)
self.assertTrue(progress_status["isos"]["size_total"] is not None)
self.assertEqual(progress_status["isos"]["size_left"], 0)
self.assertEqual(progress_status["isos"]["items_total"], 1)
self.assertEqual(progress_status["isos"]["items_left"], 0)
self.assertTrue(os.path.exists("%s/%s" % (self.http_publish_dir, repo.id)))
self.assertEquals(len(os.listdir(self.https_publish_dir)), 0)
isos_list = os.listdir("%s/%s" % (self.http_publish_dir, repo.id))
self.assertEqual(len(isos_list), 1)
# make sure the iso name defaults to repoid
self.assertTrue( isos_list[0].startswith("test-isos"))
示例3: test_distribution_exports
# 需要导入模块: from pulp.plugins.model import Unit [as 别名]
# 或者: from pulp.plugins.model.Unit import storage_path [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)
repo_exporter = RepoExporter(symlink_dir)
# status, errors = iso_distributor._export_distributions([distro_unit], symlink_dir)
status, errors = repo_exporter.export_distributions([distro_unit])
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'])))
示例4: test_export_rpm
# 需要导入模块: from pulp.plugins.model import Unit [as 别名]
# 或者: from pulp.plugins.model.Unit import storage_path [as 别名]
def test_export_rpm(self):
feed_url = "file://%s/test_repo_for_export/" % (self.data_dir)
repo = mock.Mock(spec=Repository)
repo.working_dir = self.repo_working_dir
repo.id = "test_repo_for_export"
sync_conduit = importer_mocks.get_sync_conduit(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)
self.assertTrue(summary is not None)
self.assertTrue(details is not None)
self.assertTrue(status)
unit_key_a = {'id' : '','name' :'pulp-dot-2.0-test', 'version' :'0.1.2', 'release' : '1.fc11', 'epoch':'0', 'arch' : 'x86_64', 'checksumtype' : 'sha256',
'checksum': '435d92e6c09248b501b8d2ae786f92ccfad69fab8b1bc774e2b66ff6c0d83979', 'type_id' : 'rpm'}
unit_a = Unit(TYPE_ID_RPM, unit_key_a, {}, '')
unit_a.storage_path = "%s/pulp-dot-2.0-test/0.1.2/1.fc11/x86_64/435d92e6c09248b501b8d2ae786f92ccfad69fab8b1bc774e2b66ff6c0d83979/pulp-dot-2.0-test-0.1.2-1.fc11.x86_64.rpm" % self.pkg_dir
unit_key_b = {'id' : '', 'name' :'pulp-test-package', 'version' :'0.2.1', 'release' :'1.fc11', 'epoch':'0','arch' : 'x86_64', 'checksumtype' :'sha256',
'checksum': '4dbde07b4a8eab57e42ed0c9203083f1d61e0b13935d1a569193ed8efc9ecfd7', 'type_id' : 'rpm', }
unit_b = Unit(TYPE_ID_RPM, unit_key_b, {}, '')
unit_b.storage_path = "%s/pulp-test-package/0.2.1/1.fc11/x86_64/4dbde07b4a8eab57e42ed0c9203083f1d61e0b13935d1a569193ed8efc9ecfd7/pulp-test-package-0.2.1-1.fc11.x86_64.rpm" % self.pkg_dir
unit_key_c = {'id' : '', 'name' :'pulp-test-package', 'version' :'0.3.1', 'release' :'1.fc11', 'epoch':'0','arch' : 'x86_64', 'checksumtype' :'sha256',
'checksum': '6bce3f26e1fc0fc52ac996f39c0d0e14fc26fb8077081d5b4dbfb6431b08aa9f', 'type_id' : 'rpm', }
unit_c = Unit(TYPE_ID_RPM, unit_key_c, {}, '')
unit_c.storage_path = "%s/pulp-test-package/0.3.1/1.fc11/x86_64/6bce3f26e1fc0fc52ac996f39c0d0e14fc26fb8077081d5b4dbfb6431b08aa9f/pulp-test-package-0.3.1-1.fc11.x86_64.rpm" % self.pkg_dir
existing_units = []
for unit in [unit_a, unit_b, unit_c]:
existing_units.append(unit)
symlink_dir = "%s/%s" % (self.repo_working_dir, "isos")
iso_distributor = ISODistributor()
publish_conduit = distributor_mocks.get_publish_conduit(existing_units=existing_units, pkg_dir=self.pkg_dir)
config = distributor_mocks.get_basic_config(https_publish_dir=self.https_publish_dir, http=False, https=True)
print symlink_dir
# status, errors = iso_distributor._export_rpms(existing_units, symlink_dir)
repo_exporter = RepoExporter(symlink_dir)
status, errors = repo_exporter.export_rpms(existing_units)
print status, errors
self.assertTrue(status)
self.assertEquals(len(os.listdir(symlink_dir)), 3)
示例5: test_orphaned_distributions
# 需要导入模块: from pulp.plugins.model import Unit [as 别名]
# 或者: from pulp.plugins.model.Unit import storage_path [as 别名]
def test_orphaned_distributions(self):
feed_url = "http://repos.fedorapeople.org/repos/pulp/pulp/demo_repos/pulp_unittest/"
repo = mock.Mock(spec=Repository)
repo.working_dir = self.working_dir
repo.id = "test_repo"
sync_conduit = importer_mocks.get_sync_conduit(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)
self.assertTrue(status)
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.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.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.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
new_feed_url = "http://repos.fedorapeople.org/repos/pulp/pulp/demo_repos/zoo/"
sync_conduit = importer_mocks.get_sync_conduit(pkg_dir=self.pkg_dir, existing_units=[distro_unit])
config = importer_mocks.get_basic_config(feed_url=new_feed_url)
status, summary, details = importerRPM.sync(repo, sync_conduit, config)
print status, summary, details
self.assertTrue(status)
self.assertTrue(summary is not None)
self.assertTrue(details is not None)
self.assertEquals(summary["num_orphaned_distributions"], 1)
示例6: test_get_relpath_from_unit
# 需要导入模块: from pulp.plugins.model import Unit [as 别名]
# 或者: from pulp.plugins.model.Unit import storage_path [as 别名]
def test_get_relpath_from_unit(self):
distributor = YumDistributor()
test_unit = Unit("rpm", "unit_key", {}, "")
test_unit.unit_key = {"fileName" : "test_1"}
rel_path = util.get_relpath_from_unit(test_unit)
self.assertEqual(rel_path, "test_1")
test_unit.unit_key = {}
test_unit.storage_path = "test_0"
rel_path = util.get_relpath_from_unit(test_unit)
self.assertEqual(rel_path, "test_0")
test_unit.metadata["filename"] = "test_2"
rel_path = util.get_relpath_from_unit(test_unit)
self.assertEqual(rel_path, "test_2")
test_unit.metadata["relativepath"] = "test_3"
rel_path = util.get_relpath_from_unit(test_unit)
self.assertEqual(rel_path, "test_3")
示例7: test_group_publish_isos
# 需要导入模块: from pulp.plugins.model import Unit [as 别名]
# 或者: from pulp.plugins.model.Unit import storage_path [as 别名]
def test_group_publish_isos(self):
feed_url = "file://%s/pulp_unittest/" % self.data_dir
repo_1 = mock.Mock(spec=Repository)
repo_1.id = "test_repo_for_export_1"
repo_1.working_dir = self.repo_working_dir
repo_1.checksumtype = 'sha'
repo_2 = mock.Mock(spec=Repository)
repo_2.id = "test_repo_for_export_2"
repo_2.working_dir = self.repo_working_dir
repo_2.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_1, sync_conduit, config)
status, summary, details = importerRPM.sync(repo_2, sync_conduit, config)
unit_key_a = {'id' : '','name' :'pulp-dot-2.0-test', 'version' :'0.1.2', 'release' : '1.fc11', 'epoch':'0', 'arch' : 'x86_64', 'checksumtype' : 'sha256',
'checksum': '435d92e6c09248b501b8d2ae786f92ccfad69fab8b1bc774e2b66ff6c0d83979', 'type_id' : 'rpm'}
unit_a = Unit(TYPE_ID_RPM, unit_key_a, {}, '')
unit_a.storage_path = "%s/pulp-dot-2.0-test/0.1.2/1.fc11/x86_64/435d92e6c09248b501b8d2ae786f92ccfad69fab8b1bc774e2b66ff6c0d83979/pulp-dot-2.0-test-0.1.2-1.fc11.x86_64.rpm" % self.pkg_dir
unit_key_b = {'id' : '', 'name' :'pulp-test-package', 'version' :'0.2.1', 'release' :'1.fc11', 'epoch':'0','arch' : 'x86_64', 'checksumtype' :'sha256',
'checksum': '4dbde07b4a8eab57e42ed0c9203083f1d61e0b13935d1a569193ed8efc9ecfd7', 'type_id' : 'rpm', }
unit_b = Unit(TYPE_ID_RPM, unit_key_b, {}, '')
unit_b.storage_path = "%s/pulp-test-package/0.2.1/1.fc11/x86_64/4dbde07b4a8eab57e42ed0c9203083f1d61e0b13935d1a569193ed8efc9ecfd7/pulp-test-package-0.2.1-1.fc11.x86_64.rpm" % self.pkg_dir
unit_key_c = {'id' : '', 'name' :'pulp-test-package', 'version' :'0.3.1', 'release' :'1.fc11', 'epoch':'0','arch' : 'x86_64', 'checksumtype' :'sha256',
'checksum': '6bce3f26e1fc0fc52ac996f39c0d0e14fc26fb8077081d5b4dbfb6431b08aa9f', 'type_id' : 'rpm', }
unit_c = Unit(TYPE_ID_RPM, unit_key_c, {}, '')
unit_c.storage_path = "%s/pulp-test-package/0.3.1/1.fc11/x86_64/6bce3f26e1fc0fc52ac996f39c0d0e14fc26fb8077081d5b4dbfb6431b08aa9f/pulp-test-package-0.3.1-1.fc11.x86_64.rpm" % self.pkg_dir
existing_units = []
for unit in [unit_a, unit_b, unit_c]:
existing_units.append(unit)
sync_conduit = importer_mocks.get_sync_conduit(type_id=TYPE_ID_RPM, existing_units=existing_units, pkg_dir=self.pkg_dir)
importerErrata = errata.ImporterErrata()
importerErrata.sync(repo_1, sync_conduit, config)
importerErrata.sync(repo_2, sync_conduit, config)
repo_group = mock.Mock(spec=RepositoryGroup)
repo_group.id = "test_group"
repo_group.repo_ids = [repo_1.id, repo_2.id]
repo_group.working_dir = self.group_working_dir
global progress_status
progress_status = None
def set_progress(progress):
global progress_status
progress_status = progress
publish_conduit = distributor_mocks.get_publish_conduit(existing_units=existing_units, pkg_dir=self.pkg_dir)
config = distributor_mocks.get_basic_config(https_publish_dir=self.https_publish_dir, http_publish_dir=self.http_publish_dir,
generate_metadata=True, http=True, https=False, iso_prefix="test-isos")
distributor = GroupISODistributor()
def cleanup(repo_working_dir):
return
iso_util.cleanup_working_dir.cleanup = mock.Mock()
iso_util.cleanup_working_dir.side_effect = cleanup
publish_conduit.set_progress = mock.Mock()
publish_conduit.set_progress.side_effect = set_progress
distributor.publish_group(repo_group, publish_conduit, config)
self.assertTrue("isos" in progress_status)
self.assertTrue(progress_status["isos"].has_key("state"))
self.assertEqual(progress_status["isos"]["state"], "FINISHED")
self.assertTrue(os.path.exists("%s/%s" % (self.http_publish_dir, repo_group.id)))
self.assertEquals(len(os.listdir(self.https_publish_dir)), 0)
isos_list = os.listdir("%s/%s" % (self.http_publish_dir, repo_group.id))
print isos_list
self.assertEqual(len(isos_list), 1)
# make sure the iso name defaults to repoid
self.assertTrue( isos_list[0].startswith("test-isos"))
示例8: test_iso_export_by_date_range
# 需要导入模块: from pulp.plugins.model import Unit [as 别名]
# 或者: from pulp.plugins.model.Unit import storage_path [as 别名]
def test_iso_export_by_date_range(self):
feed_url = "file://%s/test_errata_local_sync/" % self.data_dir
repo = mock.Mock(spec=Repository)
repo.working_dir = self.repo_working_dir
repo.id = "test_errata_local_sync"
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)
metadata = {'updated' : '2010-03-30 08:07:30'}
existing_units = []
unit_key_a = {'id' : '','name' :'patb', 'version' :'0.1', 'release' : '2', 'epoch':'0', 'arch' : 'x86_64', 'checksumtype' : 'sha',
'checksum': '017c12050a97cf6095892498750c2a39d2bf535e'}
rpm_unit_a = Unit(TYPE_ID_RPM, unit_key_a, metadata, '')
rpm_unit_a.storage_path = "%s/patb/0.1/2/noarch/017c12050a97cf6095892498750c2a39d2bf535e/patb-0.1-2.noarch.rpm" % self.pkg_dir
existing_units.append(rpm_unit_a)
unit_key_b = {'id' : '', 'name' :'emoticons', 'version' :'0.1', 'release' :'2', 'epoch':'0','arch' : 'x86_64', 'checksumtype' :'sha',
'checksum' : '663c89b0d29bfd5479d8736b716d50eed9495dbb'}
rpm_unit_b = Unit(TYPE_ID_RPM, unit_key_b, metadata, '')
rpm_unit_b.storage_path = "%s/emoticons/0.1/2/noarch/663c89b0d29bfd5479d8736b716d50eed9495dbb/emoticons-0.1-2.noarch.rpm" % self.pkg_dir
existing_units.append(rpm_unit_b)
sync_conduit = importer_mocks.get_sync_conduit(type_id=TYPE_ID_RPM, existing_units=existing_units, pkg_dir=self.pkg_dir)
importerErrata = errata.ImporterErrata()
status, summary, details = importerErrata.sync(repo, sync_conduit, config)
unit_key = dict()
unit_key['id'] = "RHEA-2010:9999"
mdata = { 'description' : "test",
'from_str': '[email protected]',
'issued': '2010-03-30 08:07:30',
'pkglist': [{'name': 'RHEL Virtualization (v. 5 for 32-bit x86)',
'packages': [{'arch': 'x86_64',
'epoch': '0',
'filename': 'patb-0.1-2.x86_64.rpm',
'name': 'patb',
'release': '2',
'src': '',
'sum': ('sha',
'017c12050a97cf6095892498750c2a39d2bf535e'),
'version': '0.1'},
{'arch': 'x86_64',
'epoch': '0',
'filename': 'emoticons-0.1-2.x86_64.rpm',
'name': 'emoticons',
'release': '2',
'src': '',
'sum': ('sha',
'663c89b0d29bfd5479d8736b716d50eed9495dbb'),
'version': '0.1'}],
'short': 'rhel-i386-server-vt-5'}],
'pushcount': 1,
'reboot_suggested': False,
'references': [],
'release': '',
'rights': '',
'status': 'final',
'summary': '',
'title': 'emoticons enhancement fix and enhancement update',
'updated': '2010-03-30 08:07:30',
'version': '1',
'type' : 'enhancement',
'severity' : 'Low',
'solution' : ''}
unit_key_2 = dict()
unit_key_2['id'] = "RHEA-2008:9999"
mdata_2 = { 'description' : "test",
'from_str': '[email protected]',
'issued': '2008-03-30 00:00:00',
'pkglist': [{'name': 'RHEL Virtualization (v. 5 for 32-bit x86)',
'packages': [{'arch': 'x86_64',
'epoch': '0',
'filename': 'patb-0.1-2.x86_64.rpm',
'name': 'patb',
'release': '2',
'src': '',
'sum': ('sha',
'017c12050a97cf6095892498750c2a39d2bf535e'),
'version': '0.1'},
{'arch': 'x86_64',
'epoch': '0',
'filename': 'emoticons-0.1-2.x86_64.rpm',
'name': 'emoticons',
'release': '2',
'src': '',
'sum': ('sha',
'663c89b0d29bfd5479d8736b716d50eed9495dbb'),
'version': '0.1'}],
'short': 'rhel-i386-server-vt-5'}],
'pushcount': 1,
'reboot_suggested': False,
'references': [],
'release': '',
'rights': '',
'status': 'final',
'summary': '',
'title': 'emoticons enhancement fix and enhancement update',
'updated': '2008-03-30 00:00:00',
'version': '1',
'type' : 'enhancement',
'severity' : 'Low',
#.........这里部分代码省略.........
示例9: test_iso_export_by_date_range
# 需要导入模块: from pulp.plugins.model import Unit [as 别名]
# 或者: from pulp.plugins.model.Unit import storage_path [as 别名]
def test_iso_export_by_date_range(self):
feed_url = "file://%s/test_errata_local_sync/" % self.data_dir
repo = mock.Mock(spec=Repository)
repo.working_dir = self.repo_working_dir
repo.id = "test_errata_local_sync"
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)
metadata = {}
existing_units = []
unit_key_a = {
"id": "",
"name": "patb",
"version": "0.1",
"release": "2",
"epoch": "0",
"arch": "x86_64",
"checksumtype": "sha",
"checksum": "017c12050a97cf6095892498750c2a39d2bf535e",
}
rpm_unit_a = Unit(TYPE_ID_RPM, unit_key_a, metadata, "")
rpm_unit_a.storage_path = (
"%s/patb/0.1/2/noarch/017c12050a97cf6095892498750c2a39d2bf535e/patb-0.1-2.noarch.rpm" % self.pkg_dir
)
existing_units.append(rpm_unit_a)
unit_key_b = {
"id": "",
"name": "emoticons",
"version": "0.1",
"release": "2",
"epoch": "0",
"arch": "x86_64",
"checksumtype": "sha",
"checksum": "663c89b0d29bfd5479d8736b716d50eed9495dbb",
}
rpm_unit_b = Unit(TYPE_ID_RPM, unit_key_b, metadata, "")
rpm_unit_b.storage_path = (
"%s/emoticons/0.1/2/noarch/663c89b0d29bfd5479d8736b716d50eed9495dbb/emoticons-0.1-2.noarch.rpm"
% self.pkg_dir
)
existing_units.append(rpm_unit_b)
sync_conduit = importer_mocks.get_sync_conduit(
type_id=TYPE_ID_RPM, existing_units=existing_units, pkg_dir=self.pkg_dir
)
importerErrata = errata.ImporterErrata()
status, summary, details = importerErrata.sync(repo, sync_conduit, config)
unit_key = dict()
unit_key["id"] = "RHEA-2010:9999"
mdata = {
"description": "test",
"from_str": "[email protected]",
"issued": "2010-03-30 08:07:30",
"pkglist": [
{
"name": "RHEL Virtualization (v. 5 for 32-bit x86)",
"packages": [
{
"arch": "x86_64",
"epoch": "0",
"filename": "patb-0.1-2.x86_64.rpm",
"name": "patb",
"release": "2",
"src": "",
"sum": ("sha", "017c12050a97cf6095892498750c2a39d2bf535e"),
"version": "0.1",
},
{
"arch": "x86_64",
"epoch": "0",
"filename": "emoticons-0.1-2.x86_64.rpm",
"name": "emoticons",
"release": "2",
"src": "",
"sum": ("sha", "663c89b0d29bfd5479d8736b716d50eed9495dbb"),
"version": "0.1",
},
],
"short": "rhel-i386-server-vt-5",
}
],
"pushcount": 1,
"reboot_suggested": False,
"references": [],
"release": "",
"rights": "",
"status": "final",
"summary": "",
"title": "emoticons enhancement fix and enhancement update",
"updated": "2010-03-30 08:07:30",
"version": "1",
"type": "enhancement",
"severity": "Low",
"solution": "",
}
unit_key_2 = dict()
unit_key_2["id"] = "RHEA-2008:9999"
mdata_2 = {
"description": "test",
#.........这里部分代码省略.........