seira 0.6.4 → 0.6.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/seira/db.rb +12 -7
- data/lib/seira/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed12fc57ff19d790cf26102987d8c48792fabe688cb7c1d517caf62b8073f210
|
4
|
+
data.tar.gz: 4d296bb7e6bb748b706c2cbb093d89626fe160d3d41000a272c6a394ff5ba441
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c48eea1958850e0b70397ee952ce8bcf61013aa18b36d190d87e63c4f934493c2957d2c5389237da07a2fc90765948913a7bed0c16262d66cdd5c8d41bc1fb9
|
7
|
+
data.tar.gz: e0b3d410c3bcbc91f843aca207e229f049917d21ce9346130f11606991c886e3c635fc1dc19861a9f807379b48f5883d3f4018736dbb7c32c23665d3c1ffeb6e
|
data/lib/seira/db.rb
CHANGED
@@ -238,11 +238,16 @@ module Seira
|
|
238
238
|
# Example: seira staging app-name db create-readonly-user --username=readonlyuser
|
239
239
|
def run_create_readonly_user
|
240
240
|
instance_name = primary_instance # Always make user changes to primary instance, and they will propogate to replicas
|
241
|
+
pgbouncer_tier = nil
|
241
242
|
user_name = nil
|
242
243
|
|
243
244
|
args.each do |arg|
|
244
245
|
if arg.start_with? '--username='
|
245
246
|
user_name = arg.split('=')[1]
|
247
|
+
elsif arg.start_with? '--instance='
|
248
|
+
instance_name = arg.split('=')[1]
|
249
|
+
elsif arg.start_with? '--pgbouncer-tier='
|
250
|
+
pgbouncer_tier = arg.split('=')[1]
|
246
251
|
else
|
247
252
|
puts "Warning: Unrecognized argument '#{arg}'"
|
248
253
|
end
|
@@ -259,7 +264,7 @@ module Seira
|
|
259
264
|
exit(1)
|
260
265
|
end
|
261
266
|
|
262
|
-
valid_instance_names = existing_instances(remove_app_prefix: false)
|
267
|
+
valid_instance_names = existing_instances(remove_app_prefix: false)
|
263
268
|
if instance_name.nil? || instance_name.strip.chomp == '' || !valid_instance_names.include?(instance_name)
|
264
269
|
puts "Could not find a valid instance name - does the DATABASE_URL have a value? Must be one of: #{valid_instance_names}"
|
265
270
|
exit(1)
|
@@ -287,8 +292,8 @@ module Seira
|
|
287
292
|
SQL
|
288
293
|
|
289
294
|
puts "Connecting"
|
290
|
-
execute_db_command(admin_commands, as_admin: true)
|
291
|
-
execute_db_command(database_commands)
|
295
|
+
execute_db_command(admin_commands, instance_name: instance_name, pgbouncer_tier: pgbouncer_tier, as_admin: true)
|
296
|
+
execute_db_command(database_commands, instance_name: instance_name, pgbouncer_tier: pgbouncer_tier)
|
292
297
|
end
|
293
298
|
|
294
299
|
def run_psql
|
@@ -432,12 +437,12 @@ module Seira
|
|
432
437
|
end
|
433
438
|
end
|
434
439
|
|
435
|
-
def execute_db_command(sql_command, as_admin: false, interactive: false, print: true)
|
440
|
+
def execute_db_command(sql_command, instance_name: nil, pgbouncer_tier: nil, as_admin: false, interactive: false, print: true)
|
436
441
|
# TODO(josh): move pgbouncer naming logic here and in Create to a common location
|
437
|
-
instance_name
|
442
|
+
instance_name ||= primary_instance
|
438
443
|
private_ip = Helpers.sql_ips(instance_name, context: context)[:private]
|
439
|
-
|
440
|
-
matching_pods = Helpers.fetch_pods(context: context, filters: { tier:
|
444
|
+
pgbouncer_tier ||= instance_name.gsub("#{app}-", '')
|
445
|
+
matching_pods = Helpers.fetch_pods(context: context, filters: { tier: pgbouncer_tier })
|
441
446
|
if matching_pods.empty?
|
442
447
|
puts 'Could not find pgbouncer pod to connect to'
|
443
448
|
exit 1
|
data/lib/seira/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: seira
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Ringwelski
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: highline
|