pvcglue 0.1.18 → 0.1.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pvcglue/db.rb +23 -12
- data/lib/pvcglue/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b41533643419c1df16e610b0ede09ae0ee64857
|
4
|
+
data.tar.gz: 0e1ccf31c5e651d1e7ee97a7258d93c15fff6002
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26edde8f93741d015d24a278d13ea9163d70f5978d37ac40d7e34786cda3bc1310ada65657f806b3aae5f406553bc0e0073742dc6f8af7b321799ae963cf8bb6
|
7
|
+
data.tar.gz: cde008ef3991255eb23f8f88e8142aaf27834bf50d4c51bca7b2ab466ff808cf9b9f1581eb89b1cdd775f2eefaf9a559a4d7a76bc67e04f217c5a6f187e84f03
|
data/lib/pvcglue/db.rb
CHANGED
@@ -146,14 +146,36 @@ module Pvcglue
|
|
146
146
|
raise(Thor::Error, "Error: #{$?}")
|
147
147
|
end
|
148
148
|
|
149
|
-
cmd = %{scp -P #{port} #{user}@#{host}:#{file_name} #{
|
149
|
+
cmd = %{scp -P #{port} #{user}@#{host}:#{file_name} #{file_name}}
|
150
150
|
puts "Running `#{cmd}`"
|
151
151
|
|
152
152
|
unless system cmd
|
153
153
|
raise(Thor::Error, "Error: #{$?}")
|
154
154
|
end
|
155
|
+
end
|
156
|
+
|
157
|
+
def pg_restore(db, file_name)
|
158
|
+
Pvcglue.cloud.stage_name == 'production' && destroy_prod?
|
155
159
|
|
160
|
+
host = Pvcglue.cloud.nodes_in_stage('db')['db']['public_ip']
|
161
|
+
port = Pvcglue.cloud.port_in_context(:shell)
|
162
|
+
user = 'deploy'
|
163
|
+
file_name = self.class.file_helper(file_name)
|
156
164
|
|
165
|
+
cmd = %{scp -P #{port} #{file_name} #{user}@#{host}:#{file_name}}
|
166
|
+
unless system cmd
|
167
|
+
raise(Thor::Error, "Error: #{$?}")
|
168
|
+
end
|
169
|
+
|
170
|
+
cmd = "pg_restore --verbose --clean --no-acl --no-owner -h #{db.host} -p #{db.port}"
|
171
|
+
cmd += " -U #{db.username}" if db.username
|
172
|
+
cmd += " -d #{db.database} #{self.class.file_helper(file_name)}"
|
173
|
+
puts cmd
|
174
|
+
|
175
|
+
unless Pvcglue.run_remote(host, port, user, " PGPASSWORD=#{db.password} #{cmd}")
|
176
|
+
puts "ERROR:"
|
177
|
+
puts $?.inspect
|
178
|
+
end
|
157
179
|
end
|
158
180
|
|
159
181
|
def pg_destroy(dest)
|
@@ -191,17 +213,6 @@ module Pvcglue
|
|
191
213
|
end
|
192
214
|
end
|
193
215
|
|
194
|
-
def pg_restore(dest, file_name)
|
195
|
-
Pvcglue.cloud.stage_name == 'production' && destroy_prod?
|
196
|
-
cmd = "pg_restore --verbose --clean --no-acl --no-owner -h #{dest.host} -p #{dest.port}"
|
197
|
-
cmd += " -U #{dest.username}" if dest.username
|
198
|
-
cmd += " -d #{dest.database} #{self.class.file_helper(file_name)}"
|
199
|
-
puts cmd
|
200
|
-
unless system({"PGPASSWORD" => dest.password}, cmd)
|
201
|
-
puts "ERROR:"
|
202
|
-
puts $?.inspect
|
203
|
-
end
|
204
|
-
end
|
205
216
|
end
|
206
217
|
|
207
218
|
end
|
data/lib/pvcglue/version.rb
CHANGED