Exemple #1
0
#!/usr/bin/python
import sys
import os.path
import yum
from yum import config

_LIBPATH = "/usr/share/rhn"
# add to the path if need be
if _LIBPATH not in sys.path:
    sys.path.append(_LIBPATH)

from server.rhnLib import get_package_path
from common import CFG, initCFG



initCFG('server.satellite')


get_package_pathh(nevra, org_id, prepend=CFG.PREPENDED_DIR,
            source=source, md5sum=md5sum)




#!/usr/bin/python
import sys
from xmlrpclib import Server

sys.path.append('/usr/share/rhn')
try:
   from common import initCFG, CFG
except:
   print "Couldn't load needed libs, Are you sure you are running this on a satellite?"
   sys.exit(1)

initCFG()
user = '******'
passw = CFG.SESSION_SECRET_1

c = Server('http://localhost/rpc/api')
print("Satellite auth.checkAuthToken (should be 1): ")
print( c.auth.checkAuthToken(user, passw))

print("Trying cobbler login (should be a random token): ")
c = Server('http://localhost/cobbler_api')
print(c.login(user, passw))