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. Closes-bug: 2003791 Signed-off-by: Victor Romano <victor.gluzromano@windriver.com> Change-Id: Iab35b1d92f4471e2713fabe5d7a6ef8b611ea240
This commit is contained in:
parent
93318327fc
commit
59450af179
@ -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 ] ; then
|
||||
report_error "the start date is invalid" ${FAIL_INVALID_START_DATE}
|
||||
collect_exit ${FAIL_INVALID_START_DATE}
|
||||
elif [ $rc_end_date != 0 ] ; then
|
||||
report_error "the end date is invalid" ${FAIL_INVALID_END_DATE}
|
||||
collect_exit ${FAIL_INVALID_END_DATE}
|
||||
elif (( $STARTDATE > $ENDDATE )) ; 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,6 +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
|
||||
|
@ -767,6 +767,22 @@ while [[ ${#} -gt 0 ]] ; do
|
||||
shift # past argument or value
|
||||
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 ] ; then
|
||||
report_error "the start date is invalid" ${FAIL_INVALID_START_DATE}
|
||||
collect_exit ${FAIL_INVALID_START_DATE}
|
||||
elif [ $rc_end_date != 0 ] ; then
|
||||
report_error "the end date is invalid" ${FAIL_INVALID_END_DATE}
|
||||
collect_exit ${FAIL_INVALID_END_DATE}
|
||||
elif (( $STARTDATE > $ENDDATE )) ; 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:$$)"
|
||||
|
@ -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