rubypond-s3backup-manager 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/adapters/postgres_adapter.rb +9 -3
- metadata +1 -1
@@ -18,14 +18,20 @@ module S3BackupManager
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def restore_database_from_file(username, database, directory)
|
21
|
-
system "chown -R #{username}
|
21
|
+
system "chown -R #{username} /tmp/#{database}"
|
22
22
|
user_file = "#{directory}/globals.pgsql"
|
23
23
|
system "cd /tmp && sudo -u #{username} psql -f #{user_file} >/dev/null 2>&1"
|
24
|
-
|
24
|
+
unless $?.success?
|
25
|
+
puts "Unable to load in the users"
|
26
|
+
exit(1)
|
27
|
+
end
|
25
28
|
dump_file = "#{directory}/#{database}.pgsql"
|
26
29
|
recreate_database!(username, database)
|
27
30
|
system "cd /tmp && sudo -u #{username} pg_restore --format=t -d #{database} #{dump_file} >/dev/null 2>&1"
|
28
|
-
|
31
|
+
unless $?.success?
|
32
|
+
puts "Unable to restore database. Did you provide a username that has permission?"
|
33
|
+
exit(1)
|
34
|
+
end
|
29
35
|
end
|
30
36
|
|
31
37
|
private
|