From: Daniel KouĊ™il Date: Fri, 18 Feb 2011 10:27:44 +0000 (+0000) Subject: Added check_credentials() X-Git-Tag: gridsite-core_R_1_7_10~10 X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=bb4d2b2eaf12181e9e5c511012858b59c41e951f;p=jra1mw.git Added check_credentials() --- diff --git a/org.glite.testsuites.ctb/LB/tests/lb-common.sh b/org.glite.testsuites.ctb/LB/tests/lb-common.sh index ac07138..352e274 100755 --- a/org.glite.testsuites.ctb/LB/tests/lb-common.sh +++ b/org.glite.testsuites.ctb/LB/tests/lb-common.sh @@ -253,3 +253,21 @@ function test_args() echo $@ } +function check_credentials() +{ + my_GRIDPROXYINFO=${GRIDPROXYINFO} + if [ "$1" != "" ]; then + my_GRIDPROXYINFO="${GRIDPROXYINFO} -f $1" + fi + + timeleft=`${my_GRIDPROXYINFO} | ${SYS_GREP} -E "^timeleft" | ${SYS_SED} "s/timeleft\s*:\s//"` + if [ "$timeleft" = "" ]; then + print_error "No credentials" + return 1 + fi + if [ "$timeleft" = "0:00:00" ]; then + print_error "Credentials expired" + return 1 + fi + return 0 +}