예제 #1
0
 def get_test_GET_server_https(self, headers):
     global SERVER, HANDLER, PROXY
     return GETServer("https://%s%s" % (SERVER, HANDLER), headers=headers,proxy=PROXY)
예제 #2
0
except:
    pass
print "SERVER = %s" % SERVER
print "system_id_file = %s" % system_id_file

s = Server(SERVER)
sysid = open(system_id_file).read()

dict = s.up2date.login(sysid)
print dict

channels = dict['X-RHN-Auth-Channels']

channel_name, channel_version = channels[0][:2]

sg = GETServer(SERVER, headers=dict)
l = sg.listPackages(channel_name, channel_version)

print l

# Package download
package = l[0]
print "PACKAGE TO DOWNLOAD: %s %s %s %s" % (package[0], package[1], package[2],
                                            package[4])
filename = "%s-%s-%s.%s.rpm" % (package[0], package[1], package[2], package[4])
fd = sg.getPackage(channel_name, filename)
f_name = "/tmp/test-get-%s" % filename
f = open(f_name, "w+")
f.write(fd.read())
f.close()
print "PACKAGE DOWNLOADED AS: %s" % f_name
    system_id_file = sys.argv[2]
except:
    pass


def get_test_server_https():
    global SERVER, HANDLER
    return Server("https://%s%s" % (SERVER, HANDLER))


s = get_test_server_https()
sysid = open(system_id_file).read()

dict = s.up2date.login(sysid)
print dict

dict['X-RHN-Auth-Server-Time'] = 1324

channels = dict['X-RHN-Auth-Channels']
channel_name, channel_version = channels[0][:2]

sg = GETServer("http://xmlrpc.rhn.redhat.com/XMLRPC", headers=dict)
try:
    l = sg.listPackages(channel_name, channel_version)
except ProtocolError, e:
    print reportError(e.headers)
    print("OK (error above expected)")
    sys.exit(0)
print("ERROR: Exception didn't occurred!")
sys.exit(-1)
예제 #4
0
def refreshCallback(*args, **kwargs):
    print "Called refreshCallback, args %s, kwargs %s" % (args, kwargs)

def progressCallback(*args, **kwargs):
    print "Called progressCallback, args %s, kwargs %s" % (args, kwargs)

if __name__ == '__main__':
    sysid = open(system_id_file).read()

    s = Server(SERVER)
    s.set_refresh_callback(refreshCallback)
    s.set_progress_callback(progressCallback)

    dict = s.up2date.login(sysid)

    gs = GETServer(SERVER, headers=dict)
    gs.set_refresh_callback(refreshCallback)
    gs.set_progress_callback(progressCallback, 16384)

    channels = dict['X-RHN-Auth-Channels']
    cn, cv = channels[0][:2]
    
    print "Calling listPackages"
    l = gs.listPackages(cn, cv)
    for p in l:
        if p[0] == 'kernel':
            package = p
            break
    else:
        raise Exception("Package not found")
    

def progressCallback(*args, **kwargs):
    print "Called progressCallback, args %s, kwargs %s" % (args, kwargs)


if __name__ == '__main__':
    sysid = open(system_id_file).read()

    s = Server(SERVER)
    s.set_refresh_callback(refreshCallback)
    s.set_progress_callback(progressCallback)

    dict = s.up2date.login(sysid)

    gs = GETServer(SERVER, headers=dict)
    gs.set_refresh_callback(refreshCallback)
    gs.set_progress_callback(progressCallback, 16384)

    channels = dict['X-RHN-Auth-Channels']
    cn, cv = channels[0][:2]

    print "Calling listPackages"
    l = gs.listPackages(cn, cv)
    for p in l:
        if p[0] == 'kernel':
            package = p
            break
    else:
        raise Exception("Package not found")
예제 #6
0
except:
    pass
print "SERVER = %s" % SERVER
print "system_id_file = %s" % system_id_file

s = Server(SERVER)
sysid = open(system_id_file).read()

dict = s.up2date.login(sysid)
print dict

channels = dict['X-RHN-Auth-Channels']

channel_name, channel_version = channels[0][:2]

sg = GETServer(SERVER, headers=dict)
l = sg.listPackages(channel_name, channel_version)

print l

# Package download
package = l[0]
print "PACKAGE TO DOWNLOAD: %s %s %s %s" % (package[0], package[1], package[2], package[4])
filename = "%s-%s-%s.%s.rpm" % (package[0], package[1], package[2],
                package[4])
fd = sg.getPackage(channel_name, filename)
f_name = "/tmp/test-get-%s" % filename
f = open(f_name, "w+")
f.write(fd.read())
f.close()
print "PACKAGE DOWNLOADED AS: %s" % f_name
예제 #7
0
    SERVER = sys.argv[1]
    system_id_file = sys.argv[2]
except:
    pass

def get_test_server_https():
    global SERVER, HANDLER
    return Server("https://%s%s" % (SERVER, HANDLER))


s = get_test_server_https()
sysid = open(system_id_file).read()

dict = s.up2date.login(sysid)
print dict

dict['X-RHN-Auth-Server-Time'] = 1324

channels = dict['X-RHN-Auth-Channels']
channel_name, channel_version = channels[0][:2]

sg = GETServer("http://xmlrpc.rhn.redhat.com/XMLRPC", headers=dict)
try:
    l = sg.listPackages(channel_name, channel_version)
except ProtocolError, e:
    print reportError(e.headers)
    print("OK (error above expected)");
    sys.exit(0);
print("ERROR: Exception didn't occured!");
sys.exit(-1);