Skip to content

Commit bba42a5

Browse files
authored
Merge pull request #11 from dockergiant/fast/update-restore-command-to-support-full-backup
Add restore-full decrypt examples
2 parents d503467 + 9983567 commit bba42a5

9 files changed

Lines changed: 1091 additions & 13 deletions

File tree

bin/roll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ declare ROLL_PARAMS=()
4040
declare ROLL_CMD_VERB=
4141
declare ROLL_CMD_EXEC=
4242
declare ROLL_CMD_HELP=
43-
declare ROLL_CMD_ANYARGS=(svc env db redis sync shell debug rootnotty rootshell clinotty root node npm cli copyfromcontainer copytocontainer composer grunt magento magerun backup restore duplicate)
43+
declare ROLL_CMD_ANYARGS=(svc env db redis sync shell debug rootnotty rootshell clinotty root node npm cli copyfromcontainer copytocontainer composer grunt magento magerun backup restore restore-full duplicate)
4444

4545
## parse first argument as command and determine validity
4646
if (( "$#" )); then

commands/backup.cmd

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -475,9 +475,7 @@ function backupSourceCode() {
475475
showProgress $step $total "Backing up source code"
476476

477477
local exclude_patterns=(
478-
"--exclude=.git"
479478
"--exclude=node_modules"
480-
"--exclude=vendor"
481479
"--exclude=var/cache"
482480
"--exclude=var/log"
483481
"--exclude=var/session"

commands/duplicate.cmd

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -231,13 +231,19 @@ function createBackup() {
231231

232232
logMessage INFO "Creating backup..."
233233

234-
# The --output-id flag outputs ONLY the backup ID (no warnings)
235-
if backup_id=$("${ROLL_DIR}/bin/roll" backup "${backup_args[@]}" 2>&1); then
234+
# The --output-id flag should output ONLY the backup ID
235+
if backup_output=$("${ROLL_DIR}/bin/roll" backup "${backup_args[@]}" 2>&1); then
236236
backup_exit_code=0
237-
# Remove any whitespace (should just be a number)
238-
backup_id=$(echo "$backup_id" | tr -d ' \n\r\t')
237+
# First try to use the output directly (clean --output-id output)
238+
backup_id=$(echo "$backup_output" | tr -d ' \n\r\t')
239+
240+
# If --output-id didn't work cleanly (warnings mixed in), fall back to regex
241+
if [[ ! "$backup_id" =~ ^[0-9]+$ ]]; then
242+
backup_id=$(echo "$backup_output" | grep -o '[0-9]\{10\}' | tail -1)
243+
fi
239244
else
240245
backup_exit_code=$?
246+
backup_output=""
241247
backup_id=""
242248
fi
243249

@@ -247,7 +253,8 @@ function createBackup() {
247253
return 0
248254
else
249255
logMessage ERROR "Failed to create backup or get valid backup ID"
250-
logMessage ERROR "Backup command output: '$backup_id'"
256+
logMessage ERROR "Backup command output: '$backup_output'"
257+
logMessage ERROR "Extracted backup ID: '$backup_id'"
251258
logMessage ERROR "Exit code: $backup_exit_code"
252259
return 1
253260
fi

0 commit comments

Comments
 (0)