-
Notifications
You must be signed in to change notification settings - Fork 900
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Remove Selected Items from Inventory button for Images, Instances
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1601955 Fix the button by adding support for destroy to VmOrTemplate model.
- Loading branch information
Hilda Stastna
committed
Jul 31, 2018
1 parent
12b109c
commit 43b7615
Showing
4 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#!/usr/bin/env ruby | ||
require File.expand_path('../config/environment', __dir__) | ||
# ./tools/set_db_from.rb 10.8.198.207 case_01809078 i ~/Downloads/vmdb_production_dump u | ||
def ip | ||
ARGV[0] | ||
end | ||
|
||
def local_db_name | ||
ARGV[1] | ||
end | ||
|
||
def was_good?(was_good) | ||
was_good ? 'OK' : 'FAIL' | ||
end | ||
|
||
only_import = ARGV[2] == 'i' | ||
only_users = ARGV[4] == 'u' | ||
|
||
tn = Time.now.to_i | ||
backup_file = "#{ip.gsub '.','x'}#{tn}.backup" | ||
remote_backup_file = "/var/www/#{backup_file}" | ||
ssh_pass_command = "sshpass -p \"smartvm\"" | ||
ssh_strict_check = "ssh -o BatchMode=yes -o StrictHostKeyChecking=no user@#{ip} \"exit\"" | ||
backup_file = ARGV[3] if ARGV[3] | ||
|
||
puts "Hello!" | ||
|
||
unless only_import | ||
was_good = system ssh_strict_check | ||
puts "ssh_strict_check: #{was_good?(was_good)}" | ||
|
||
was_good = system "#{ssh_pass_command} ssh root@#{ip} \"pg_dump -Fc vmdb_production > #{remote_backup_file}\" " | ||
puts "backed up db on remote(#{remote_backup_file}): #{was_good?(was_good)}" | ||
|
||
was_good = system "#{ssh_pass_command} scp root@#{ip}:#{remote_backup_file} ./" | ||
puts "downloaded db to local: #{was_good?(was_good)}" | ||
end | ||
|
||
unless only_users | ||
was_good = system 'bundle exec rake db:create' | ||
puts "be rake db:create: #{was_good?(was_good)}" | ||
|
||
was_good = system "pg_restore -U root -d #{local_db_name} -F custom #{backup_file}" | ||
puts "pg_restore: #{was_good?(was_good)}" | ||
|
||
was_good = system 'bundle exec rake db:migrate' | ||
puts "be rake db:migrate: #{was_good?(was_good)}" | ||
|
||
was_good = system "ruby ./tools/fix_auth.rb -P smartvm #{local_db_name}" | ||
puts "fix auth: #{was_good?(was_good)}" | ||
end | ||
|
||
was_good = system "bundle exec bin/rails r \"User.all.each do |user| puts user.userid; user.update_attributes(:password => 'smartvm') end\"" | ||
puts "users update: #{was_good?(was_good)}" | ||
|
||
was_good = system "services memcached restart" | ||
puts "services restart memcached: #{was_good?(was_good)}" |