Hi,

I have added proxy support to the rhn-clone-errata.py script. The proxy url and 
port are hard coded in the script so you need to substitute them before use. I 
also changed the srvRHN url, which didn't work anymore.

Best regards,

--- rhn-clone-errata.py2        2010-02-24 13:53:57.000000000 +0100
+++ rhn-clone-errata.py 2010-02-24 13:56:06.000000000 +0100
@@ -52,6 +52,7 @@
 #       function.

 import xmlrpclib
+from xmlrpclib import Transport
 from optparse import OptionParser
 from time import time, localtime, strftime
 from datetime import datetime, timedelta
@@ -59,13 +60,32 @@
 import os
 import re

+
+class ProxyTransport(Transport):
+##Handles an HTTP transaction to an XML-RPC server, through an HTTP proxy.
+       def __init__(self):
+               self.proxyHost = 'MYPROXYURL'
+               self.proxyPort = MYPROXYPORT
+       def request(self, host, handler, request_body, verbose=0):
+               return Transport.request(self, host, "http://"+host+handler, 
request_body, verbose)
+       def make_connection(self, host):
+               import httplib
+               return httplib.HTTP(self.proxyHost, self.proxyPort)
+
+
+
 class RHNServer:
-    def __init__(self,servername,user,passwd):
+    def __init__(self,servername,user,passwd,proxyon):
         self.rhnServerName = servername
         self.login = user
         self.password = passwd
+       self.proxyon = proxyon
         self.rhnUrl = 'https://'+self.rhnServerName+'/rpc/api'
-        self.server = xmlrpclib.Server(self.rhnUrl)
+        #self.rhnUrl = 'https://'+self.rhnServerName+'/XMLRPC'
+       if self.proxyon == 1:
+                       self.server = xmlrpclib.Server(self.rhnUrl, 
transport=ProxyTransport())
+        else:
+               self.server = xmlrpclib.Server(self.rhnUrl)
         self.rhnSession = self.rhnLogin(self.login,self.password,0)

     def rhnLogin(self, login, password, retry):
@@ -439,12 +459,12 @@

 #   I don't reckon this should change anytime soon...
 #
-    svrRHN = 'rhn.redhat.com'
+    svrRHN = 'xmlrpc.rhn.redhat.com'

 #   Ok, configure your RHN credentials here...
 #
-    userRHN = 'wsuadmin'
-    passRHN = 'W$youAdm'
+    userRHN = 'RHNUSER'
+    passRHN = 'RHNPASS'

 #   Here we setup our mappings from RHN to Local software channels.
 #   Set these to what you have created for your SPW.
@@ -504,8 +524,8 @@
        print "Invalid Channel!"
        sys.exit(2)

-    myRHN = RHNServer(svrRHN,userRHN,passRHN)
-    mySPW = SPWServer(options.src_server,options.login,options.passwd)
+    myRHN = RHNServer(svrRHN,userRHN,passRHN,1)
+    mySPW = SPWServer(options.src_server,options.login,options.passwd,0)

     dateStart = options.bdate or '19000101'
     dateEnd = options.edate or strftime("%Y%m%d", localtime())

________________________________

Atos Worldline SA/NV - Chaussee de Haecht 1442 Haachtsesteenweg
- 1130 Brussels - Belgium
RPM-RPR Bruxelles-Brussel - TVA-BTW BE 0418.547.872
Bankrekening-Compte Bancaire-Bank Account 310-0269424-44
BIC BBRUBEBB - IBAN BE55 3100 2694 2444

"The information contained in this e-mail and any attachment thereto is 
confidential and may contain information which is protected by intellectual 
property rights.
This information is intended for the exclusive use of the recipient(s) named 
above.
This e-mail does not constitute any binding relationship or offer toward any of 
the addressees.
If you are not one of the addressees , one of their employees or a proxy holder 
entitled to hand over this message to the addressee(s), any use of the 
information contained herein (e.g. reproduction, divulgation, communication or 
distribution,...) is prohibited.
If you have received this message in error, please notify the sender and 
destroy it immediately after.
The integrity and security of this message cannot be guaranteed and it may be 
subject to data corruption, interception and unauthorized amendment, for which 
we accept no liability."
_______________________________________________
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel

Reply via email to