epics/Archiver Appliance インストールメモ: install_scripts_python3.patch

File install_scripts_python3.patch, 5.6 KB (added by shuei, 2 months ago)
  • deployMultipleTomcats.py

    diff -ur install_scripts.orig/deployMultipleTomcats.py install_scripts/deployMultipleTomcats.py
    old new  
    3838import sys 
    3939import os 
    4040import xml.dom.minidom 
    41 import urlparse 
     41#import urlparse 
     42from urllib.parse import urlparse 
    4243import shutil 
    4344 
    4445def deployMultipleTomcats(destFolder): 
    4546    tomcatHome = os.getenv("TOMCAT_HOME") 
    4647    if tomcatHome == None: 
    47         print "We determine the source Tomcat distribution using the environment variable TOMCAT_HOME which does not seem to be set." 
     48        print("We determine the source Tomcat distribution using the environment variable TOMCAT_HOME which does not seem to be set.") 
    4849        sys.exit(1) 
    4950    thisAppliance = os.getenv("ARCHAPPL_MYIDENTITY") 
    5051    if thisAppliance == None: 
    51         print "We determine the identity of this appliance using the environment variable ARCHAPPL_MYIDENTITY which does not seem to be set." 
     52        print("We determine the identity of this appliance using the environment variable ARCHAPPL_MYIDENTITY which does not seem to be set.") 
    5253        sys.exit(1) 
    5354    appliancesXML = os.getenv("ARCHAPPL_APPLIANCES") 
    5455    if appliancesXML == None: 
    55         print "We determine the location of the appliances.xml file using the environment variable ARCHAPPL_APPLIANCES which does not seem to be set." 
     56        print("We determine the location of the appliances.xml file using the environment variable ARCHAPPL_APPLIANCES which does not seem to be set.") 
    5657        sys.exit(1) 
    5758 
    58     print "Using\n\ttomcat installation at", tomcatHome, "\n\tto generate deployments for appliance", thisAppliance, "\n\tusing configuration info from", appliancesXML, "\n\tinto folder", destFolder 
     59    print("Using\n\ttomcat installation at", tomcatHome, "\n\tto generate deployments for appliance", thisAppliance, "\n\tusing configuration info from", appliancesXML, "\n\tinto folder", destFolder) 
    5960     
    6061    # Parse the tomcat/conf/server.xml file and determine the stop start port 
    6162    # We start incrementing and use this port+1 for each of the new webapps 
     
    6364    serverdom = xml.dom.minidom.parse(tomcatServerConfSrc); 
    6465    serverStopStartPort = serverdom.getElementsByTagName('Server').item(0).getAttribute('port') 
    6566    if int(serverStopStartPort) == 8005: 
    66         print "The start/stop port is the standard Tomcat start/stop port. Changing it to something else random - 16000" 
     67        print("The start/stop port is the standard Tomcat start/stop port. Changing it to something else random - 16000") 
    6768        serverStopStartPort='16000' 
    6869    newServerStopStartPort = int(serverStopStartPort)+1 
    69     print 'The stop/start ports for the new instance will being at ', newServerStopStartPort 
     70    print('The stop/start ports for the new instance will being at ', newServerStopStartPort) 
    7071     
    7172    # Parse the appliances.xml and determine the ports for the HTTP listeners 
    7273    appliancesXMLDOM =  xml.dom.minidom.parse(appliancesXML) 
     
    8182        engineUrl = appliance.getElementsByTagName('engine_url').item(0).firstChild.data 
    8283        etlUrl = appliance.getElementsByTagName('etl_url').item(0).firstChild.data 
    8384        retrievalUrl = appliance.getElementsByTagName('retrieval_url').item(0).firstChild.data 
    84         httplistenerports['mgmt'] = urlparse.urlparse(mgmtUrl).port 
    85         httplistenerports['engine'] = urlparse.urlparse(engineUrl).port 
    86         httplistenerports['etl'] = urlparse.urlparse(etlUrl).port 
    87         httplistenerports['retrieval'] = urlparse.urlparse(retrievalUrl).port 
     85 
     86        httplistenerports['mgmt'] = urlparse(mgmtUrl).port 
     87        httplistenerports['engine'] = urlparse(engineUrl).port 
     88        httplistenerports['etl'] = urlparse(etlUrl).port 
     89        httplistenerports['retrieval'] = urlparse(retrievalUrl).port 
    8890         
    8991        for app in ['mgmt', 'engine', 'etl', 'retrieval']: 
    9092            # Delete any existing subfolders if any and make new ones. 
    9193            subFolder = destFolder + '/' + app 
    9294            if os.access(subFolder, os.W_OK): 
    93                 print "Removing ", subFolder 
     95                print("Removing ", subFolder) 
    9496                shutil.rmtree(subFolder) 
    95             print "Generating tomcat folder for ", app, " in location", subFolder 
     97            print("Generating tomcat folder for ", app, " in location", subFolder) 
    9698            os.makedirs(subFolder) 
    9799            # See http://kief.com/running-multiple-tomcat-instances-on-one-server.html for the steps we are using here. 
    98100            shutil.copytree(tomcatHome + '/conf', subFolder + '/conf') 
     
    111113                    httplistenerNode.setAttribute('port', str(httplistenerports[app])) 
    112114                    haveSetConnector = True 
    113115                else: 
    114                     print "Commenting connector with protocol ", httplistenerNode.getAttribute('protocol'), ". If you do need this connector, you should un-comment this." 
     116                    print("Commenting connector with protocol ", httplistenerNode.getAttribute('protocol'), ". If you do need this connector, you should un-comment this.") 
    115117                    comment = httplistenerNode.ownerDocument.createComment(httplistenerNode.toxml()) 
    116118                    httplistenerNode.parentNode.replaceChild(comment, httplistenerNode) 
    117119                if haveSetConnector == False: 
     
    124126 
    125127if __name__ == "__main__": 
    126128    if len(sys.argv) < 2: 
    127         print "Usage: ", sys.argv[0], "<DeploymentFolder>" 
     129        print("Usage: ", sys.argv[0], "<DeploymentFolder>") 
    128130        sys.exit(1) 
    129131    deployMultipleTomcats(sys.argv[1]) 
    130132