def link_channel_packages(batch, strict=1): importer = packageImport.ChannelPackageSubscription(batch, diskImportLib.get_backend(), caller="satsync.linkPackagesToChannels", strict=strict) importer.run() importer.status() return importer
def main(): rhnSQL.initDB() channel = {'label': 'mibanescu-test2'} orgid = 1198839 package_template = { 'name': 'useless', 'version': '1.0.0', 'arch': 'noarch', 'org_id': orgid, } batch = [] p = importLib.IncompletePackage() p.populate(package_template) p['release'] = '2' p['channels'] = [channel] batch.append(p) p = importLib.IncompletePackage() p.populate(package_template) p['release'] = '3' p['channels'] = [channel] batch.append(p) backend = backendOracle.OracleBackend() cps = packageImport.ChannelPackageSubscription(batch, backend, caller="misa.testing", strict=1) cps.run() print(cps.affected_channel_packages)