shards 2.2.2.pre.test → 2.2.3.pre.test

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: bae1a3defedebbb797e8d968f676f0e9637d21fa
4
- data.tar.gz: 837aeb01e735d6a24d7a5ab96d217d4efbcdeac8
3
+ metadata.gz: 2c41ffbf864c292d3d8ca3c86b1bda3cfd7d0a66
4
+ data.tar.gz: 8916a933344b218f9e9d1312d4bf9d1c47a0c43d
5
5
  SHA512:
6
- metadata.gz: e4e7a335292840e88b71c8e8bbe8cce042400e16f4500737c0a9b62eee7f4bb6efb25397ac9cfa642d39343d772d08ae399a58c4f90dd88341aafe0493439be2
7
- data.tar.gz: 12f39de20ac2ffccf73395d6e4f6094fbb9939469ce66c4c733649996dc6510374ac41624afc319f7fd0978f89b024f3646327ea38150a039af66fc5384af335
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.2.pre.test)
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.0)
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.49.0)
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)
@@ -1,3 +1,3 @@
1
1
  module Shards
2
- VERSION = "2.2.2-test"
2
+ VERSION = "2.2.3-test"
3
3
  end
@@ -32,12 +32,16 @@ module Shards
32
32
  site.subdomain_param=params[:subdomain]
33
33
  site.delete
34
34
 
35
- shard=Shards::Shard.new stage
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
- @database_to_drop=shard.database['database']
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
- @db=Shards::Db.new stage: stage
58
+ if database_to_drop
59
+
60
+ @db=Shards::Db.new stage: stage
55
61
 
56
- db.database_to_drop=database_to_drop
62
+ db.database_to_drop=database_to_drop
57
63
 
58
- raise "Database %s does is not in present db servers" % database_to_drop unless db.exist?(database_to_drop)
64
+ raise "Database %s does is not in present db servers" % database_to_drop unless db.exist?(database_to_drop)
59
65
 
60
- db.servers_to_drop.each do |host|
66
+ db.servers_to_drop.each do |host|
61
67
 
62
- ouptput_message "Database:\t #{database_to_drop}"
63
- ouptput_message "Host: \t #{host}"
64
- ouptput_message "Do you want to delete the above database? (y) to confirm, another string to not."
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
- answer=$stdin.gets
72
+ answer=$stdin.gets
67
73
 
68
- if answer.chomp.downcase=='y'
69
- ouptput_message "DELETING database #{database_to_drop} in #{host}"
70
- db.server=host
71
- db.drop
72
- else
73
- ouptput_message "KEEP database #{database_to_drop} in #{host}"
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
- raise_wrong_text database_to_drop if db.exist? database_to_drop
79
- ouptput_message step['message'] % database_to_drop
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
- shard=Shards::Shard.new stage
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
- @database_to_drop=shard.database['database']
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
- @db=Shards::Db.new stage: stage
68
+ if database_to_drop
69
+
70
+ @db=Shards::Db.new stage: stage
65
71
 
66
- db.database_to_drop=database_to_drop
72
+ db.database_to_drop=database_to_drop
67
73
 
68
- raise "Database %s does is not in present db servers" % database_to_drop unless db.exist?(database_to_drop)
74
+ raise "Database %s does is not in present db servers" % database_to_drop unless db.exist?(database_to_drop)
69
75
 
70
- db.servers_to_drop.each do |host|
76
+ db.servers_to_drop.each do |host|
71
77
 
72
- puts
73
- puts "Database:\t #{database_to_drop}"
74
- puts "Host: \t #{host}"
75
- puts
76
- puts "Do you want to delete the above database? (y) to confirm, another string to not."
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
- answer=$stdin.gets
84
+ answer=$stdin.gets
79
85
 
80
- puts
86
+ puts
81
87
 
82
- if answer.chomp.downcase=='y'
83
- puts "DELETING database #{database_to_drop} in #{host}"
84
- db.server=host
85
- db.drop
86
- else
87
- puts "KEEP database #{database_to_drop} in #{host}"
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
- raise_wrong_text database_to_drop if db.exist? database_to_drop
95
- puts step['message'] % database_to_drop
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shards
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.2.pre.test
4
+ version: 2.2.3.pre.test
5
5
  platform: ruby
6
6
  authors:
7
7
  - Diego PL