Adding configuration validation.

This commit is contained in:
stephb9959
2021-09-14 17:06:50 -07:00
parent 7af151c697
commit fe98fa5d64
3 changed files with 115 additions and 0 deletions

View File

@@ -380,6 +380,15 @@ adddeviceconfig() {
jq < ${result_file}
}
validateconfig() {
curl ${FLAGS} -X POST "https://${OWPROV}/api/v1/configurations/1?validateOnly=true" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${token}" \
-H "accept: application/json" \
-d @"$1" > ${result_file}
jq < ${result_file}
}
shopt -s nocasematch
case "$1" in
"login") login; help ; logout ;;
@@ -413,6 +422,7 @@ case "$1" in
"adddeviceconfig") login; adddeviceconfig "$2" "$3"; logout;;
"addconfigmetrics") login; addconfigmetrics "$2" ; logout;;
"addconfigfile") login; addconfigfile "$2" ; logout;;
"validateconfig") login; validateconfig "$2"; logout;;
*) help ;;
esac