Warn about invalid date when collecting logs
If the user entered an invalid start-date, invalid end-date and/or the start-date is greater than the end-date during the collect logs process, the system will warn the user about the error, instead of just reverting to collect all. Test plan: PASS - Install and bootstrap SX and test if the warnings are presented if an invalid start-date, end-date and/or date range are passed by the user, as well as collecting logs if correct parameters are provided. PASS - Install and bootstrap Standard and test if the warnings are presented if an invalid start-date, end-date and/or date range are passed by the user, as well as collecting logs if correct parameters are provided. Test with correct parameters: PASS: collect --start-date any --end-date any PASS: collect PASS: collect --all PASS: collect --list controller-0 controller-1 PASS: collect controller-0 controller-1 PASS: collect --all --subcloud Closes-bug: 2003791 Signed-off-by: Victor Romano <victor.gluzromano@windriver.com> Change-Id: Iab872d2cbf02e1e6b6feef931375d05345c844e8
This commit is contained in:
parent
6b1645dd32
commit
db7144f1cf
@ -759,6 +759,23 @@ while [[ ${#} -gt 0 ]] ; do
|
||||
done
|
||||
|
||||
|
||||
date -d $STARTDATE > /dev/null 2>/dev/null
|
||||
rc_start_date=${?}
|
||||
date -d $ENDDATE > /dev/null 2>/dev/null
|
||||
rc_end_date=${?}
|
||||
|
||||
if [ $rc_start_date != 0 -a "$STARTDATE" != "any" ] ; then
|
||||
report_error "the start date is invalid" ${FAIL_INVALID_START_DATE}
|
||||
collect_exit ${FAIL_INVALID_START_DATE}
|
||||
elif [ $rc_end_date != 0 -a "$ENDDATE" != "any" ] ; then
|
||||
report_error "the end date is invalid" ${FAIL_INVALID_END_DATE}
|
||||
collect_exit ${FAIL_INVALID_END_DATE}
|
||||
elif (( STARTDATE > ENDDATE )) && [ "$STARTDATE" != "any" -a "$ENDDATE" != "any" ] ; then
|
||||
report_error "the start date is greater than the end date" ${FAIL_INVALID_DATE_RANGE}
|
||||
collect_exit ${FAIL_INVALID_DATE_RANGE}
|
||||
fi
|
||||
|
||||
|
||||
# startup state debug logs
|
||||
dlog "${TOOL_NAME} ver ${TOOL_REV}.${TOOL_REV} (pid:$$)"
|
||||
dlog "USERNAME = ${USER}"
|
||||
|
@ -54,7 +54,10 @@ FAIL_CONTINUE=51
|
||||
FAIL_SUBCLOUDNAME=52
|
||||
FAIL_NO_SUBCLOUDS=53
|
||||
FAIL_NOT_SYSTEMCONTROLLER=54
|
||||
|
||||
FAIL_NAME_TOO_LONG=55
|
||||
FAIL_INVALID_START_DATE=56
|
||||
FAIL_INVALID_END_DATE=57
|
||||
FAIL_INVALID_DATE_RANGE=58
|
||||
|
||||
# Warnings are above 200
|
||||
WARN_WARNING=200
|
||||
|
@ -768,6 +768,23 @@ while [[ ${#} -gt 0 ]] ; do
|
||||
done
|
||||
|
||||
|
||||
date -d $STARTDATE > /dev/null 2>/dev/null
|
||||
rc_start_date=${?}
|
||||
date -d $ENDDATE > /dev/null 2>/dev/null
|
||||
rc_end_date=${?}
|
||||
|
||||
if [ $rc_start_date != 0 -a "$STARTDATE" != "any" ] ; then
|
||||
report_error "the start date is invalid" ${FAIL_INVALID_START_DATE}
|
||||
collect_exit ${FAIL_INVALID_START_DATE}
|
||||
elif [ $rc_end_date != 0 -a "$ENDDATE" != "any" ] ; then
|
||||
report_error "the end date is invalid" ${FAIL_INVALID_END_DATE}
|
||||
collect_exit ${FAIL_INVALID_END_DATE}
|
||||
elif (( STARTDATE > ENDDATE )) && [ "$STARTDATE" != "any" -a "$ENDDATE" != "any" ] ; then
|
||||
report_error "the start date is greater than the end date" ${FAIL_INVALID_DATE_RANGE}
|
||||
collect_exit ${FAIL_INVALID_DATE_RANGE}
|
||||
fi
|
||||
|
||||
|
||||
# startup state debug logs
|
||||
dlog "${TOOL_NAME} ver ${TOOL_REV}.${TOOL_REV} (pid:$$)"
|
||||
dlog "USERNAME = ${USER}"
|
||||
|
@ -55,6 +55,9 @@ FAIL_SUBCLOUDNAME=52
|
||||
FAIL_NO_SUBCLOUDS=53
|
||||
FAIL_NOT_SYSTEMCONTROLLER=54
|
||||
FAIL_NAME_TOO_LONG=55
|
||||
FAIL_INVALID_START_DATE=56
|
||||
FAIL_INVALID_END_DATE=57
|
||||
FAIL_INVALID_DATE_RANGE=58
|
||||
|
||||
|
||||
# Warnings are above 200
|
||||
|
Loading…
x
Reference in New Issue
Block a user