
filePtr = open(fileName, 'r')
ksName = os.path.basename(fileName).split('.')[0]
if len(ksName) < 6:
today = datetime.date.today()
ksName = ksName + '_' + today.strftime("%m%d")
#open channel
client = xmlrpclib.Server(SATELLITE_URL, verbose=0)
#log into infrastructure org
key = client.auth.login(INFRA_LOGIN, INFRA_PASSWD)
client.kickstart.importFile(key, ksName, VIRT, KSTREE, filePtr.read())
#log out from infrastructure channel
client.auth.logout(key)
if __name__ == "__main__":
sys.exit(main())
iii) assocKeyKS_infra.py – Associate an activation key with an existing kickstart
#!/usr/bin/python
"""
This script will attempt to associate the passed activation key to the kickstart
related to the label that was passed. the org is determined by the login global variable below
"""
import xmlrpclib
import sys
SATELLITE_URL = "http://sat-vm.cloud.lab.eng.bos.redhat.com/rpc/api"
INFRA_LOGIN = "infra"
INFRA_PASSWD = "24^gold"
def main():
if len(sys.argv) < 3:
print "Usage: ",sys.argv[0]," activationKey kickstart"
sys.exit(-2);
# retreieve the passed parameter
AKName = sys.argv[1]
KSName = sys.argv[2].split(':')[0]
67 www.redhat.com
Komentáře k této Příručce