#!/bin/bash rte_2_env () { local rte_idx=0 local rte_name_var="RUNTIME_VALUE_${rte_idx}" while [ -n "${!rte_name_var}" ]; do # Runtime conditions is not handles in Rainbow yet rte_cond_var="RUNTIME_CONDITION_${rte_idx}" next_idx_var ENVIRONMENT_NAME_ ENVIRONMENT_VALUE_ "RUNTIME_ENVIRONMENT_${rte_idx}" "${!rte_name_var}" eval "unset RUNTIME_VALUE_${rte_idx}" eval "unset RUNTIME_CONDITION_${rte_idx}" rte_idx=$(( rte_idx + 1 )) rte_name_var="RUNTIME_VALUE_${rte_idx}" done } rainbow_wrap () { # VM image should be defined [ -z "$MDS_RAINBOW_VM" ] && echo_bad "FATAL: There is no Rainbow VM defined in configuration to wrap job" # add VM image to stage-in next_idx_var INPUT_FILES_NAME_ INPUT_FILES_LOCATION_ "${MDS_RAINBOW_VM##*/}" "${MDS_RAINBOW_VM}" next_idx_var INPUT_FILES_NAME_ INPUT_FILES_LOCATION_ "${MDS_RAINBOW_VM##*/}.description" "${MDS_RAINBOW_VM}.description" # define environment next_idx_var ENVIRONMENT_NAME_ ENVIRONMENT_VALUE_ "CLOUD_VM_SYSIMAGE" "${MDS_RAINBOW_VM##*/}" next_idx_var ENVIRONMENT_NAME_ ENVIRONMENT_VALUE_ "CLOUD_VM_DESCRIPTION" "${MDS_RAINBOW_VM##*/}.description" next_idx_var ENVIRONMENT_NAME_ ENVIRONMENT_VALUE_ "CLOUD_DATA_METHOD" "DISK" next_idx_var ENVIRONMENT_NAME_ ENVIRONMENT_VALUE_ "DATA_DISK_FS" "ext3" next_idx_var ENVIRONMENT_NAME_ ENVIRONMENT_VALUE_ "RAINBOW_JOB_WRAP" "yes" # move RTE to job Environment rte_2_env # add Rainbow RTE next_idx_var RUNTIME_CONDITION_ RUNTIME_VALUE_ "=" "CLOUD/VM" # add prefix to job name JOBNAME="rainbow_${JOBNAME}" }