Commit 45021027 authored by Andrea Sciaba's avatar Andrea Sciaba
Browse files

Re-added age check for git copy of conf file

parent 234eb9fa
#!/bin/sh
#!/bin/bash
#
# CE-cms-basic
#
......@@ -71,7 +71,7 @@ echo "Printing CMS site local config information..."
echo
echo Hostname: `hostname`
tmpfile=`mktemp /tmp/tmp.XXXXXXXXXX`
export SCRAM_ARCH=slc5_amd64_gcc462
export SCRAM_ARCH=slc6_amd64_gcc493
source $SW_DIR/cmsset_default.sh > $tmpfile 2>&1
result=$?
if [ $result != 0 ] ; then
......@@ -165,7 +165,7 @@ let localConfigFileAgeInHours=$seconds/3600
echo "SiteLocalConfigAge: ${localConfigFileAgeInHours} hours"
asCvs=1
cvsUrl="https://gitlab.cern.ch/SITECONF/${SiteName^^}/raw/master/JobConfig/site-local-config${subSiteName}.xml"
cvsUrl="https://gitlab.cern.ch/SITECONF/${SiteName}/raw/master/JobConfig/site-local-config${subSiteName}.xml"
ConfigFileFromCVS=`mktemp /tmp/site-local-config-from-CVS.xml.XXX`
echo "GITCopy: $cvsUrl"
./fetch-from-web-gitlab \"$cvsUrl\" $ConfigFileFromCVS
......@@ -175,9 +175,22 @@ if [ $rc == 0 ] ; then
if [ $? == 1 ] ; then asCvs=0; fi
if [ $asCvs == 0 ] ; then
noConfigDump=1
error=1
echo "ERROR: local site configuration file differ from GIT"
errorSummary="summary: LOCAL_SITE_CONF_GIT_ERROR"
cvsMarkupUrl="https://gitlab.cern.ch/SITECONF/${SiteName}/blob/master/JobConfig/site-local-config${subSiteName}.xml"
ConfigFileMarkup=`mktemp /tmp/site-local-config-from-CVS-Markup.xml.XXX`
./fetch-from-web-gitlab \"$cvsMarkupUrl\" $ConfigFileMarkup
cvsFileDate=`/bin/awk '{i=index($0,"datetime=");if(i>0){s=substr($0,i+10,4) "-" substr($0,i+15,2) "-" substr($0,i+18,2) " " substr($0,i+21,2) ":" substr($0,i+24,2) ":" substr($0,i+27,2) "Z";print s}}' $ConfigFileMarkup`
let seconds=`date +%s`-`date +%s -d "$cvsFileDate"`
let cvsFileAgeInHours=$seconds/3600
echo "GITConfigFileAge: ${cvsFileAgeInHours} hours"
if [ $localConfigFileAgeInHours -gt 120 ] && [ $cvsFileAgeInHours -gt 120 ] ; then
error=1
echo "ERROR: local site configuration file differ from GIT"
errorSummary="summary: LOCAL_SITE_CONF_GIT_ERROR"
else
warning=1
echo "WARNING: local site configuration file differ from GIT"
errorSummary="summary: LOCAL_SITE_CONF_GIT_WARNING"
fi
diffList=`mktemp /tmp/diflist.XXXX`
diff $ConfigFile $ConfigFileFromCVS > $diffList
cat $diffList | sed 's/</\&lt;/g' | sed 's/>/\&gt;/g'
......@@ -198,9 +211,7 @@ echo "LocalTFCAge: ${localTFCfileAgeInHours} hours"
asCvs=1
TFCfileName=`echo $TFCPath | awk -F'/' '{print $NF}'`
cvsUrl="https://cmsweb.cern.ch/gitweb/?p=siteconf/.git;a=blob_plain;f=$SiteName/PhEDEx/${TFCfileName};hb=HEAD"
cvsUrl="https://gitlab.cern.ch/SITECONF/${SiteName^^}/raw/master/PhEDEx/${TFCfileName}"
cvsUrl="https://gitlab.cern.ch/SITECONF/${SiteName}/raw/master/PhEDEx/${TFCfileName}"
TfcFileFromCVS=`mktemp /tmp/storage-from-CVS.xml.XXXX`
echo "TFCGITCopy: $cvsUrl"
./fetch-from-web-gitlab \"$cvsUrl\" $TfcFileFromCVS
......@@ -211,9 +222,23 @@ if [ $rc == 0 ] ; then
if [ $? == 1 ] ; then asCvs=0; fi
if [ $asCvs == 0 ] ; then
noTFCDump=1
error=1
echo "ERROR: local Trivial Catalog File file differ from GIT"
errorSummary="summary: TFC_GIT_ERROR"
cvsMarkupUrl="https://gitlab.cern.ch/SITECONF/${SiteName}/blob/master/PhEDEx/${TFCfileName}"
TfcFileMarkup=`mktemp /tmp/TFC-from-CVS-Markup.xml.XXX`
echo "Fetch GIT Markup copy of TFC from $cvsMarkupUrl"
./fetch-from-web-gitlab \"$cvsMarkupUrl\" $TfcFileMarkup
cvsFileDate=`/bin/awk '{i=index($0,"datetime=");if(i>0){s=substr($0,i+10,4) "-" substr($0,i+15,2) "-" substr($0,i+18,2) " " substr($0,i+21,2) ":" substr($0,i+24,2) ":" substr($0,i+27,2) "Z";print s}}' $TfcFileMarkup`
let seconds=`date +%s`-`date +%s -d "$cvsFileDate"`
let cvsFileAgeInHours=$seconds/3600
echo "GITTFCAge: ${cvsFileAgeInHours} hours"
if [ $localTFCfileAgeInHours -gt 120 ] && [ $cvsFileAgeInHours -gt 120 ] ; then
error=1
echo "ERROR: local Trivial Catalog File file differ from GIT"
errorSummary="summary: TFC_GIT_ERROR"
else
warning=1
echo "WARNING: local Trivial Catalog File file differ from GIT"
errorSummary="summary: TFC_GIT_WARNING"
fi
diffList=`mktemp /tmp/diflist.XXXX`
diff $TFCPath $TfcFileFromCVS > $diffList
cat $diffList | sed 's/</\&lt;/g' | sed 's/>/\&gt;/g'
......
......@@ -56,8 +56,7 @@ echo "$cmd > $wgetOutput 2>&1" > $cmdFile
source $cmdFile
rc=$?
if [ $rc != 0 ] ; then
echo "$cmd"
echo "Error code: $rc"
echo "wget error code: $rc"
cat $wgetOutput
if [ $useSquid == 0 ] ; then
echo "ERROR: Failed to retrieve $file from $url"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment