[Spacewalk-list] Export all RPMs from channel

Matthew Madey mattmadey at gmail.com
Mon Mar 16 15:51:28 UTC 2015


I've created an API script to do just this. Update the SATELLITE_URL,
LOGIN, PASSWORD, and channel variables for your environment.

softwarechannel_listpackages.py

##BEGIN SCRIPT##

#!/usr/bin/python

import xmlrpclib
import os
import sys
import subprocess

SATELLITE_URL = "http://spacewalk.example.com/rpc/api"
SATELLITE_LOGIN = "username"
SATELLITE_PASSWORD = "password"

channel = "rhel-x86_64-server-5-rhn-tools"

client = xmlrpclib.Server(SATELLITE_URL, verbose=0)

key = client.auth.login(SATELLITE_LOGIN, SATELLITE_PASSWORD)

packages = client.channel.software.listAllPackages(key, channel)
for package in packages:
#   print package['id']
        package_id = package['id']
        url = client.packages.getPackageUrl(key, package_id)
        print url


client.auth.logout(key)

##END SCRIPT##

Then use it to dump the download locations for each package into a text
file like this:

python softwarechannel_listpackages.py > package_list

You can then simply locally wget each of the packages.

for x in `cat package_list` ; do wget $x ; done

Hope this helps.




On Mon, Mar 16, 2015 at 10:31 AM, Alexander Dacre <alex.dacre at aridhia.com>
wrote:

>  Hi,
>
>
>
> You could do this fairly quickly with the API.
>
>
>
> Get a list of packages in a channel via channel.software.listAllPackages
> and use the id of each returned item to call packages.getPackage.
>
>
>
> Thanks,
>
>
>
> Alex Dacre
>
> Systems Engineer
>
> +44 131 560 1466
>
>
>
> *From:* spacewalk-list-bounces at redhat.com [mailto:
> spacewalk-list-bounces at redhat.com] *On Behalf Of *Schindler, Daniel
> (STEAG Energy Services GmbH)
> *Sent:* 16 March 2015 14:36
> *To:* spacewalk-list at redhat.com
> *Subject:* [Spacewalk-list] Export all RPMs from channel
>
>
>
> Hi,
>
>
>
> is there a possibility to export all RPMs from a desired channel?
>
>
>
> We want to send update packages to our customer who has no
> network/internet access.
>
>
>
> Regards,
>
> Daniel
>
> _______________________________________________
> Spacewalk-list mailing list
> Spacewalk-list at redhat.com
> https://www.redhat.com/mailman/listinfo/spacewalk-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/spacewalk-list/attachments/20150316/9b34255e/attachment.htm>


More information about the Spacewalk-list mailing list