diff options
author | irina <irinagomez@us.es> | 2014-03-05 13:47:40 +0000 |
---|---|---|
committer | irina <irinagomez@us.es> | 2014-03-05 13:47:40 +0000 |
commit | 1e3a1e2a53a319c78d6ff66c45143a9f128d85aa (patch) | |
tree | 883d03da9ffdd36fb11dc44e4a04c422d27a124b | |
parent | 01cf0ab79573790f7a635234c87949f004611088 (diff) |
#565 #637 correccion erratas de mensajes de error
git-svn-id: https://opengnsys.es/svn/branches/version1.0@4176 a21b9725-9963-47de-94b9-378ad31fedc9
-rwxr-xr-x | client/engine/Rsync.lib | 26 | ||||
-rwxr-xr-x | client/shared/scripts/createBaseImage | 2 | ||||
-rwxr-xr-x | client/shared/scripts/deployImage | 6 | ||||
-rwxr-xr-x | client/shared/scripts/restoreBaseImage | 4 | ||||
-rwxr-xr-x | client/shared/scripts/restoreDiffImage | 4 | ||||
-rwxr-xr-x | client/shared/scripts/updateCache | 13 |
6 files changed, 26 insertions, 29 deletions
diff --git a/client/engine/Rsync.lib b/client/engine/Rsync.lib index 375f0462..ba8edcc0 100755 --- a/client/engine/Rsync.lib +++ b/client/engine/Rsync.lib @@ -216,7 +216,7 @@ fi ogUnmount $1 $2 if [ $FSTYPE == "NTFS" ]; then echo " ntfs-3g.secaudit -b $PART /" |tee -a $OGLOGSESSION $OGLOGFILE - ntfs-3g.secaudit -b $PART / > $IMGACL 2>$OGLOGCOMMAND + ntfs-3g.secaudit -b $PART / > $IMGACL fi @@ -511,11 +511,16 @@ fi DIRMOUNT="$(ogGetMountImageDir "$2" ${IMGEXT#*\.})" -if [ "$1" == "CACHE" -o "$1" == "cache" ]; then +if [ "$1" == "REPO" -o "$1" == "repo" ]; then + [ -z $REPOIP ] && REPOIP=$(ogGetRepoIp) + hose $REPOIP 2009 --out sh -c "echo -ne MOUNT_IMAGE \"$2\" ${IMGEXT#*\.}" + echo "$OGIMG/$DIRMOUNT" +else # Si está montado nada que hacer. df | grep "$DIRMOUNT$" 2>&1 >/dev/null && echo "/tmp/$DIRMOUNT" && return 0 - IMGFILE="$(ogGetPath "$1" /"$2.$IMGEXT")" + IMGFILE="$(ogGetPath "$1" /"$2.$IMGEXT")" \ + || return $(ogRaiseError $OG_ERR_NOTFOUND "$1 $2.$IMGEXT"; echo $?) mkdir -p "/tmp/$DIRMOUNT" # FS de la imagen segun la version del kernel: < 3.7 ext4, si >= btrfs @@ -528,12 +533,6 @@ if [ "$1" == "CACHE" -o "$1" == "cache" ]; then # Comprobamos que se ha montado bien [ $? -eq 0 ] || return $(ogRaiseError $OG_ERR_DONTMOUNT_IMAGE "$1 $2 $3"; echo $?) echo "/tmp/$DIRMOUNT" - -else - [ -z $REPOIP ] && REPOIP=$(ogGetRepoIp) - hose $REPOIP 2009 --out sh -c "echo -ne MOUNT_IMAGE \"$2\" ${IMGEXT#*\.}" - echo "$OGIMG/$DIRMOUNT" - fi } @@ -634,8 +633,8 @@ if [ "$*" == "help" ]; then fi if [ $# -lt 2 ]; then - ogRaiseError $OG_ERR_FORMAT "$MSG_FORMAT: $FUNCNAME [ REPO | CACHE ] image_name extension [ image_size ] " 2>&1 | tee -a $OGLOGSESSION $OGLOGFILE - return ${PIPESTATUS[0]} + ogRaiseError $OG_ERR_FORMAT "$MSG_FORMAT: $FUNCNAME [ REPO | CACHE ] image_name extension [ image_size ] " + return $? fi SIZE=${4:-"300000"} @@ -653,8 +652,7 @@ let TIMEOUT=$SIZE/$CREATESPEED [ $TIMEOUT -lt 60 ] && TIMEOUT=60 until [ -f "$DIRMOUNT/ogimg.info" ] ; do TIMEAUX=$[SECONDS-TIME] - [ "$TIMEAUX" -lt "$TIMEOUT" ] || ogRaiseError $OG_ERR_DONTMOUNT_IMAGE "$3 $4 $IMGEXT" 2>&1 | tee -a $OGLOGSESSION $OGLOGFILE - [ ${PIPESTATUS[0]} -eq 0 ] || return ${PIPESTATUS[0]} + [ "$TIMEAUX" -lt "$TIMEOUT" ] || return $(ogRaiseError $OG_ERR_DONTMOUNT_IMAGE "$3 $4 $IMGEXT"; echo $?) echo -n "#" | tee -a $OGLOGSESSION $OGLOGFILE sleep 5 done @@ -813,7 +811,7 @@ fi IMGDIR="$(ogGetParentPath "$1" "/$2")" IMGFILE="${IMGDIR}/$(basename "/$2").$IMGEXT" -ogIsSyncImage $1 "$2" "${IMGEXT#*\.}" || ogRaiseError $OG_ERR_DONTSYNC_IMAGE "$3 $4" || return $? +ogIsSyncImage $1 "$2" "${IMGEXT#*\.}" || return $(ogRaiseError $OG_ERR_DONTSYNC_IMAGE "$3 $4"; echo $?) DIRMOUNT="/tmp/ogCheckImage$$" mkdir "$DIRMOUNT" diff --git a/client/shared/scripts/createBaseImage b/client/shared/scripts/createBaseImage index a0499c56..7d4a7ed2 100755 --- a/client/shared/scripts/createBaseImage +++ b/client/shared/scripts/createBaseImage @@ -145,7 +145,7 @@ TIMEAUX3=$[SECONDS-TIME2] echo " $MSG_SCRIPTS_TASK_END, $MSG_SCRIPTS_TIME_PARTIAL : $[TIMEAUX3/60]m $[TIMEAUX3%60]s" | tee -a $OGLOGSESSION $OGLOGFILE # Esperamos que el servidor termine de crear y montar la imagen -ogWaitMountImage "$3" "$4" $IMGEXT $SIZEREQUIRED +ogWaitMountImage "$3" "$4" $IMGEXT $SIZEREQUIRED || exit $(ogRaiseError $OG_ERR_DONTMOUNT_IMAGE "$3 $4 $IMGEXT: time_out."; echo $?) # Sincronizamos los datos de la particion con la imagen. echo "[70] $MSG_HELP_ogSyncCreate." | tee -a $OGLOGSESSION $OGLOGFILE diff --git a/client/shared/scripts/deployImage b/client/shared/scripts/deployImage index 7c3030a0..ca986206 100755 --- a/client/shared/scripts/deployImage +++ b/client/shared/scripts/deployImage @@ -143,17 +143,17 @@ case "$NEXTOPERATION" in CACHE) echo "[55] $MSG_HELP_ogRestoreImage : restoreImage CACHE $IMGNAME $DISK $PART UNICAST" | tee -a $OGLOGSESSION $OGLOGFILE restoreImage CACHE "$IMGNAME" "$DISK" "$PART" - RETVAL=$0 + RETVAL=$? ;; UNICAST) echo "[55] $MSG_HELP_ogRestoreImage : restoreImage REPO $IMGNAME $DISK $PART UNICAST" | tee -a $OGLOGSESSION $OGLOGFILE restoreImage REPO "$IMGNAME" "$DISK" "$PART" - RETVAL=$0 + RETVAL=$? ;; MULTICAST) echo "[55] $MSG_HELP_ogRestoreImage : restoreImage REPO $IMGNAME $DISK $PART $PROTO $PROTOOPT" | tee -a $OGLOGSESSION $OGLOGFILE restoreImage REPO "$IMGNAME" "$DISK" "$PART" $PROTO $PROTOOPT - RETVAL=$0 + RETVAL=$? ;; esac RESUMERESTOREIMAGE=$(grep -m 1 "Total Time:" $OGLOGCOMMAND) diff --git a/client/shared/scripts/restoreBaseImage b/client/shared/scripts/restoreBaseImage index 7e463c26..3baac9c1 100755 --- a/client/shared/scripts/restoreBaseImage +++ b/client/shared/scripts/restoreBaseImage @@ -90,7 +90,7 @@ if [ "$1" == "CACHE" -o "$1" == "cache" ]; then echo "[10] $MSG_SCRIPTS_TASK_START updateCache REPO $2.$IMGEXT $PROTO $6" | tee -a $OGLOGFILE $OGLOGSESSION echo " updateCache REPO" "/$2.$IMGEXT" "$PROTO" "$6" | tee -a $OGLOGFILE $OGLOGSESSION updateCache REPO "/$2.$IMGEXT" "$PROTO" "$6" - RETVAL=$0 + RETVAL=$? if [ "$RETVAL" != "0" ] then echo "[39] $MSG_SCRIPTS_TASK_END updateCache REPO $2.$IMGEXT $5 $6 con error $RETVAL" | tee -a $OGLOGFILE $OGLOGSESSION @@ -133,7 +133,7 @@ ogRestoreInfoImage $3 $4 # Si a este script lo ha llamado el script restoreDiffImage no post-configuramos if [ "$(ogGetCaller)" != "restoreDiffImage" ];then echo "[90] $MSG_HELP_configureOs" |tee -a $OGLOGFILE $OGLOGSESSION - configureOs $3 $4 2>&1 |tee -a $OGLOGCOMMAND + configureOs $3 $4 fi TIME=$[SECONDS-TIME1] diff --git a/client/shared/scripts/restoreDiffImage b/client/shared/scripts/restoreDiffImage index b79c8465..157fe9a5 100755 --- a/client/shared/scripts/restoreDiffImage +++ b/client/shared/scripts/restoreDiffImage @@ -82,7 +82,7 @@ if [ "$1" == "CACHE" -o "$1" == "cache" ]; then echo "[10] $MSG_HELP_updateCache." | tee -a $OGLOGFILE $OGLOGSESSION echo " updateCache REPO" "/$3.$DIFFEXT" "$PROTO" "$7" | tee -a $OGLOGFILE $OGLOGSESSION updateCache REPO "/$3.$DIFFEXT" "$PROTO" "$7" - RETVAL=${PIPESTATUS[0]} + RETVAL=$? if [ "$RETVAL" != "0" ] then echo "[39] $MSG_SCRIPTS_TASK_END updateCache REPO $3.$DIFFEXT $6 $7 con error $RETVAL" | tee -a $OGLOGFILE @@ -123,7 +123,7 @@ ogRestoreInfoImage "$4" "$5" &>$OGLOGCOMMAND # Llamar al script de post-configuración del sistema operativo. echo "[90] $MSG_HELP_configureOs." | tee -a $OGLOGFILE $OGLOGSESSION -configureOs $4 $5 2>&1 | tee -a $OGLOGCOMMAND +configureOs $4 $5 TIME=$[SECONDS-TIME1] echo "[100] $MSG_SCRIPTS_END $MSG_SCRIPTS_TIME_TOTAL: $[TIME/60]m $[TIME%60]s" |tee -a $OGLOGFILE $OGLOGSESSION diff --git a/client/shared/scripts/updateCache b/client/shared/scripts/updateCache index 95bbfd99..b6ce1293 100755 --- a/client/shared/scripts/updateCache +++ b/client/shared/scripts/updateCache @@ -236,7 +236,7 @@ case "$PROTOCOLO" in # Si es sincronizada tipo directorio. [ -d "$OGCAC$OGIMG/$2" ] || mkdir "$OGCAC$OGIMG/$2" echo "rsync -aHAX$OPTRSYNC $USERRSYNC@$REPOIP::ogimages/$2/ $OGCAC$OGIMG/$2" |tee -a $OGLOGSESSION $OGLOGFILE - rsync -aHAX$OPTRSYNC $PASSWORD "$USERRSYNC@$REPOIP::ogimages/$2/" "$OGCAC$OGIMG/$2" 2>&1 | egrep "^sent|^sending|^total%" >> $OGLOGCOMMAND + rsync -aHAX$OPTRSYNC $PASSWORD "$USERRSYNC@$REPOIP::ogimages/$2/" "$OGCAC$OGIMG/$2" 2>> $OGLOGCOMMAND | egrep "^sent|^sending|^total%" >> $OGLOGCOMMAND else # Si es sincronizada tipo archivo. [ "${2##*.}" == "img" ] && IMGTYPE="img" || IMGTYPE="diff" @@ -256,15 +256,15 @@ case "$PROTOCOLO" in echo " $MSG_SCRIPTS_TASK_END, $MSG_SCRIPTS_TIME_PARTIAL: $[TIMEAUX3/60]m $[TIMEAUX3%60]s" | tee -a $OGLOGSESSION $OGLOGFILE fi # Montamos las imagenes para sincronizarlas. Quitamos / inicial. - ogMountImage CACHE "${IMGNAME#\/}" $IMGTYPE >/dev/null - ogMountImage REPO "${IMGNAME#\/}" $IMGTYPE >/dev/null + ogMountImage CACHE "${IMGNAME#\/}" $IMGTYPE || exit $? + ogMountImage REPO "${IMGNAME#\/}" $IMGTYPE # Esperamos que se monte la imagen en el servidor - ogWaitMountImage REPO "$IMGNAME" $IMGTYPE + ogWaitMountImage REPO "$IMGNAME" $IMGTYPE || exit $? #echo "$MSG_HELP_ogSyncCreate" | tee -a $OGLOGSESSION $OGLOGFILE echo " rsync -aHAX$OPTRSYNC $USERRSYNC@$REPOIP::ogimages/$DIRMOUNT/ $DIRLOCAL" |tee -a $OGLOGSESSION $OGLOGFILE - rsync -aHAX$OPTRSYNC $PASSWORD "$USERRSYNC@$REPOIP::ogimages/$DIRMOUNT/" "$DIRLOCAL" 2>&1 | egrep "^sent|^sending|^total|%" >> $OGLOGCOMMAND + rsync -aHAX$OPTRSYNC $PASSWORD "$USERRSYNC@$REPOIP::ogimages/$DIRMOUNT/" "$DIRLOCAL" 2>>$OGLOGCOMMAND | egrep "^sent|^sending|^total|%" >> $OGLOGCOMMAND # RETVAL="1" -> OK RETVAL="2" -> error # valores igual que ogUpdateCacheIsNecesary - [ ${PIPESTATUS[0]} == 0 ] && RETVAL="1"|| RETVAL="2" + [ ${PIPESTATUS[0]} -eq 0 ] && RETVAL="1"|| RETVAL="2" # Desmonto las imagenes ogUnmountImage CACHE "$IMGNAME" $IMGTYPE ogUnmountImage REPO "$IMGNAME" $IMGTYPE @@ -286,7 +286,6 @@ else ogUpdateCacheIsNecesary $REPOSITORIO "$2" RETVAL=$? fi - if [ "$(ogGetCaller)" != "deployImage" ]; then TIME2=$[SECONDS-TIME2] echo " [ ] $MSG_SCRIPTS_TIME_PARTIAL $MSG_HELP_ogCalculateChecksum $[TIME2/60]m $[TIME2%60]s" | tee -a $OGLOGSESSION $OGLOGFILE |