Modification d'un ihs supervisé ou monitoré.

    Nous allons expliquer le script pas à pas.


  1. Signature du script placé en commentaire.
  2. #=============================
    # Version  1.1 
    # Created by : TURLAN Franck
    # Society : ARECIBO
    # Email : franckturlan@yahoo.com
    #=============================== 
    

  3. Import du module des expressions régulières.
  4. import re
    

  5. Import pour l'operating system. ex. permet de récupèrer le path
  6. import os
    

  7. Permet d'utiliser des librairies java.
  8. import java.util
    

  9. Définition de la fonction regexp.
  10. Les variables pattern et string doivent être données lors de l'appel de la fonction.
    La valeure pattern correspond par exemple à "ihsSourcePath" (ex: /apps/IBMHTTPServer/WebServer61 ).
    La valeure string correspond par exemple à "webServerProps.get(webServerKey)" (ex: /apps/IBMHTTPServer/WebServer61 ).
    La valeure flags est positionné à 0 et ne doit pas être passée en argument lors de l'appel de la fonction.
    Cette option est utilisée pour permettre divers usages spéciaux et variations de syntaxe.
    Le re.compile est une méthode du module re qui permet de compiler la valeur de la chaine de caractère.
    Autrement dit de pouvoir manipuler la chaine de caractère avec le jython.
    Puis nous cherchons la chaine de caractère "string" avec la méthode search dans la chaine pattern.
    Si nous la trouvons nous retournons 0, si nous la trouvons pas nous retournons 1.
    def regexp(pattern, string, flags=0):
    
        if(re.compile(pattern, flags).search(string)==None): return 0
        else: return 1
    
    #endDef
    
    On pourrait aussi écrit cette synthaxe de la manière suivante :
    def regexp(pattern, string, flags=0):
    
    variable_compile = re.compile(pattern,flags)
    while variable_compile.search(string) is None:
    	return 0
    else: 
    	return 1
    
    #endDef
    

  11. Définition de la fonction regsub.
  12. L'appel de la fonction se fait comme suit regsub(ihsSourcePath, webServerProps.get(webServerKey), ihsDestinationPath, 0, 0).
    La variable pattern correspond au chemin source (ex : ihsSourcePath soit /apps/IBMHTTPServer/WebServer61).
    La variable string .... webServerProps.get(webServerKey) .... .
    La variable replacement correspond au chemin destination (ex : ihsDestinationPath soit /apps/IBMHTTPServer/WebServer8i2).
    Le re.compile vient du module re importé plus haut le compile permet de prendre la valeur da la variable pattern pour quelle soit traité.
    Puis nous remplaçons cette valeur au moyen de la méthode sub du module re par la valeur replacement.
    Et nous retournons le tout à l'appel de la fonction.
    def regsub(pattern, string, replacement, flags=0, count=1):
    
        return re.compile(pattern, flags).sub(replacement, string, count)
    
    #endDef
    

  13. Définition de la fonction modificationIHServer.
  14. Les valeurs pluginProps, webServerProps et processProps deviennent des HashMap au sens java.
    Puis nous allons executer les commandes pas à pas pour comprendre les premières lignes de la fonction.
    wsadmin>webserver =AdminConfig.getid("/Node:arecibo/Server:httpTest/")
    wsadmin>print webserver
    httpTest(cells/areciboNetwork/nodes/arecibo/servers/httpTest|server.xml#Server_1372768795891)
    wsadmin>webservercomponent = AdminConfig.showAttribute(webserver,"components")
    wsadmin>print webservercomponent
    [httpTest(cells/areciboNetwork/nodes/arecibo/servers/httpTest|server.xml#WebServer_1372768795893)]
    wsadmin>webservercomponent = webservercomponent[1:len(webservercomponent)-1]
    wsadmin>print webservercomponent
    httpTest(cells/areciboNetwork/nodes/arecibo/servers/httpTest|server.xml#WebServer_1372768795893)
    wsadmin>webserverInstallRoot =  AdminConfig.showAttribute(webservercomponent,"webserverInstallRoot")
    wsadmin>logFilenameAccess =  AdminConfig.showAttribute(webservercomponent,"logFilenameAccess")
    wsadmin>logFilenameError  =  AdminConfig.showAttribute(webservercomponent,"logFilenameError")
    wsadmin>plugprop = AdminConfig.showAttribute(webservercomponent,"pluginProperties")
    wsadmin>plugprop = plugprop[1:len(plugprop)-1]
    wsadmin>print webserverInstallRoot
    /apps/IBMHTTPServer/WebServer8
    wsadmin>print logFilenameAccess
    ${WEB_INSTALL_ROOT}/logs/access_log
    wsadmin>print logFilenameError
    ${WEB_INSTALL_ROOT}/logs/error_log
    wsadmin>print plugprop
    (cells/parva3017451Network/nodes/parva3017451/servers/httpTestBP2i|server.xml#PluginProperties_1372768795893)
    wsadmin>
    wsadmin>processDef =AdminConfig.showAttribute(webserver,"processDefinitions")
    wsadmin>processDef = processDef[1:len(processDef)-1]
    wsadmin>startCommandArgs =  AdminConfig.showAttribute(processDef,"startCommandArgs")
    wsadmin>stopCommandArgs =  AdminConfig.showAttribute(processDef,"stopCommandArgs")
    wsadmin>print startCommandArgs
    -k start;-f;${WEB_INSTALL_ROOT}/conf/httpd.conf
    wsadmin>print stopCommandArgs
    -k stop;-f;${WEB_INSTALL_ROOT}/conf/httpd.conf
    wsadmin>
    wsadmin>flags=0
    wsadmin>variable_compile=re.compile(stopCommandArgs,flags)
    wsadmin>string="conf"
    wsadmin>while variable_compile.search(string) is None:
    wsadmin>    print variable_compile.search(string)
    None
    wsadmin>
    
    def modificationIHServer():
    
        pluginProps = java.util.HashMap()
        webServerProps = java.util.HashMap()
        processProps = java.util.HashMap()
        # Verification si le serveur web  existe deja
        server = AdminConfig.getid("/Node:"+node+"/Server:"+NomDeIHS)
        if (len(server) < 1):
           print "Le serveur web "+ NomDeIHS + " du node " + node + " n 'existe pas !."
           return 1
        #endIf
    
    
        #modification des proprietees du plug-in
        webserver =AdminConfig.getid("/Node:"+node+"/Server:"+NomDeIHS+"/")
        webservercomponent = AdminConfig.showAttribute(webserver,"components")
        #suppression du 1er caractere et du dernier caractere "[" et  "]"
        webservercomponent = webservercomponent[1:len(webservercomponent)-1]
    
        webserverInstallRoot =  AdminConfig.showAttribute(webservercomponent,"webserverInstallRoot")
        if (len(webserverInstallRoot) != 0):
            webServerProps.put("webserverInstallRoot",webserverInstallRoot)
    
        configurationFilename =  AdminConfig.showAttribute(webservercomponent,"configurationFilename")
        if (len(configurationFilename) != 0):
            webServerProps.put("configurationFilename",configurationFilename)
        logFilenameAccess =  AdminConfig.showAttribute(webservercomponent,"logFilenameAccess")
        if (len(logFilenameAccess) != 0):
            webServerProps.put("logFilenameAccess",logFilenameAccess)
        logFilenameError  =  AdminConfig.showAttribute(webservercomponent,"logFilenameError")
        if (len(logFilenameError) != 0):
            webServerProps.put("logFilenameError",logFilenameError)
    
        plugprop = AdminConfig.showAttribute(webservercomponent,"pluginProperties")
        plugprop = plugprop[1:len(plugprop)-1]
    
        LogFilename =  AdminConfig.showAttribute(plugprop,"LogFilename")
        if (len(LogFilename) != 0):
            pluginProps.put("LogFilename",LogFilename)
        PluginInstallRoot = AdminConfig.showAttribute(plugprop,"PluginInstallRoot")
        if (len(PluginInstallRoot) != 0):
            pluginProps.put("PluginInstallRoot",PluginInstallRoot)
        RemoteConfigFilename =  AdminConfig.showAttribute(plugprop,"RemoteConfigFilename")
        if (len(RemoteConfigFilename) != 0):
            pluginProps.put("RemoteConfigFilename",RemoteConfigFilename)
        RemoteKeyRingFilename =  AdminConfig.showAttribute(plugprop,"RemoteKeyRingFilename")
        if (len(RemoteKeyRingFilename) != 0):
            pluginProps.put("RemoteKeyRingFilename",RemoteKeyRingFilename)
    
        processDef =AdminConfig.showAttribute(webserver,"processDefinitions")
        processDef = processDef[1:len(processDef)-1]
        startCommandArgs =  AdminConfig.showAttribute(processDef,"startCommandArgs")
        stopCommandArgs =  AdminConfig.showAttribute(processDef,"stopCommandArgs")
    
        for webServerKey in webServerProps.keySet():
            if (regexp(ihsSourcePath, webServerProps.get(webServerKey))):
                webServerProps.put(webServerKey,regsub(ihsSourcePath, webServerProps.get(webServerKey), ihsDestinationPath, 0, 0))
            if (regexp(pluginSourcePath, webServerProps.get(webServerKey))):
                webServerProps.put(webServerKey,regsub(pluginSourcePath, webServerProps.get(webServerKey), pluginDestinationPath, 0, 0))
    
        for pluginKey in pluginProps.keySet():
            if (regexp(ihsSourcePath, pluginProps.get(pluginKey))):
                pluginProps.put(pluginKey,regsub(ihsSourcePath, pluginProps.get(pluginKey), ihsDestinationPath, 0, 0))
            if (regexp(pluginSourcePath, pluginProps.get(pluginKey))):
                pluginProps.put(pluginKey,regsub(pluginSourcePath, pluginProps.get(pluginKey), pluginDestinationPath, 0, 0))
        for processKey in processProps.keySet():
            if (regexp(ihsSourcePath, processProps.get(processKey))):
                processProps.put(processKey,regsub(ihsSourcePath,  processProps.get(processKey), ihsDestinationPath, 0, 0))
            if (regexp(pluginSourcePath, processProps.get(processKey))):
                processProps.put(processKey,regsub(pluginSourcePath, processProps.get(processKey), pluginDestinationPath, 0, 0))
        for webServerKey in webServerProps.keySet():
            print "AdminConfig Modify : " +webServerKey +"  ===> "+webServerProps.get(webServerKey)
            AdminConfig.modify(webservercomponent,[[webServerKey,webServerProps.get(webServerKey)]])
    
        for pluginKey in pluginProps.keySet():
            print "AdminConfig Modify : " +pluginKey +"  ===> "+pluginProps.get(pluginKey)
            AdminConfig.modify(plugprop,[[pluginKey,pluginProps.get(pluginKey)]])
    
        for processKey in processProps.keySet():
            print "AdminConfig Modify : " +processKey +"  ===> "+processKey.get(processKey)
            AdminConfig.modify(plugprop,[[processDef.get(processKey)]])
        if (configurationFilename != webServerProps.get("configurationFilename")):
            print "Copie du fichier : " +configurationFilename +" vers "+webServerProps.get("configurationFilename")
            httpdDir = os.path.basedir(webServerProps.get("configurationFilename"))
            if not os.path.exists(httpdDir):
                os.makedirs(httpdDir)
        print  "Sauvegarde de la configuration"
        AdminConfig.save()
    

  15. Définition de la fonction setWasVariables.
  16. def setWasVariables ( varname, varval ):
          #varDesc_attr = ["description", vardesc]
            varName_attr = ["symbolicName", varname]
            varVal_attr = ["value", varval]
            varAttrs = [varName_attr, varVal_attr]
            cellName = AdminConfig.showAttribute(AdminConfig.list("Cell"),"name")
            variableSubstitutionEntries = AdminConfig.list('VariableSubstitutionEntry',AdminConfig.getid("/Cell:"+cellName+"/Node:"+no
    de+"/Server:"+NomDeIHS+"/"))
            variableSubstitutionEntries = wsadminToList(variableSubstitutionEntries)
            for variableSubstitutionEntry in variableSubstitutionEntries:
                    varName1 = AdminConfig.showAttribute(variableSubstitutionEntry, "symbolicName" )
                    if (cmp(varName1, varname) == 0):
                            print "---> Variable entry "+varName1+" exists. Modifying variable entry to "+varval+" ......"
                            var1 = AdminConfig.modify(variableSubstitutionEntry, varAttrs )
                            print "     Modified!"
                            break
                    #endIf
            #endFor
            print  "Sauvegarde de la configuration"
            AdminConfig.save()
    

  17. Définition de la fonction wsadminToList.
  18. def wsadminToList(inStr):
        outList=[]
        if (len(inStr)>0 and inStr[0]=='[' and inStr[-1]==']'):
            inStr = inStr[1:-1]
            tmpList = inStr.split(" ")
        else:
            tmpList = inStr.split("\n") #splits for Windows or Linux
        for item in tmpList:
            item = item.rstrip();       #removes any Windows "\r"
            if (len(item)>0):
               outList.append(item)
        return outList
    #endDef
    

  19. Définition de la fonction SynchronisationNoeud.
  20. def SynchronisationNoeud():
    
        print  "Synchronisaton du node " + node
        objname = "type=NodeSync,node=" + node + ",*"
        Syncl = AdminControl.completeObjectName(objname)
        if Syncl != "":
         AdminControl.invoke(Syncl, 'sync')
         print  "Synchronisation done for node " + node
        else:
          print  "Skipping node " + node
    
    #endDef
    

  21. Main du programme.
  22. if len(sys.argv) != 6 :
        print "ce script attend 6 parametres  :  NODE_NAME WEBSERVER_NAME  WEBSERVER_SRC_PATH WEBSERVER_DEST_PATH PLUGIN_SRC_PATH PLUG
    IN_DEST_PATH"
        print ""
        print "e.g.: migrationIHS.py arecibo https-test_appli /apps/IBMHTTPServer/WebServer61 /apps/IBMHTTPServer/WebServer8 /app
    s/WebSphere/WebPlugins61i6 /apps/WebSphere/WebPlugins8i2 "
    
    else:
    
        node = sys.argv[0]
        NomDeIHS = sys.argv[1]
        ihsSourcePath = sys.argv[2]
        ihsDestinationPath = sys.argv[3]
        pluginSourcePath = sys.argv[4]
        pluginDestinationPath =sys.argv[5]
        modificationIHServer()
        setWasVariables("WEB_INSTALL_ROOT",ihsDestinationPath)
        SynchronisationNoeud()
    
    
    

  23. Execution du script.
  24. was8@arecibo:/apps/tmpInstall/WASManager/src/JYTHON$  /apps/WebSphere/profiles8/dmgr/bin/wsadmin.sh -lang jython -f migrationIHS.py
    WASX7209I: Connected to process "dmgr" on node areciboManager using SOAP connector;  The type of process is: DeploymentManager
    ce script attend 6 parametres  :  NODE_NAME WEBSERVER_NAME  WEBSERVER_SRC_PATH WEBSERVER_DEST_PATH PLUGIN_SRC_PATH PLUGIN_DEST_PATH
    
    e.g.: migrationIHS.py arecibo https-test_appli /apps/IBMHTTPServer/WebServer61 /apps/IBMHTTPServer/WebServer8 /apps/WebSphere/WebPlugins61i6 /apps/WebSphere/WebPlugins8i2
    
    was8@arecibo:/apps/tmpInstall/WASManager/src/JYTHON$
    was8@arecibo:/apps/tmpInstall/WASManager/src/JYTHON$ /apps/WebSphere/profiles8/dmgr/bin/wsadmin.sh -lang jython -f migrationIHS.py arecibo httpTest /usr/IBM/HTTPServer /apps/IBMHTTPServer/WebServer8 /usr/IBM/HTTPServer/Plugins /apps/WebSphere/WebPlugins8 
    WASX7209I: Connected to process "dmgr" on node areciboManager using SOAP connector;  The type of process is: DeploymentManager
    WASX7303I: The following options are passed to the scripting environment and are available as arguments that are stored in the argv variable: "[arecibo, httpTest, /usr/IBM/HTTPServer, /apps/IBMHTTPServer/WebServer8, /usr/IBM/HTTPServer/Plugins, /apps/WebSphere/WebPlugins8]"
    AdminConfig Modify : webserverInstallRoot  ===> /apps/IBMHTTPServer/WebServer8
    AdminConfig Modify : logFilenameError  ===> ${WEB_INSTALL_ROOT}/logs/error_log
    AdminConfig Modify : configurationFilename  ===> ${WEB_INSTALL_ROOT}/conf/httpd.conf
    AdminConfig Modify : logFilenameAccess  ===> ${WEB_INSTALL_ROOT}/logs/access_log
    AdminConfig Modify : RemoteKeyRingFilename  ===> /apps/IBMHTTPServer/WebServer8/Plugins/config/httpTest/plugin-key.kdb
    AdminConfig Modify : PluginInstallRoot  ===> /apps/IBMHTTPServer/WebServer8/Plugins
    AdminConfig Modify : LogFilename  ===> /apps/IBMHTTPServer/WebServer8/Plugins/logs/httpTest/http_plugin.log
    AdminConfig Modify : RemoteConfigFilename  ===> /apps/IBMHTTPServer/WebServer8/Plugins/config/httpTest/plugin-cfg.xml
    Sauvegarde de la configuration
    ---> Variable entry WEB_INSTALL_ROOT exists. Modifying variable entry to /apps/IBMHTTPServer/WebServer8 ......
         Modified!
    Sauvegarde de la configuration
    Synchronisaton du node arecibo
    Synchronisation done for node arecibo
    was8@arecibo:/apps/tmpInstall/WASManager/src/JYTHON$
    

  25. Script jython complet.
  26. #=============================
    # Version  1.1 
    # Created by : TURLAN Franck
    # Society : ARECIBO
    # Email : franckturlan@yahoo.com
    #=============================== 
    ## import du module des expressions régulière.
    import re
    
    ## import pour l'operating system. ex. permet de récupèrer le path
    import os
    
    ## permet d'utiliser des librairies java
    import java.util
    
    
    ## definition de la fonction regexp les variables pattern et string doivent être donnée
    ## lors de l'appel de la fonction, la valeur flags est positionné à 0
    def regexp(pattern, string, flags=0):
    
        if(re.compile(pattern, flags).search(string)==None): return 0
        else: return 1
    
    #endDef
    
    
    def regsub(pattern, string, replacement, flags=0, count=1):
    
        return re.compile(pattern, flags).sub(replacement, string, count)
    
    #endDef
    
    def modificationIHServer():
    
        pluginProps = java.util.HashMap()
        webServerProps = java.util.HashMap()
        processProps = java.util.HashMap()
        # Verification si le serveur web  existe deja
        server = AdminConfig.getid("/Node:"+node+"/Server:"+NomDeIHS)
        if (len(server) < 1):
           print "Le serveur web "+ NomDeIHS + " du node " + node + " n 'existe pas !."
           return 1
        #endIf
    
    
        #modification des proprietees du plug-in
        webserver =AdminConfig.getid("/Node:"+node+"/Server:"+NomDeIHS+"/")
        webservercomponent = AdminConfig.showAttribute(webserver,"components")
        #suppression du 1er caractere et du dernier caractere "[" et  "]"
        webservercomponent = webservercomponent[1:len(webservercomponent)-1]
    
        webserverInstallRoot =  AdminConfig.showAttribute(webservercomponent,"webserverInstallRoot")
        if (len(webserverInstallRoot) != 0):
            webServerProps.put("webserverInstallRoot",webserverInstallRoot)
    
        configurationFilename =  AdminConfig.showAttribute(webservercomponent,"configurationFilename")
        if (len(configurationFilename) != 0):
            webServerProps.put("configurationFilename",configurationFilename)
        logFilenameAccess =  AdminConfig.showAttribute(webservercomponent,"logFilenameAccess")
        if (len(logFilenameAccess) != 0):
            webServerProps.put("logFilenameAccess",logFilenameAccess)
        logFilenameError  =  AdminConfig.showAttribute(webservercomponent,"logFilenameError")
        if (len(logFilenameError) != 0):
            webServerProps.put("logFilenameError",logFilenameError)
    
        plugprop = AdminConfig.showAttribute(webservercomponent,"pluginProperties")
        plugprop = plugprop[1:len(plugprop)-1]
    
        LogFilename =  AdminConfig.showAttribute(plugprop,"LogFilename")
        if (len(LogFilename) != 0):
            pluginProps.put("LogFilename",LogFilename)
        PluginInstallRoot = AdminConfig.showAttribute(plugprop,"PluginInstallRoot")
        if (len(PluginInstallRoot) != 0):
            pluginProps.put("PluginInstallRoot",PluginInstallRoot)
        RemoteConfigFilename =  AdminConfig.showAttribute(plugprop,"RemoteConfigFilename")
        if (len(RemoteConfigFilename) != 0):
            pluginProps.put("RemoteConfigFilename",RemoteConfigFilename)
        RemoteKeyRingFilename =  AdminConfig.showAttribute(plugprop,"RemoteKeyRingFilename")
        if (len(RemoteKeyRingFilename) != 0):
            pluginProps.put("RemoteKeyRingFilename",RemoteKeyRingFilename)
    
        processDef =AdminConfig.showAttribute(webserver,"processDefinitions")
        processDef = processDef[1:len(processDef)-1]
        startCommandArgs =  AdminConfig.showAttribute(processDef,"startCommandArgs")
        stopCommandArgs =  AdminConfig.showAttribute(processDef,"stopCommandArgs")
    
        for webServerKey in webServerProps.keySet():
            if (regexp(ihsSourcePath, webServerProps.get(webServerKey))):
                webServerProps.put(webServerKey,regsub(ihsSourcePath, webServerProps.get(webServerKey), ihsDestinationPath, 0, 0))
            if (regexp(pluginSourcePath, webServerProps.get(webServerKey))):
                webServerProps.put(webServerKey,regsub(pluginSourcePath, webServerProps.get(webServerKey), pluginDestinationPath, 0, 0))
    
        for pluginKey in pluginProps.keySet():
            if (regexp(ihsSourcePath, pluginProps.get(pluginKey))):
                pluginProps.put(pluginKey,regsub(ihsSourcePath, pluginProps.get(pluginKey), ihsDestinationPath, 0, 0))
            if (regexp(pluginSourcePath, pluginProps.get(pluginKey))):
                pluginProps.put(pluginKey,regsub(pluginSourcePath, pluginProps.get(pluginKey), pluginDestinationPath, 0, 0))
        for processKey in processProps.keySet():
            if (regexp(ihsSourcePath, processProps.get(processKey))):
                processProps.put(processKey,regsub(ihsSourcePath,  processProps.get(processKey), ihsDestinationPath, 0, 0))
            if (regexp(pluginSourcePath, processProps.get(processKey))):
                processProps.put(processKey,regsub(pluginSourcePath, processProps.get(processKey), pluginDestinationPath, 0, 0))
        for webServerKey in webServerProps.keySet():
            print "AdminConfig Modify : " +webServerKey +"  ===> "+webServerProps.get(webServerKey)
            AdminConfig.modify(webservercomponent,[[webServerKey,webServerProps.get(webServerKey)]])
    
        for pluginKey in pluginProps.keySet():
            print "AdminConfig Modify : " +pluginKey +"  ===> "+pluginProps.get(pluginKey)
            AdminConfig.modify(plugprop,[[pluginKey,pluginProps.get(pluginKey)]])
    
        for processKey in processProps.keySet():
            print "AdminConfig Modify : " +processKey +"  ===> "+processKey.get(processKey)
            AdminConfig.modify(plugprop,[[processDef.get(processKey)]])
        if (configurationFilename != webServerProps.get("configurationFilename")):
            print "Copie du fichier : " +configurationFilename +" vers "+webServerProps.get("configurationFilename")
            httpdDir = os.path.basedir(webServerProps.get("configurationFilename"))
            if not os.path.exists(httpdDir):
                os.makedirs(httpdDir)
        print  "Sauvegarde de la configuration"
        AdminConfig.save()
    
    
    def setWasVariables ( varname, varval ):
          #varDesc_attr = ["description", vardesc]
            varName_attr = ["symbolicName", varname]
            varVal_attr = ["value", varval]
            varAttrs = [varName_attr, varVal_attr]
            cellName = AdminConfig.showAttribute(AdminConfig.list("Cell"),"name")
            variableSubstitutionEntries = AdminConfig.list('VariableSubstitutionEntry',AdminConfig.getid("/Cell:"+cellName+"/Node:"+no
    de+"/Server:"+NomDeIHS+"/"))
            variableSubstitutionEntries = wsadminToList(variableSubstitutionEntries)
            for variableSubstitutionEntry in variableSubstitutionEntries:
                    varName1 = AdminConfig.showAttribute(variableSubstitutionEntry, "symbolicName" )
                    if (cmp(varName1, varname) == 0):
                            print "---> Variable entry "+varName1+" exists. Modifying variable entry to "+varval+" ......"
                            var1 = AdminConfig.modify(variableSubstitutionEntry, varAttrs )
                            print "     Modified!"
                            break
                    #endIf
            #endFor
            print  "Sauvegarde de la configuration"
            AdminConfig.save()
    
    def wsadminToList(inStr):
        outList=[]
        if (len(inStr)>0 and inStr[0]=='[' and inStr[-1]==']'):
            inStr = inStr[1:-1]
            tmpList = inStr.split(" ")
        else:
            tmpList = inStr.split("\n") #splits for Windows or Linux
        for item in tmpList:
            item = item.rstrip();       #removes any Windows "\r"
            if (len(item)>0):
               outList.append(item)
        return outList
    #endDef
    
    
    
    def SynchronisationNoeud():
    
        print  "Synchronisaton du node " + node
        objname = "type=NodeSync,node=" + node + ",*"
        Syncl = AdminControl.completeObjectName(objname)
        if Syncl != "":
         AdminControl.invoke(Syncl, 'sync')
         print  "Synchronisation done for node " + node
        else:
          print  "Skipping node " + node
    
    #endDef
    
    
    
    
    if len(sys.argv) != 6 :
        print "ce script attend 6 parametres  :  NODE_NAME WEBSERVER_NAME  WEBSERVER_SRC_PATH WEBSERVER_DEST_PATH PLUGIN_SRC_PATH PLUG
    IN_DEST_PATH"
        print ""
        print "e.g.: migrationIHS.py arecibo https-test_appli /apps/IBMHTTPServer/WebServer61 /apps/IBMHTTPServer/WebServer8 /apps/WebSphere/WebPlugins61i6 /apps/WebSphere/WebPlugins8i2 "
    
    else:
    
        node = sys.argv[0]
        NomDeIHS = sys.argv[1]
        ihsSourcePath = sys.argv[2]
        ihsDestinationPath = sys.argv[3]
        pluginSourcePath = sys.argv[4]
        pluginDestinationPath =sys.argv[5]
        modificationIHServer()
        setWasVariables("WEB_INSTALL_ROOT",ihsDestinationPath)
        SynchronisationNoeud()