Add missing error checks to the artifact deployer
[integration/test.git] / 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