- Timestamp:
- Mar 5, 2012, 5:19:48 PM (14 years ago)
- Location:
- branches/meh_branches/ppstack_test
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
ippScripts/scripts/magic_destreak_revert.pl (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/meh_branches/ppstack_test
- Property svn:mergeinfo changed
-
branches/meh_branches/ppstack_test/ippScripts/scripts/magic_destreak_revert.pl
r32048 r33415 9 9 my $host = hostname(); 10 10 my $date = `date`; 11 print "\n\n";12 print "Starting script $0 on $host at $date\n\n";11 print STDERR "\n\n"; 12 print STDERR "Starting script $0 on $host at $date\n\n"; 13 13 14 14 use vars qw( $VERSION ); … … 86 86 my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR ); # IPP configuration 87 87 88 $ipprc->redirect_ output($logfile) or my_die( "Unable to redirect output", $magic_ds_id, $component, $PS_EXIT_SYS_ERROR ) if $logfile;88 $ipprc->redirect_to_logfile($logfile) or my_die( "Unable to redirect output", $magic_ds_id, $component, $PS_EXIT_SYS_ERROR ) if $logfile; 89 89 90 90 &my_die("bytes and md5sum are is required for raw stage stage", $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR) if ($replace and $stage eq 'raw' and (!$bytes or !$md5sum)); … … 413 413 if ($backup_is_not_destreaked) { 414 414 if ($original_is_not_destreaked) { 415 # this is unexpected result. throw an error so this can be checked manually 416 print STDERR "both files appear to not be destreaked\n"; 415 print STDERR "\nBoth files appear to not be destreaked.\n"; 417 416 print STDERR "original: $original\n"; 418 417 print STDERR "backup: $backup\n"; 419 418 my $o_basename = basename($o_path); 420 419 my $b_basename = basename($b_path); 421 if (!($o_basename =~ /SR_/) and ($b_basename =~ /SR_/)) { 422 print " basenames are as expected it is safe to revert\n"; 420 # if original file does not have SR_ in basename and the backup does then the 421 # files are in their original state. Just delete back up file 422 # otherwise go to failed_revert for manual inspection. 423 # XXX: We probably can get by with just checking the basename of the original file 424 if (!($o_basename =~ /SR_/) ) { 425 # if (!($o_basename =~ /SR_/) and ($b_basename =~ /SR_/)) { 426 print STDERR " basenames are as expected it is safe to delete backup file\n"; 427 if (! $ipprc->file_delete($backup, $force)) { 428 print STDERR "failed to delete $backup\n"; 429 return 0; 430 } 431 return 1; 423 432 } else { 433 # this is an unexpected result. throw an error so this can be checked manually 434 print STDERR " basenames for files are as NOT as expected unsafe to revert\n"; 435 print STDERR " o_basename: $o_basename\n"; 436 print STDERR " b_basename: $b_basename\n"; 424 437 return 0; 425 438 } … … 470 483 foreach my $file (@_) { 471 484 next if !$file; 472 if ($ipprc->file_exists($file)) { 473 if (!$ipprc->file_delete($file)) { 474 &my_die("failed to delete recovery file $file", $magic_ds_id, $component, $PS_EXIT_UNKNOWN_ERROR); 475 } 476 } 485 # don't care if this fails or not (it will fail if storage 486 # object doesn't exist 487 $ipprc->kill_file($file); 477 488 } 478 489 } … … 500 511 my $command = "$magicdstool -updaterun"; 501 512 $command .= " -magic_ds_id $magic_ds_id"; 502 $command .= " -set_state failed_revert"; 513 if ($run_state ne 'update') { 514 $command .= " -set_state failed_revert"; 515 } else { 516 $command .= " -set_state failed_revert_ud"; 517 } 503 518 $command .= " -dbname $dbname" if defined $dbname; 504 519
Note:
See TracChangeset
for help on using the changeset viewer.
