Création d'une action RAF personnalisée.

  • I - Présentation.

  • 1.1 - Présentation.

  • +------------------------------+                                               +-----------------------------+ 
    | Serveur RAFW                 |                                               | Serveur WebSphere 8.5       | 
    | Hostname : saturn            |---(Création d'une action RAF et execution)--->| Hostname : arecibo          | 
    | Os : Linux 2.6.32            |                                               | Os : Linux                  | 
    |                              |                                               | DMGR : areciboNetwork       | 
    |                              |                                               | NODE : areciboNode          | 
    +------------------------------+                                               +-----------------------------+ 
    


  • II - Mode PREVIEW.

  • Le mode preview permet de vérifier la mise en place de l'action.

  • 2.1 - Création d'un script (shell, perl etc..).

  • Le script doit-être placé dans le répertoire ${HOME_RAF}/user/actions/configure/was/common/base/scripts
    J'ai placé un argument $1 afin de tester l'envoie d'argument dans le fichier xml.

    root@saturn:/opt/IBM/RAFServer/rafw/user/actions/configure/was/common/base/scripts# vi ftu.sh
    #! /bin/bash
    # A simple test to add a line in /etc/hosts
    
    echo "$1" >> /tmp/ftu.txt
    
    
    
    

  • 2.2 - Intégration du script shell dans le repository RAF.

  • Le script et le nom de l'action sont placé dans le fichier xml "custom_configure_was_common_base.xml"
    Le fichier est dans ${HOME_RAF}/user/actions/configure/was/common/base/
    root@saturn:/opt/IBM/RAFServer/rafw/user/actions/configure/was/common/base# vi custom_configure_was_common_base.xml
    
    <? xml version="1.0" encoding="UTF-8"?>
    
    
    
    <project default="default" basedir=".">
            <description>
                    Contains custom configuration tasks for WAS common at the node scope
            </description>
    
            <rafwaction name="user_was_common_configure_run_hosts_sh">
            </rafwaction>
    
    
            <target name="user_was_common_configure_run_hosts_sh"
                    description="Runs the hosts.sh script">
            <antcall target="execute">
                    <param name="EXECUTABLE" value="${RAFW_HOME}/user/actions/configure/was/common/base/scripts/hosts.sh" />
                    <param name="ARGS" value="${ipAddress_serveur}" />
            </antcall>
            </target>
    
            <rafwaction name="user_was_common_configure_run_ftu_sh">
            </rafwaction>
    
    
            <target name="user_was_common_configure_run_ftu_sh"
                    description="Runs the ftu.sh script">
            <antcall target="execute">
                    <param name="EXECUTABLE" value="${RAFW_HOME}/user/actions/configure/was/common/base/scripts/ftu.sh" />
                    <param name="ARGS" value="blabladansfichier" />
            </antcall>
            </target>
    </project>
    
    


  • 2.3 - L'option preview permet de tester la commande sans l'executer.

  • ./rafw.sh -e arecibo -c areciboNetwork -n areciboNode -preview -t user_was_common_configure_run_ftu_sh

    root@saturn:/opt/IBM/RAFServer/rafw/user/actions/configure/was/common/base# /opt/IBM/RAFServer/rafw/bin/rafw.sh -e arecibo -c areciboNetwork -n areciboNode -preview -t user_was_common_configure_run_ftu_sh
    CRWFW0026I A new run with the following ID 02RS is starting at Sep 23, 2013 16:45:56 CEST
    Rational Automation Framework version 3.0.0.5 build 20121029-1616
    Including the following modules:
         WebSphere Liberty Profile version 8.5.0.0
         Midvision Extension Module version 1.0.0.1
    
    CRWFW0104I Using the values defined for the properties OS_USER and OS_PASSWORD for the user 'was80'
    defined in the file user/environments/arecibo/cells/areciboNetwork/configure.properties
    CRWFW0103I Using the following value for OS_GROUP 'web' defined in the file
     user/environments/arecibo/cells/areciboNetwork/configure.properties
    CRWFW0015I A network connection has been made to 'arecibo'
    CRWFW0013I A list of files that are already on the target system is being created.
    CRWFW0066I 3 files are being transferred.
    CRWFW0017I The following files are being transferred:
       user/actions/configure/was/common/base/custom_configure_was_common_base.xml.ftu
       user/actions/configure/was/common/base/custom_configure_was_common_base.xml
       user/environments/arecibo/cells/areciboNetwork/nodes/areciboNode/server.xml
    
    CRWFW0057I The following chmod script is being created: /opt/IBM/RAFServer/rafw/work/02RS_chmod.sh
    ..
    CRWFW0046I The following chmod script is being transferred to the target system: /apps/Rational/RAFW/work/02RS_chmod.sh
    CRWFW0047I The chmod script is running in the following remote directory: /apps/Rational/RAFW
    ..
    CRWFW0048I The following chmod script is being removed from the target system: /apps/Rational/RAFW/work/02RS_chmod.sh
    CRWFW0058I The following chmod script is being removed from the framework server: /opt/IBM/RAFServer/rafw/work/02RS_chmod.sh
    Buildfile: /apps/Rational/RAFW/user/environments/arecibo/cells/areciboNetwork/nodes/areciboNode/build.xml
    
    default:
      [rafwlog] CRWFW0001I If an error occurs, check '/apps/Rational/RAFW//logs/arecibo/cells/areciboNetwork/nodes/areciboNode/user_was_common_configure_run_ftu_sh.log'
      [rafwlog] CRWFW0014I Beginning action user_was_common_configure_run_ftu_sh on host arecibo
         [echo] Apache Ant version 1.7.0 compiled on December 13 2006
         [echo] Beginning user_was_common_configure_run_ftu_sh in trace only mode.
    
    user_was_common_configure_run_ftu_sh:
    
    prepare_shell:
    
    execute:
         [echo] Working Dir: .
         [echo] /apps/Rational/RAFW/user/actions/configure/was/common/base/scripts/ftu.sh ${ARGS}
         [echo] Finished user_was_common_configure_run_ftu_sh in trace only mode.
    
    prepare_shell:
    
    change_directory_ownership:
    
    prepare_shell:
    
    change_directory_ownership:
    
    prepare_shell:
    
    change_directory_ownership:
    [querychangedfiles] CRWFW6009I Computing list of files modified during action execution for scope arecibo/cells/areciboNetwork
    
    BUILD SUCCESSFUL
    Total time: 2 seconds
    CRWFW0059I The following file is being transferred from the target system to the framework server: logs/arecibo/cells/areciboNetwork/nodes/areciboNode/user_was_common_configure_run_ftu_sh.trace
    CRWFW0059I The following file is being transferred from the target system to the framework server: logs/arecibo/cells/areciboNetwork/nodes/areciboNode/user_was_common_configure_run_ftu_sh.log
    CRWFW7070I Disconnected from 'arecibo'
    root@saturn:/opt/IBM/RAFServer/rafw/user/actions/configure/was/common/base#
    
    
    


  • III - Lancement de la commande (sans l'option preview).


  • 3.1 - Execution de la commande.

  • ./rafw.sh -e arecibo -c areciboNetwork -n areciboNode -t user_was_common_configure_run_ftu_sh

    root@saturn:/opt/IBM/RAFServer/rafw/user/actions/configure/was/common/base# /opt/IBM/RAFServer/rafw/bin/rafw.sh -e arecibo -c areciboNetwork -n areciboNode -preview -t user_was_common_configure_run_ftu_sh
    CRWFW0026I A new run with the following ID 02RS is starting at Sep 23, 2013 16:45:56 CEST
    Rational Automation Framework version 3.0.0.5 build 20121029-1616
    Including the following modules:
         WebSphere Liberty Profile version 8.5.0.0
         Midvision Extension Module version 1.0.0.1
    
    CRWFW0104I Using the values defined for the properties OS_USER and OS_PASSWORD for the user 'was80'
    defined in the file user/environments/arecibo/cells/areciboNetwork/configure.properties
    CRWFW0103I Using the following value for OS_GROUP 'web' defined in the file
     user/environments/arecibo/cells/areciboNetwork/configure.properties
    CRWFW0015I A network connection has been made to 'arecibo'
    CRWFW0013I A list of files that are already on the target system is being created.
    CRWFW0066I 3 files are being transferred.
    CRWFW0017I The following files are being transferred:
       user/actions/configure/was/common/base/custom_configure_was_common_base.xml.ftu
       user/actions/configure/was/common/base/custom_configure_was_common_base.xml
       user/environments/arecibo/cells/areciboNetwork/nodes/areciboNode/server.xml
    
    CRWFW0057I The following chmod script is being created: /opt/IBM/RAFServer/rafw/work/02RS_chmod.sh
    ..
    CRWFW0046I The following chmod script is being transferred to the target system: /apps/Rational/RAFW/work/02RS_chmod.sh
    CRWFW0047I The chmod script is running in the following remote directory: /apps/Rational/RAFW
    ..
    CRWFW0048I The following chmod script is being removed from the target system: /apps/Rational/RAFW/work/02RS_chmod.sh
    CRWFW0058I The following chmod script is being removed from the framework server: /opt/IBM/RAFServer/rafw/work/02RS_chmod.sh
    Buildfile: /apps/Rational/RAFW/user/environments/arecibo/cells/areciboNetwork/nodes/areciboNode/build.xml
    
    default:
      [rafwlog] CRWFW0001I If an error occurs, check '/apps/Rational/RAFW//logs/arecibo/cells/areciboNetwork/nodes/areciboNode/user_was_common_configure_run_ftu_sh.log'
      [rafwlog] CRWFW0014I Beginning action user_was_common_configure_run_ftu_sh on host arecibo
         [echo] Apache Ant version 1.7.0 compiled on December 13 2006
         [echo] Beginning user_was_common_configure_run_ftu_sh in trace only mode.
    
    user_was_common_configure_run_ftu_sh:
    
    prepare_shell:
    
    execute:
         [echo] Working Dir: .
         [echo] /apps/Rational/RAFW/user/actions/configure/was/common/base/scripts/ftu.sh ${ARGS}
         [echo] Finished user_was_common_configure_run_ftu_sh in trace only mode.
    
    prepare_shell:
    
    change_directory_ownership:
    
    prepare_shell:
    
    change_directory_ownership:
    
    prepare_shell:
    
    change_directory_ownership:
    [querychangedfiles] CRWFW6009I Computing list of files modified during action execution for scope arecibo/cells/areciboNetwork
    
    BUILD SUCCESSFUL
    Total time: 2 seconds
    CRWFW0059I The following file is being transferred from the target system to the framework server: logs/arecibo/cells/areciboNetwork/nodes/areciboNode/user_was_common_configure_run_ftu_sh.trace
    CRWFW0059I The following file is being transferred from the target system to the framework server: logs/arecibo/cells/areciboNetwork/nodes/areciboNode/user_was_common_configure_run_ftu_sh.log
    CRWFW7070I Disconnected from 'arecibo'
    root@saturn:/opt/IBM/RAFServer/rafw/user/actions/configure/was/common/base#
    
    
    

  • 3.2 - Visualisation des logs.

  • root@saturn:/ # vi /opt/IBM/RAFServer/rafw/logs/arecibo/cells/areciboNetwork/nodes/areciboNode/user_was_common_configure_run_ftu_sh.log
    
      [rafwlog] CRWFW0001I If an error occurs, check '/apps/Rational/RAFW//logs/arecibo/cells/areciboNetwork/nodes/areciboNode/user_was_common_configure_run_ftu_sh.log'
      [rafwlog] CRWFW0014I Beginning action user_was_common_configure_run_ftu_sh on host arecibo
         [echo] Apache Ant version 1.7.0 compiled on December 13 2006
         [echo] Beginning user_was_common_configure_run_ftu_sh in trace only mode.
    
    user_was_common_configure_run_ftu_sh:
    
    prepare_shell:
    
    execute:
         [echo] Working Dir: .
         [echo] /apps/Rational/RAFW/user/actions/configure/was/common/base/scripts/ftu.sh ${ARGS}
         [echo] Finished user_was_common_configure_run_ftu_sh in trace only mode.
         
    
  • 3.3 - Résultat visible .

  • Le fichier ftu.txt est bien créé sur le serveur distant (dans notre cas arecibo).
    Notons que le fichier appartient à l'utilisateur "OS" (was80 )défini dans le fichier configure.properties de l'environement.

    
    root@arecibo:/tmp# ls -l /tmp/ftu.txt
    -rw-rw-r-- 1 was80 web 1 Sep 23 17:02 /tmp/ftu.txt
    root@arecibo:/tmp#
    root@arecibo:/tmp# more ftu.txt
    
    blabladansfichier
    root@arecibo:/tmp#
    
    
    


  • 3.4 - Lien de la documentation IBM.

  • Url ibm pour la commande user_was_common_configure_run_.