Add ACA address as option 3rd commandline parameter. Handle case where no reports are available or selected for download.

This commit is contained in:
chubtub 2021-03-16 10:16:17 -04:00
parent 7064c00c0b
commit 175d2238d2
2 changed files with 15 additions and 4 deletions

View File

@ -193,7 +193,8 @@ public class ValidationReportsPageController extends PageController<NoPageParams
}
break;
case "createTimes":
if (!parameterValue.equals(UNDEFINED)) {
if (!parameterValue.equals(UNDEFINED)
&& !parameterValue.isEmpty()) {
String[] timestamps = parameterValue.split(",");
for (String timestamp : timestamps) {
createTimes.add(LocalDateTime.parse(timestamp,
@ -202,7 +203,8 @@ public class ValidationReportsPageController extends PageController<NoPageParams
}
break;
case "deviceNames":
if (!parameterValue.equals(UNDEFINED)) {
if (!parameterValue.equals(UNDEFINED)
&& !parameterValue.isEmpty()) {
deviceNames = parameterValue.split(",");
}
break;
@ -240,8 +242,10 @@ public class ValidationReportsPageController extends PageController<NoPageParams
reportData.deleteCharAt(reportData.length() - 1);
reportData.append("\n,,,,,");
}
if (reportData.lastIndexOf(",") > 4) {
reportData.delete(reportData.lastIndexOf(",") - 4, reportData.length());
}
}
reportData.delete(reportData.lastIndexOf(",") - 4, reportData.length());
}
bufferedWriter.append(columnHeaders + "\n");
bufferedWriter.append(reportData.toString() + "\n");

View File

@ -3,8 +3,15 @@
#User input parameters:
#$1 filter start date 'yyyy-mm-dd'
#$2 filter end date 'yyyy-mm-dd'
#$3 ACA address, default is localhost if not given
endpoint="https://localhost:8443/HIRS_AttestationCAPortal/portal/validation-reports"
if [ -z "$3" ]
then
endpoint="https://localhost:8443/HIRS_AttestationCAPortal/portal/validation-reports"
else
endpoint="https://$3:8443/HIRS_AttestationCAPortal/portal/validation-reports"
fi
echo "$endpoint"
content=$(curl --insecure $endpoint/list)
rawTimes=$(jq -r '.data | map(.createTime | tostring) | join(",")' <<< "$content")
createTimes=""