shards 2.2.2.pre.test → 2.2.3.pre.test
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -3
- data/lib/shards/version.rb +1 -1
- data/lib/shards/workflow/delete_by_api.rb +33 -23
- data/lib/shards/workflow/delete_by_terminal.rb +38 -28
- 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: 2c41ffbf864c292d3d8ca3c86b1bda3cfd7d0a66
|
4
|
+
data.tar.gz: 8916a933344b218f9e9d1312d4bf9d1c47a0c43d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85ae0726ea06b8139ec2ae4456a99acc7b26b19270b11e495dac651d000d62188ca4ddca364976299f3c43d485da72c70ac2c67ef277af908558f453e3c13f62
|
7
|
+
data.tar.gz: 91907e6668a4fade559924f99fbc216aed6c5d19cabdf8151a4f4cb939335fd42af48263d5116f3c931fe3e3d576ba327c8dcce3a5e341cf457cdb24d406b41e
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
shards (2.2.
|
4
|
+
shards (2.2.3.pre.test)
|
5
5
|
aws-sdk-ec2 (~> 1.48)
|
6
6
|
aws-sdk-elasticloadbalancing (~> 1.5)
|
7
7
|
aws-sdk-elasticloadbalancingv2 (~> 1.14)
|
@@ -25,12 +25,12 @@ GEM
|
|
25
25
|
thor (~> 0.19)
|
26
26
|
aws-eventstream (1.0.1)
|
27
27
|
aws-partitions (1.105.0)
|
28
|
-
aws-sdk-core (3.
|
28
|
+
aws-sdk-core (3.29.0)
|
29
29
|
aws-eventstream (~> 1.0)
|
30
30
|
aws-partitions (~> 1.0)
|
31
31
|
aws-sigv4 (~> 1.0)
|
32
32
|
jmespath (~> 1.0)
|
33
|
-
aws-sdk-ec2 (1.
|
33
|
+
aws-sdk-ec2 (1.50.0)
|
34
34
|
aws-sdk-core (~> 3, >= 3.26.0)
|
35
35
|
aws-sigv4 (~> 1.0)
|
36
36
|
aws-sdk-elasticloadbalancing (1.5.0)
|
data/lib/shards/version.rb
CHANGED
@@ -32,12 +32,16 @@ module Shards
|
|
32
32
|
site.subdomain_param=params[:subdomain]
|
33
33
|
site.delete
|
34
34
|
|
35
|
-
|
36
|
-
@shard_name= site.shard
|
37
|
-
shard.name_param = @shard_name
|
38
|
-
shard.delete
|
35
|
+
if site.select_by_shard.count<1
|
39
36
|
|
40
|
-
|
37
|
+
shard=Shards::Shard.new stage
|
38
|
+
@shard_name= site.shard
|
39
|
+
shard.name_param = @shard_name
|
40
|
+
shard.delete
|
41
|
+
|
42
|
+
@database_to_drop=shard.database['database']
|
43
|
+
|
44
|
+
end
|
41
45
|
|
42
46
|
end
|
43
47
|
|
@@ -51,32 +55,38 @@ module Shards
|
|
51
55
|
|
52
56
|
def delete_database
|
53
57
|
|
54
|
-
|
58
|
+
if database_to_drop
|
59
|
+
|
60
|
+
@db=Shards::Db.new stage: stage
|
55
61
|
|
56
|
-
|
62
|
+
db.database_to_drop=database_to_drop
|
57
63
|
|
58
|
-
|
64
|
+
raise "Database %s does is not in present db servers" % database_to_drop unless db.exist?(database_to_drop)
|
59
65
|
|
60
|
-
|
66
|
+
db.servers_to_drop.each do |host|
|
61
67
|
|
62
|
-
|
63
|
-
|
64
|
-
|
68
|
+
ouptput_message "Database:\t #{database_to_drop}"
|
69
|
+
ouptput_message "Host: \t #{host}"
|
70
|
+
ouptput_message "Do you want to delete the above database? (y) to confirm, another string to not."
|
65
71
|
|
66
|
-
|
72
|
+
answer=$stdin.gets
|
67
73
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
+
if answer.chomp.downcase=='y'
|
75
|
+
ouptput_message "DELETING database #{database_to_drop} in #{host}"
|
76
|
+
db.server=host
|
77
|
+
db.drop
|
78
|
+
else
|
79
|
+
ouptput_message "KEEP database #{database_to_drop} in #{host}"
|
80
|
+
end
|
81
|
+
ouptput_message "-" * 50
|
74
82
|
end
|
75
|
-
ouptput_message "-" * 50
|
76
|
-
end
|
77
83
|
|
78
|
-
|
79
|
-
|
84
|
+
raise_wrong_text database_to_drop if db.exist? database_to_drop
|
85
|
+
ouptput_message step['message'] % database_to_drop
|
86
|
+
|
87
|
+
else
|
88
|
+
output_message "The shard is in use by other site, will not be deleted"
|
89
|
+
end
|
80
90
|
end
|
81
91
|
|
82
92
|
private
|
@@ -37,12 +37,16 @@ module Shards
|
|
37
37
|
site.subdomain_param=params[:subdomain]
|
38
38
|
site.delete
|
39
39
|
|
40
|
-
|
41
|
-
@shard_name= site.shard
|
42
|
-
shard.name_param = @shard_name
|
43
|
-
shard.delete
|
40
|
+
if site.select_by_shard.count<1
|
44
41
|
|
45
|
-
|
42
|
+
shard=Shards::Shard.new stage
|
43
|
+
@shard_name= site.shard
|
44
|
+
shard.name_param = @shard_name
|
45
|
+
shard.delete
|
46
|
+
|
47
|
+
@database_to_drop=shard.database['database']
|
48
|
+
|
49
|
+
end
|
46
50
|
|
47
51
|
end
|
48
52
|
|
@@ -61,38 +65,44 @@ module Shards
|
|
61
65
|
|
62
66
|
def delete_database
|
63
67
|
|
64
|
-
|
68
|
+
if database_to_drop
|
69
|
+
|
70
|
+
@db=Shards::Db.new stage: stage
|
65
71
|
|
66
|
-
|
72
|
+
db.database_to_drop=database_to_drop
|
67
73
|
|
68
|
-
|
74
|
+
raise "Database %s does is not in present db servers" % database_to_drop unless db.exist?(database_to_drop)
|
69
75
|
|
70
|
-
|
76
|
+
db.servers_to_drop.each do |host|
|
71
77
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
78
|
+
puts
|
79
|
+
puts "Database:\t #{database_to_drop}"
|
80
|
+
puts "Host: \t #{host}"
|
81
|
+
puts
|
82
|
+
puts "Do you want to delete the above database? (y) to confirm, another string to not."
|
77
83
|
|
78
|
-
|
84
|
+
answer=$stdin.gets
|
79
85
|
|
80
|
-
|
86
|
+
puts
|
81
87
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
+
if answer.chomp.downcase=='y'
|
89
|
+
puts "DELETING database #{database_to_drop} in #{host}"
|
90
|
+
db.server=host
|
91
|
+
db.drop
|
92
|
+
else
|
93
|
+
puts "KEEP database #{database_to_drop} in #{host}"
|
94
|
+
end
|
95
|
+
puts
|
96
|
+
puts "-" * 50
|
97
|
+
puts
|
88
98
|
end
|
89
|
-
puts
|
90
|
-
puts "-" * 50
|
91
|
-
puts
|
92
|
-
end
|
93
99
|
|
94
|
-
|
95
|
-
|
100
|
+
raise_wrong_text database_to_drop if db.exist? database_to_drop
|
101
|
+
puts step['message'] % database_to_drop
|
102
|
+
|
103
|
+
else
|
104
|
+
puts "The shard is used in other site will not be deleted"
|
105
|
+
end
|
96
106
|
end
|
97
107
|
|
98
108
|
private
|