Add missing error checks to the artifact deployer 94/34094/3
authorJozef Behran <jbehran@cisco.com>
Thu, 4 Feb 2016 16:28:47 +0000 (17:28 +0100)
committerGerrit Code Review <gerrit@opendaylight.org>
Thu, 4 Feb 2016 17:25:13 +0000 (17:25 +0000)
When the artifact is not found or not downloaded, abort the
test suite with a fatal error rather than returning some
bogus file name and letting the Robot wasting time waiting
for timeouts while the Java is trying to run a nonexistent
tool.

Change-Id: I5c8b227057a25caef2e30d0cad28e1a2f76dd6e6
Signed-off-by: Jozef Behran <jbehran@cisco.com>
csit/libraries/NexusKeywords.robot

index f3fb87cda098d6097a03bf3c91079c3e95c46033..83105a711a47ccc24bbeec24a0a6dc565d8e6e5e 100644 (file)
@@ -40,10 +40,14 @@ Deploy_Artifact
     ${version}=    NexusKeywords__Get_Version_From_Metadata
     ${namepart}=    SSHLibrary.Execute_Command    curl ${urlbase}/${version}/maven-metadata.xml | grep value | head -n 1 | cut -d '>' -f 2 | cut -d '<' -f 1
     BuiltIn.Log    ${namepart}
+    ${length}=    BuiltIn.Get_Length    ${namepart}
+    BuiltIn.Run_Keyword_If    ${length} == 0    BuiltIn.Fail    Artifact "${artifact}" not found in component "${component}"
     ${filename}=    BuiltIn.Set_Variable    ${name_prefix}${namepart}${name_suffix}
     BuiltIn.Log    ${filename}
-    ${response}=    SSHLibrary.Execute_Command    wget -q -N ${urlbase}/${version}/${filename} 2>&1
+    ${url}=    BuiltIn.Set_Variable    ${urlbase}/${version}/${filename}
+    ${response}    ${result}=    SSHLibrary.Execute_Command    wget -q -N ${url} 2>&1    return_rc=True
     BuiltIn.Log    ${response}
+    BuiltIn.Run_Keyword_If    ${result} != 0    BuiltIn.Fail    Artifact "${artifact}" in component "${component}" could not be downloaded from ${url}
     [Return]    ${filename}
 
 Deploy_Test_Tool