pvcglue 0.1.18 → 0.1.19

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9582fa0791b38da8006bf4672032b35d97bfa11b
4
- data.tar.gz: 3facc6e4e1c64d0baec87d6cc24503958a67f812
3
+ metadata.gz: 9b41533643419c1df16e610b0ede09ae0ee64857
4
+ data.tar.gz: 0e1ccf31c5e651d1e7ee97a7258d93c15fff6002
5
5
  SHA512:
6
- metadata.gz: bc1af302e92fc29daa6bde7a2ac3ab30ee1becf137c055f1b116746d90036303e9c0050124eef04a42bede3fde155f9ab59ae26251696be8e071b45e2bd28ea8
7
- data.tar.gz: 03fee3e424a4c4fe9ab2b5fdaf62b4431ed00b9b5ff231bf69d2763fa86c5570639806c7e2a27cbe5bea78e3dd412091881b283b6c378f8b0ea26b773d04c7bc
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} #{self.class.file_helper(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
@@ -1,3 +1,3 @@
1
1
  module Pvcglue
2
- VERSION = "0.1.18"
2
+ VERSION = "0.1.19"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pvcglue
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.18
4
+ version: 0.1.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Lyric