[Spacewalk-list] Export all RPMs from channel
Schindler, Daniel (STEAG Energy Services GmbH)
Daniel.Schindler at steag.com
Thu Mar 19 11:01:37 UTC 2015
Thanks Matthew.
I added some missing statements to the script.
Looks like this now:
#!/usr/bin/python
import xmlrpclib
import os
import sys
import subprocess
SATELLITE_URL = "h /rpc/api"
SATELLITE_LOGIN = "username"
SATELLITE_PASSWORD = "password"
channel = "channel"
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:
package_id = package['id']
url = client.packages.getPackageUrl(key, package_id)
print url
client.auth.logout(key)
Von: spacewalk-list-bounces at redhat.com [mailto:spacewalk-list-bounces at redhat.com] Im Auftrag von Matthew Madey
Gesendet: Montag, 16. März 2015 16:51
An: spacewalk-list at redhat.com
Betreff: Re: [Spacewalk-list] Export all RPMs from channel
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<mailto: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<tel:%2B44%20131%20560%201466>
From: spacewalk-list-bounces at redhat.com<mailto:spacewalk-list-bounces at redhat.com> [mailto: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<mailto: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<mailto: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/20150319/e7c04b7c/attachment.htm>
More information about the Spacewalk-list
mailing list