Commit 24550f6bd2cc7aa656907123a136feeb6c03d233

Authored by Paulo Tada
1 parent 0476e31d

Adding task create a dev env backups

Showing 2 changed files with 33 additions and 0 deletions   Show diff stats
Rakefile
... ... @@ -98,6 +98,7 @@ task :backup => ssh_config_file do
98 98 end
99 99  
100 100 task :restore => [ssh_config_file, config_file] do
  101 + Rake::Task['devbackup'].invoke if $SPB_ENV!="prod"
101 102 # setup
102 103 sh 'ssh', '-F', ssh_config_file, 'integration', 'sudo', 'rm -rf /tmp/backups'
103 104 sh 'ssh', '-F', ssh_config_file, 'integration', 'sudo', 'systemctl stop colab'
... ...
tasks/backups.rake 0 → 100644
... ... @@ -0,0 +1,32 @@
  1 +desc "This task will change the emails from backups"
  2 +
  3 +$REMOVE_SCRIPT="remove_backup_email.py"
  4 +$REMOVE_SCRIPT_DIR="utils/#{$REMOVE_SCRIPT}"
  5 +$BACKUPS_DIR="backups/"
  6 +
  7 +task :devbackup do
  8 + puts "You're NOT in a prod environment"
  9 + puts "This will alter all the emails."
  10 + puts "Do you want to alter the backups? [Y/n]"
  11 + if confirmed
  12 + sh 'cp' , "#{$REMOVE_SCRIPT_DIR}" , "#{$BACKUPS_DIR}"
  13 + sh "cd #{$BACKUPS_DIR} && python #{$REMOVE_SCRIPT}"
  14 + end
  15 +end
  16 +
  17 +def confirmed
  18 + STDOUT.flush
  19 + input = STDIN.gets.chomp
  20 + case input.upcase
  21 + when "Y", ""
  22 + puts "Altering emails from backups..."
  23 + return true
  24 + when "N"
  25 + puts "Aborting remove email backups..."
  26 + puts "Restoring with a normal backups"
  27 + return false
  28 + else
  29 + puts "Please enter Y or N"
  30 + get_confirmation
  31 + end
  32 +end
... ...