diff -ur install_scripts.orig/deployMultipleTomcats.py install_scripts/deployMultipleTomcats.py --- install_scripts.orig/deployMultipleTomcats.py 2022-12-06 08:47:21.000000000 +0900 +++ install_scripts/deployMultipleTomcats.py 2024-08-20 16:09:45.323779000 +0900 @@ -38,24 +38,25 @@ import sys import os import xml.dom.minidom -import urlparse +#import urlparse +from urllib.parse import urlparse import shutil def deployMultipleTomcats(destFolder): tomcatHome = os.getenv("TOMCAT_HOME") if tomcatHome == None: - print "We determine the source Tomcat distribution using the environment variable TOMCAT_HOME which does not seem to be set." + print("We determine the source Tomcat distribution using the environment variable TOMCAT_HOME which does not seem to be set.") sys.exit(1) thisAppliance = os.getenv("ARCHAPPL_MYIDENTITY") if thisAppliance == None: - print "We determine the identity of this appliance using the environment variable ARCHAPPL_MYIDENTITY which does not seem to be set." + print("We determine the identity of this appliance using the environment variable ARCHAPPL_MYIDENTITY which does not seem to be set.") sys.exit(1) appliancesXML = os.getenv("ARCHAPPL_APPLIANCES") if appliancesXML == None: - print "We determine the location of the appliances.xml file using the environment variable ARCHAPPL_APPLIANCES which does not seem to be set." + print("We determine the location of the appliances.xml file using the environment variable ARCHAPPL_APPLIANCES which does not seem to be set.") sys.exit(1) - print "Using\n\ttomcat installation at", tomcatHome, "\n\tto generate deployments for appliance", thisAppliance, "\n\tusing configuration info from", appliancesXML, "\n\tinto folder", destFolder + print("Using\n\ttomcat installation at", tomcatHome, "\n\tto generate deployments for appliance", thisAppliance, "\n\tusing configuration info from", appliancesXML, "\n\tinto folder", destFolder) # Parse the tomcat/conf/server.xml file and determine the stop start port # We start incrementing and use this port+1 for each of the new webapps @@ -63,10 +64,10 @@ serverdom = xml.dom.minidom.parse(tomcatServerConfSrc); serverStopStartPort = serverdom.getElementsByTagName('Server').item(0).getAttribute('port') if int(serverStopStartPort) == 8005: - print "The start/stop port is the standard Tomcat start/stop port. Changing it to something else random - 16000" + print("The start/stop port is the standard Tomcat start/stop port. Changing it to something else random - 16000") serverStopStartPort='16000' newServerStopStartPort = int(serverStopStartPort)+1 - print 'The stop/start ports for the new instance will being at ', newServerStopStartPort + print('The stop/start ports for the new instance will being at ', newServerStopStartPort) # Parse the appliances.xml and determine the ports for the HTTP listeners appliancesXMLDOM = xml.dom.minidom.parse(appliancesXML) @@ -81,18 +82,19 @@ engineUrl = appliance.getElementsByTagName('engine_url').item(0).firstChild.data etlUrl = appliance.getElementsByTagName('etl_url').item(0).firstChild.data retrievalUrl = appliance.getElementsByTagName('retrieval_url').item(0).firstChild.data - httplistenerports['mgmt'] = urlparse.urlparse(mgmtUrl).port - httplistenerports['engine'] = urlparse.urlparse(engineUrl).port - httplistenerports['etl'] = urlparse.urlparse(etlUrl).port - httplistenerports['retrieval'] = urlparse.urlparse(retrievalUrl).port + + httplistenerports['mgmt'] = urlparse(mgmtUrl).port + httplistenerports['engine'] = urlparse(engineUrl).port + httplistenerports['etl'] = urlparse(etlUrl).port + httplistenerports['retrieval'] = urlparse(retrievalUrl).port for app in ['mgmt', 'engine', 'etl', 'retrieval']: # Delete any existing subfolders if any and make new ones. subFolder = destFolder + '/' + app if os.access(subFolder, os.W_OK): - print "Removing ", subFolder + print("Removing ", subFolder) shutil.rmtree(subFolder) - print "Generating tomcat folder for ", app, " in location", subFolder + print("Generating tomcat folder for ", app, " in location", subFolder) os.makedirs(subFolder) # See http://kief.com/running-multiple-tomcat-instances-on-one-server.html for the steps we are using here. shutil.copytree(tomcatHome + '/conf', subFolder + '/conf') @@ -111,7 +113,7 @@ httplistenerNode.setAttribute('port', str(httplistenerports[app])) haveSetConnector = True else: - print "Commenting connector with protocol ", httplistenerNode.getAttribute('protocol'), ". If you do need this connector, you should un-comment this." + print("Commenting connector with protocol ", httplistenerNode.getAttribute('protocol'), ". If you do need this connector, you should un-comment this.") comment = httplistenerNode.ownerDocument.createComment(httplistenerNode.toxml()) httplistenerNode.parentNode.replaceChild(comment, httplistenerNode) if haveSetConnector == False: @@ -124,7 +126,7 @@ if __name__ == "__main__": if len(sys.argv) < 2: - print "Usage: ", sys.argv[0], "" + print("Usage: ", sys.argv[0], "") sys.exit(1) deployMultipleTomcats(sys.argv[1])