#!/usr/bin/python import xmlrpclib import datetime now = datetime.datetime.now() current_date = now.strftime("%m%d%Y") leading_channel_tag = "mychannel-" SATELLITE_URL = "http://somehost/rpc/api" SATELLITE_LOGIN = "foo" SATELLITE_PASSWORD ="bar" client = xmlrpclib.Server(SATELLITE_URL, verbose=0) key = client.auth.login(SATELLITE_LOGIN, SATELLITE_PASSWORD) redhat_channels = client.channel.listRedHatChannels(key) type(client) for redhat_channel in redhat_channels: channel_label = str(redhat_channel["label"]) child_channels = client.channel.software.listChildren(key, channel_label) if child_channels: parent_channel_name = leading_channel_tag + str(redhat_channel["name"]) + "-" + current_date parent_channel_label = leading_channel_tag + channel_label + "-" + current_date clone_channel_details = { 'label' : parent_channel_label, 'name' : parent_channel_name, 'summary' : parent_channel_label } if not client.configchannel.channelExists(key, clone_channel_details): print parent_channel_label + " Exists" for child_channel in child_channels: child_channel_name = leading_channel_tag + str(child_channel["name"]) + "-" + current_date child_channel_label = leading_channel_tag + str(child_channel["label"]) + "-" + current_date clone_channel_details = { 'label' : child_channel_label, 'name' : child_channel_name, 'parent_label' : parent_channel_label, 'summary' : parent_channel_label } if client.configchannel.channelExists(key, child_channel_label): print "\t" + child_channel_label + " Exists" client.auth.logout(key)