rubypond-s3backup-manager 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
|