)]}'
{"helm-toolkit/templates/scripts/db-backup-restore/_backup_main.sh.tpl":[{"author":{"_account_id":33282,"name":"Huy Tran","email":"huy.q.tran@ericsson.com","username":"ht095u"},"change_message_id":"5aaa690813a807c8c2b60ab2a4a86bc410920ead","unresolved":true,"context_lines":[{"line_number":279,"context_line":"local A_FILE\u003d\"$1\""},{"line_number":280,"context_line":"local A_DATE\u003d\"\""},{"line_number":281,"context_line":"if [[ -z ${BACK_UP_MODE} ]]; then"},{"line_number":282,"context_line":"  A_DATE\u003d$( awk -F/ \u0027{print $NF}\u0027 \u003c\u003c\u003c ${ARCHIVE_FILE} | cut -d\u0027.\u0027 -f 4 | tr -d \"Z\")"},{"line_number":283,"context_line":"else"},{"line_number":284,"context_line":"  A_DATE\u003d$( awk -F/ \u0027{print $NF}\u0027 \u003c\u003c\u003c ${ARCHIVE_FILE} | cut -d\u0027.\u0027 -f 5 | tr -d \"Z\")"},{"line_number":285,"context_line":"fi"}],"source_content_type":"text/x-smarty","patch_set":3,"id":"e2444faa_b785327b","line":282,"range":{"start_line":282,"start_character":12,"end_line":282,"end_character":54},"updated":"2022-03-29 13:50:44.000000000","message":"What is the reason \u0027basename\u0027 is not used here? It is being used on L318. An alternative for getting the basename would be ${ARCHIVE_FILE##*/}","commit_id":"f845081bb59d2ad2b19ada992770b7d5ee1274e3"},{"author":{"_account_id":33282,"name":"Huy Tran","email":"huy.q.tran@ericsson.com","username":"ht095u"},"change_message_id":"5aaa690813a807c8c2b60ab2a4a86bc410920ead","unresolved":true,"context_lines":[{"line_number":278,"context_line":"# the new one: \u003cdatabase name\u003e.\u003cnamespace\u003e.\u003ctable name | all\u003e.\u003cbackup mode\u003e.\u003cdate-time\u003e.tar.gz"},{"line_number":279,"context_line":"local A_FILE\u003d\"$1\""},{"line_number":280,"context_line":"local A_DATE\u003d\"\""},{"line_number":281,"context_line":"if [[ -z ${BACK_UP_MODE} ]]; then"},{"line_number":282,"context_line":"  A_DATE\u003d$( awk -F/ \u0027{print $NF}\u0027 \u003c\u003c\u003c ${ARCHIVE_FILE} | cut -d\u0027.\u0027 -f 4 | tr -d \"Z\")"},{"line_number":283,"context_line":"else"},{"line_number":284,"context_line":"  A_DATE\u003d$( awk -F/ \u0027{print $NF}\u0027 \u003c\u003c\u003c ${ARCHIVE_FILE} | cut -d\u0027.\u0027 -f 5 | tr -d \"Z\")"},{"line_number":285,"context_line":"fi"},{"line_number":286,"context_line":"echo ${A_DATE}"},{"line_number":287,"context_line":"}"},{"line_number":288,"context_line":""}],"source_content_type":"text/x-smarty","patch_set":3,"id":"5141ce4a_f973dfb3","line":285,"range":{"start_line":281,"start_character":0,"end_line":285,"end_character":2},"updated":"2022-03-29 13:50:44.000000000","message":"Giving \u0027.\u0027 as delimiter, the \u0027date is third field from end. IMO, it would be better to extract the field generically, without replying on the backup mode to determine the position of the field i.e. awk -F. \u0027{print $(NF-2)}\u0027","commit_id":"f845081bb59d2ad2b19ada992770b7d5ee1274e3"},{"author":{"_account_id":33282,"name":"Huy Tran","email":"huy.q.tran@ericsson.com","username":"ht095u"},"change_message_id":"ae88f33a48e24a38868b6dca1847f876923826f2","unresolved":true,"context_lines":[{"line_number":328,"context_line":"  done"},{"line_number":329,"context_line":"}"},{"line_number":330,"context_line":""},{"line_number":331,"context_line":"remove_old_local_archives() {"},{"line_number":332,"context_line":"  if [[ -d $ARCHIVE_DIR ]]; then"},{"line_number":333,"context_line":"    count\u003d0"},{"line_number":334,"context_line":"    SECONDS_TO_KEEP\u003d$((${LOCAL_DAYS_TO_KEEP}*86400))"},{"line_number":335,"context_line":"    log INFO \"${DB_NAME}_backup\" \"Deleting backups older than ${LOCAL_DAYS_TO_KEEP} days\""},{"line_number":336,"context_line":"    # We iterate over the hash table, checking the delta in seconds (hash keys),"},{"line_number":337,"context_line":"    # and minimum number of backups we must have in place. List of keys has to be sorted."},{"line_number":338,"context_line":"    for INDEX in $(tr \" \" \"\\n\" \u003c\u003c\u003c ${!FILETABLE[@]} | sort -n -); do"},{"line_number":339,"context_line":"      ARCHIVE_FILE\u003d${FILETABLE[${INDEX}]}"},{"line_number":340,"context_line":"      if [[ ${INDEX} -le ${SECONDS_TO_KEEP} || ${count} -lt ${LOCAL_DAYS_TO_KEEP} ]]; then"},{"line_number":341,"context_line":"        ((count++))"},{"line_number":342,"context_line":"        log INFO \"${DB_NAME}_backup\" \"Keeping file(s) ${ARCHIVE_FILE}.\""},{"line_number":343,"context_line":"      else"},{"line_number":344,"context_line":"        log INFO \"${DB_NAME}_backup\" \"Deleting file(s) ${ARCHIVE_FILE}.\""},{"line_number":345,"context_line":"          rm -rf $ARCHIVE_FILE"},{"line_number":346,"context_line":"          if [[ $? -ne 0 ]]; then"},{"line_number":347,"context_line":"            # Log error but don\u0027t exit so we can finish the script"},{"line_number":348,"context_line":"            # because at this point we haven\u0027t sent backup to RGW yet"},{"line_number":349,"context_line":"            log ERROR \"${DB_NAME}_backup\" \"Failed to cleanup local backup. Cannot remove some of ${ARCHIVE_FILE}\""},{"line_number":350,"context_line":"          fi"},{"line_number":351,"context_line":"      fi"},{"line_number":352,"context_line":"    done"},{"line_number":353,"context_line":"  else"},{"line_number":354,"context_line":"    log WARN \"${DB_NAME}_backup\" \"The local backup directory ${$ARCHIVE_DIR} does not exist.\""},{"line_number":355,"context_line":"  fi"},{"line_number":356,"context_line":"}"},{"line_number":357,"context_line":""},{"line_number":358,"context_line":"remove_old_local_archives() {"},{"line_number":359,"context_line":"  SECONDS_TO_KEEP\u003d$(( $((${LOCAL_DAYS_TO_KEEP}))*86400))"}],"source_content_type":"text/x-smarty","patch_set":3,"id":"5a275865_afb2612a","line":356,"range":{"start_line":331,"start_character":0,"end_line":356,"end_character":1},"updated":"2022-03-23 19:44:16.000000000","message":"Same function name? Should have removed?","commit_id":"f845081bb59d2ad2b19ada992770b7d5ee1274e3"},{"author":{"_account_id":32433,"name":"Vladimir Sigunov","email":"vladimir.sigunov@att.com","username":"vs422h"},"change_message_id":"a2892e0136ebe9ebff3ae06ee5f3daca36ddf5c5","unresolved":false,"context_lines":[{"line_number":328,"context_line":"  done"},{"line_number":329,"context_line":"}"},{"line_number":330,"context_line":""},{"line_number":331,"context_line":"remove_old_local_archives() {"},{"line_number":332,"context_line":"  if [[ -d $ARCHIVE_DIR ]]; then"},{"line_number":333,"context_line":"    count\u003d0"},{"line_number":334,"context_line":"    SECONDS_TO_KEEP\u003d$((${LOCAL_DAYS_TO_KEEP}*86400))"},{"line_number":335,"context_line":"    log INFO \"${DB_NAME}_backup\" \"Deleting backups older than ${LOCAL_DAYS_TO_KEEP} days\""},{"line_number":336,"context_line":"    # We iterate over the hash table, checking the delta in seconds (hash keys),"},{"line_number":337,"context_line":"    # and minimum number of backups we must have in place. List of keys has to be sorted."},{"line_number":338,"context_line":"    for INDEX in $(tr \" \" \"\\n\" \u003c\u003c\u003c ${!FILETABLE[@]} | sort -n -); do"},{"line_number":339,"context_line":"      ARCHIVE_FILE\u003d${FILETABLE[${INDEX}]}"},{"line_number":340,"context_line":"      if [[ ${INDEX} -le ${SECONDS_TO_KEEP} || ${count} -lt ${LOCAL_DAYS_TO_KEEP} ]]; then"},{"line_number":341,"context_line":"        ((count++))"},{"line_number":342,"context_line":"        log INFO \"${DB_NAME}_backup\" \"Keeping file(s) ${ARCHIVE_FILE}.\""},{"line_number":343,"context_line":"      else"},{"line_number":344,"context_line":"        log INFO \"${DB_NAME}_backup\" \"Deleting file(s) ${ARCHIVE_FILE}.\""},{"line_number":345,"context_line":"          rm -rf $ARCHIVE_FILE"},{"line_number":346,"context_line":"          if [[ $? -ne 0 ]]; then"},{"line_number":347,"context_line":"            # Log error but don\u0027t exit so we can finish the script"},{"line_number":348,"context_line":"            # because at this point we haven\u0027t sent backup to RGW yet"},{"line_number":349,"context_line":"            log ERROR \"${DB_NAME}_backup\" \"Failed to cleanup local backup. Cannot remove some of ${ARCHIVE_FILE}\""},{"line_number":350,"context_line":"          fi"},{"line_number":351,"context_line":"      fi"},{"line_number":352,"context_line":"    done"},{"line_number":353,"context_line":"  else"},{"line_number":354,"context_line":"    log WARN \"${DB_NAME}_backup\" \"The local backup directory ${$ARCHIVE_DIR} does not exist.\""},{"line_number":355,"context_line":"  fi"},{"line_number":356,"context_line":"}"},{"line_number":357,"context_line":""},{"line_number":358,"context_line":"remove_old_local_archives() {"},{"line_number":359,"context_line":"  SECONDS_TO_KEEP\u003d$(( $((${LOCAL_DAYS_TO_KEEP}))*86400))"}],"source_content_type":"text/x-smarty","patch_set":3,"id":"1ec9a065_3de1f00f","line":356,"range":{"start_line":331,"start_character":0,"end_line":356,"end_character":1},"in_reply_to":"5a275865_afb2612a","updated":"2022-03-23 20:48:02.000000000","message":"Fixed. Thanks!\nttps://review.opendev.org/c/openstack/openstack-helm-infra/+/834971","commit_id":"f845081bb59d2ad2b19ada992770b7d5ee1274e3"},{"author":{"_account_id":33282,"name":"Huy Tran","email":"huy.q.tran@ericsson.com","username":"ht095u"},"change_message_id":"5aaa690813a807c8c2b60ab2a4a86bc410920ead","unresolved":true,"context_lines":[{"line_number":413,"context_line":"  done"},{"line_number":414,"context_line":""},{"line_number":415,"context_line":"  # Cleanup now that we\u0027re done."},{"line_number":416,"context_line":"  for fd in ${BACKUP_FILES} ${DB_BACKUP_FILES}; do"},{"line_number":417,"context_line":"  if [[ -f fd ]]; then"},{"line_number":418,"context_line":"    rm -f fd"},{"line_number":419,"context_line":"  else"},{"line_number":420,"context_line":"    log WARN \"${DB_NAME}_backup\" \"Can not delete a temporary file ${fd}\""},{"line_number":421,"context_line":"}"},{"line_number":422,"context_line":""},{"line_number":423,"context_line":"# Main function to backup the databases. Calling functions need to supply:"}],"source_content_type":"text/x-smarty","patch_set":3,"id":"d1914951_ffc8926a","line":420,"range":{"start_line":416,"start_character":0,"end_line":420,"end_character":72},"updated":"2022-03-29 13:50:44.000000000","message":"There are issues with these statements here.\n1) the \u0027for\u0027 loop is missing \u0027done\u0027\n2) the \u0027if\u0027 is missing \u0027fi\u0027","commit_id":"f845081bb59d2ad2b19ada992770b7d5ee1274e3"}]}
