def spacewalk_sync(options): """ Performs the data capture, translation and checkin to katello """ _LOG.info("Started capturing system data from spacewalk") client = SpacewalkClient(CONFIG.get('spacewalk', 'host'), CONFIG.get('spacewalk', 'ssh_key_path')) katello_client = KatelloConnection() consumers = [] _LOG.info("retrieving data from spacewalk") sw_user_list = client.get_user_list() system_details = client.get_system_list() channel_details = client.get_channel_list() hosts_guests = client.get_host_guest_list() update_system_channel(system_details, channel_details) org_list = client.get_org_list() update_owners(katello_client, org_list) update_users(katello_client, sw_user_list) update_roles(katello_client, sw_user_list) katello_consumer_list = katello_client.getConsumers() delete_stale_consumers(katello_client, katello_consumer_list, system_details) _LOG.info("adding installed products to %s spacewalk records" % len(system_details)) # enrich with engineering product IDs clone_mapping = [] map(lambda details : details.update({'installed_products' : \ get_product_ids(details['software_channel'])}), system_details) # convert the system details to katello consumers consumers.extend(transform_to_consumers(system_details)) _LOG.info("found %s systems to upload into katello" % len(consumers)) _LOG.info("uploading to katello...") upload_to_katello(consumers, katello_client) _LOG.info("upload completed")#. updating with guest info..")
def get_katello_consumers(): katello_conn = KatelloConnection() return katello_conn.getConsumers()