def _migrate_rpm_unit_changelog_files(): """ Looks up rpm unit collection in the db and computes the changelog and filelist data if not already available; If the package path is missing, the fields are defaulted to empty list. """ query_manager = ContentQueryManager() collection = query_manager.get_content_unit_collection(type_id="rpm") ts = rpmUtils.transaction.initReadOnlyTransaction() for rpm_unit in collection.find(): pkg_path = rpm_unit['_storage_path'] if not os.path.exists(pkg_path): # if pkg doesnt exist, we cant get the pkg object, continue continue po = yumbased.CreateRepoPackage(ts, pkg_path) for key in ["changelog", "filelist", "files"]: if key not in rpm_unit or not rpm_unit[key]: if key == "changelog": data = map(lambda x: __encode_changelog(x), po[key]) else: data = getattr(po, key) rpm_unit[key] = data _log.debug("missing pkg: %s ; key %s" % (rpm_unit, key)) collection.save(rpm_unit, safe=True) _log.info("Migrated rpms to include rpm changelog and filelist metadata")
def migrate(*args, **kwargs): """ Looks up rpm unit collection in the db and computes the changelog and filelist data if not already available; If the package path is missing, the fields are defaulted to empty list. """ query_manager = ContentQueryManager() collection = query_manager.get_content_unit_collection(type_id="rpm") ts = rpmUtils.transaction.initReadOnlyTransaction() for rpm_unit in collection.find(): _migrate_unit(rpm_unit, ts, collection) _LOGGER.info("Migrated rpms to include rpm changelog and filelist metadata")
def migrate(*args, **kwargs): """ for each puppet module, calculate a checksum for the source file on the filesystem """ query_manager = ContentQueryManager() collection = query_manager.get_content_unit_collection(type_id=constants.TYPE_PUPPET_MODULE) for puppet_unit in collection.find(): storage_path = puppet_unit['_storage_path'] checksum = metadata.calculate_checksum(storage_path) puppet_unit['checksum'] = checksum puppet_unit['checksum_type'] = constants.DEFAULT_HASHLIB collection.save(puppet_unit) _log.info("Migrated puppet modules to include checksum")
def _migrate_rpm_unit_repodata(): """ Looks up rpm unit collection in the db and computes the repodata if not already available; If the package path is missing, the repodata if stored as an empty dict. """ query_manager = ContentQueryManager() collection = query_manager.get_content_unit_collection(type_id="rpm") for rpm_unit in collection.find(): if "repodata" not in rpm_unit or not rpm_unit["repodata"]: # if repodata is not in the schema or repodata is empty rpm_unit["repodata"] = metadata.get_package_xml(rpm_unit['_storage_path']) collection.save(rpm_unit, safe=True) _log.info("Migrated rpms to include rpm metadata")
def migrate(*args, **kwargs): """ Looks up rpm unit collection in the db and computes the changelog and filelist data if not already available; If the package path is missing, the fields are defaulted to empty list. """ query_manager = ContentQueryManager() collection = query_manager.get_content_unit_collection(type_id="rpm") ts = rpmUtils.transaction.initReadOnlyTransaction() for rpm_unit in collection.find(): _migrate_unit(rpm_unit, ts, collection) _LOGGER.info( "Migrated rpms to include rpm changelog and filelist metadata")
def _migrate_rpm_unit_repodata(): """ Looks up rpm unit collection in the db and computes the repodata if nto already available; If the package path is missing, the repodata if stored as an empty dict. """ query_manager = ContentQueryManager() collection = query_manager.get_content_unit_collection(type_id="rpm") for rpm_unit in collection.find(): modified = False if "repodata" not in rpm_unit: rpm_unit["repodata"] = get_package_xml(rpm_unit['_storage_path']) modified = True if modified: collection.save(rpm_unit, safe=True)
def _migrate_rpm_unit_repodata(): """ Looks up rpm unit collection in the db and computes the repodata if nto already available; If the package path is missing, the repodata if stored as an empty dict. """ query_manager = ContentQueryManager() collection = query_manager.get_content_unit_collection(type_id="rpm") for rpm_unit in collection.find(): modified = False if "repodata" not in rpm_unit: rpm_unit["repodata"] = get_package_xml(rpm_unit['_storage_path']) modified = True if modified: collection.save(rpm_unit)
def _migrate_rpm_unit_repodata(): """ Looks up rpm unit collection in the db and computes the repodata if not already available; If the package path is missing, the repodata if stored as an empty dict. """ query_manager = ContentQueryManager() collection = query_manager.get_content_unit_collection(type_id="rpm") for rpm_unit in collection.find(): if "repodata" not in rpm_unit or not rpm_unit["repodata"]: # if repodata is not in the schema or repodata is empty rpm_unit["repodata"] = metadata.get_package_xml( rpm_unit['_storage_path']) collection.save(rpm_unit, safe=True) _log.info("Migrated rpms to include rpm metadata")
def migrate(*args, **kwargs): """ For each puppet module, calculate a checksum for the source file on the filesystem. """ query_manager = ContentQueryManager() collection = query_manager.get_content_unit_collection( type_id=constants.TYPE_PUPPET_MODULE) for puppet_unit in collection.find(): storage_path = puppet_unit['_storage_path'] checksum = metadata.calculate_checksum(storage_path) puppet_unit['checksum'] = checksum puppet_unit['checksum_type'] = constants.DEFAULT_HASHLIB collection.save(puppet_unit) _log.info("Migrated puppet modules to include checksum")
def test_get_content_unit_collection(self): manager = ContentQueryManager() collection = manager.get_content_unit_collection('deb') self.assertTrue(isinstance(collection, PulpCollection)) self.assertEqual(collection.name, 'units_deb')
def test_get_content_unit_collection(self): manager = ContentQueryManager() collection = manager.get_content_unit_collection('deb') self.assertTrue(isinstance(collection, PulpCollection)) self.assertEqual(collection.name, 'units_deb')