shards 2.3.4 → 2.4.0

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
  SHA256:
3
- metadata.gz: acb4cc54d6b0923dce6d98ec135ec76a383c0d31150e4576b23b00a07038378a
4
- data.tar.gz: 40ddf20a5afadedad393b9a708cc8df103f511e905e49459538722424b5ea74c
3
+ metadata.gz: c804f800c7a67a380ec52b9aceb45ee1d206e8285aca03f5d2f66a1a386ad42e
4
+ data.tar.gz: 9d06affc175287848d498fd26c1dd2aa58f1d19084ee7287ce4f8fce722afe0d
5
5
  SHA512:
6
- metadata.gz: 6e2074014961d33910bcc52e3c8e3ff005392ad3ee7922963996f179aaab1818e4ca93bc03d6000de7723da6fa20dfc4fbd8cde7fd7585f269027e7e8d0cd66b
7
- data.tar.gz: 95078cec446bc54aa82ebe437a817bdbfc769b28a35bd76af3992d44773bc08e356148f82774a08a527beee02ec18a4c80cc168f03ebaee7d7d6da499eea6a8a
6
+ metadata.gz: 4fe4f5604cada371743b2140216878bdad6e31a4ecbf34ac60165eeb48dfacc5bb87f176bb728e29a45f084faa4eb47a76dfbae42fed01c5dcd222b2b5d466a8
7
+ data.tar.gz: 1369e2c79f51e3545533c2304fd5140676315915c1290e3ba77bcf892c3f9ed3dec83b71d587f381bbc49e6854f250972df1217c3492eeb67b31689a5608c5a1
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- shards (2.3.4)
4
+ shards (2.4.0)
5
5
  aws-sdk-ec2 (~> 1.48)
6
6
  aws-sdk-elasticloadbalancing (~> 1.5)
7
7
  aws-sdk-elasticloadbalancingv2 (~> 1.14)
@@ -110,8 +110,14 @@ shared_steps:
110
110
  min_size: 3
111
111
  regex: ^[a-z0-9_\-]*$
112
112
 
113
- validate_stage:
113
+ validate_blank_db_shard:
114
114
  correct: check_shard_presence_in_shards
115
+ message: Shard %s defined as blank_db exists.
116
+ wrong_message: Shard %s does not exist and it is defined in the stage config as blank_db.
117
+ wrong: clean_repo_and_exit
118
+
119
+ validate_stage:
120
+ correct: validate_blank_db_shard
115
121
  wrong_message: Stage %s does not exist.
116
122
  wrong: clean_repo_and_exit
117
123
 
@@ -14,6 +14,7 @@ correct_steps_summary:
14
14
  - validate_domain
15
15
  - validate_location
16
16
  - validate_stage
17
+ - validate_blank_db_shard
17
18
  - check_shard_presence_in_shards
18
19
  - check_database_presence_in_server
19
20
  - check_domain_dns_presence
@@ -10,6 +10,7 @@ correct_steps_summary:
10
10
  - validate_domain
11
11
  - validate_location
12
12
  - validate_stage
13
+ - validate_blank_db_shard
13
14
  - check_shard_presence_in_shards
14
15
  - check_database_presence_in_server
15
16
  - check_domain_dns_presence
data/lib/shards/db.rb CHANGED
@@ -164,7 +164,7 @@ module Shards
164
164
  end
165
165
 
166
166
  def blank_db_connection
167
- shard.list[blank_db || stage.get('blank_db')]
167
+ shard.list[stage.blank_db_shard_key]
168
168
  end
169
169
 
170
170
  end
data/lib/shards/stage.rb CHANGED
@@ -13,7 +13,7 @@ module Shards
13
13
  define_method(m.to_sym) { run __method__ }
14
14
  end
15
15
 
16
- attr_accessor :name, :location_name, :shard
16
+ attr_accessor :name, :location_name, :shard, :chosen_blank_db
17
17
 
18
18
  def initialize name, data, location_name
19
19
 
@@ -100,6 +100,15 @@ module Shards
100
100
  [ h , send(remote_check) ]
101
101
  end.to_h
102
102
  end
103
+
104
+ def blank_db_shard_key
105
+ chosen_blank_db || get('blank_db')
106
+ end
107
+
108
+ def blank_db_shard_exist?
109
+ shard.list.keys.include? blank_db_shard_key
110
+ end
111
+
103
112
  end
104
113
  end
105
114
 
@@ -1,3 +1,3 @@
1
1
  module Shards
2
- VERSION = "2.3.4"
2
+ VERSION = "2.4.0"
3
3
  end
@@ -223,7 +223,6 @@ module Shards
223
223
  end
224
224
 
225
225
  def create_database
226
- stage.shard.db.blank_db = blank_db
227
226
  stage.shard.db.create dryrun: false
228
227
  message_params= [stage.shard.db.name, stage.shard.db.server]
229
228
  raise_wrong_text message_params unless stage.shard.db.exist?
@@ -261,10 +260,16 @@ module Shards
261
260
  @stage=location.stages[st]
262
261
  end
263
262
 
263
+ def validate_blank_db_shard
264
+ raise_wrong_text stage.blank_db_shard_key unless stage.blank_db_shard_exist?
265
+ output_message step['message'] % stage.blank_db_shard_key
266
+ end
267
+
264
268
  def ask_blank_db
265
269
  shards=stage.shard.list.keys
266
270
  choose_one "Databases:", shards
267
271
  @blank_db=shards[answer.to_i]
272
+ stage.chosen_blank_db=blank_db
268
273
  end
269
274
 
270
275
  def add_ask_blank_db_step
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shards
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.4
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Diego PL
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-11-06 00:00:00.000000000 Z
11
+ date: 2018-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler