On 03/29/2010 02:19 PM, Jeremy Hansen wrote:
Is there a way to ignore gpg keys?  Most of our repos are internal and for the 
time being, I'd like to disable the key signature requirement.

Thanks
-jeremy


You could use `rhnpush --header` along with the other options you need, I think. Then you would have to get the RPMs into the correct location on the server... I would use the API and grab that info and then cp the RPM to the right path. It'll look something like:
/var/satellite/redhat/1/$md5[0:2]/$name/$version-$release/$arch/$md5/$rpm.rpm

(code, code, code)
OK, here's a python script. Note the last 4 non-comment lines in the for loop weren't tested (the ones that actually copy it over).

Run like so:

spacewalk# python rpm2path.py foo-1.0.0.rpm [... more rpms]
...
spacewalk# chown -R apache /var/satellite/redhat

Hope to help,

Josh
#!/usr/bin/python
import xmlrpclib
import getpass
import sys
import rpm
import os
import pwd

SATELLITE_URL = "http://localhost/rpc/api";
SATELLITE_LOGIN = raw_input("Username: ")
SATELLITE_PASSWORD = getpass.getpass("Password: ")

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

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

apacheuid = (pwd.getpwnam('apache'))[2]

for file in sys.argv[1:]:
	print "\nRPM: " + file
	# open rpm
	f = open(file)
	fd = f.fileno()
	# read rpm header
	ts = rpm.TransactionSet()
	hdr = ts.hdrFromFdno(fd)
	# close
	f.close()

	# find in spacewalk
	print "Looking up: %s%s-%s-%s.%s" % ((hdr['epoch'] or ''), hdr['name'], hdr['version'], hdr['release'], hdr['arch'])
	package = client.packages.findByNvrea(key, hdr['name'], hdr['version'], hdr['release'], hdr['epoch'] or '', hdr['arch'])
	for pack in package:
		print " got: ",
		print pack
	path = "/var/satellite/" + package[0]['path']
	print " path: " + path

	# make dir tree
	os.makedirs(path[0 : path.rindex('/'))
	# copy rpm
	shutil.copyfile(file, path)
	# chown/chmod
	os.chown(path, apacheuid, 0)
	os.chmod(path, 0644)

client.auth.logout(key)

print "\nrun: chown -R apache /var/satellite/redhat"
_______________________________________________
Spacewalk-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/spacewalk-list

Reply via email to