shards 3.3 → 3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/lib/settings/workflows/create_by_api.yaml +3 -0
- data/lib/settings/workflows/delete_by_api.yaml +3 -0
- data/lib/settings/workflows/delete_by_terminal.yaml +1 -0
- data/lib/settings/workflows/fast_terminal.yaml +1 -0
- data/lib/settings/workflows/fast_terminal_two.yaml +3 -0
- data/lib/settings/workflows/fingerprints_by_api.yaml +6 -0
- data/lib/settings/workflows/fingerprints_terminal.yaml +4 -0
- data/lib/settings/workflows/fingerprints_terminal_two.yaml +1 -0
- data/lib/settings/workflows/reload_by_api.yaml +4 -0
- data/lib/shards/client.rb +24 -0
- data/lib/shards/version.rb +1 -1
- data/lib/shards/workflow/base.rb +81 -2
- 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: 320ece700811e52b39ec9fa674dcfd15931eda715e56a1feaf753737d80e2308
|
4
|
+
data.tar.gz: 87b7124eb6879b2f904842c6d07d641b2f070144fb2a73162d27072882b6341b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 601e021902dc07f7bcb031fd148d646c2f1e1cd1cc7c486db9bd6001b1255d5750632b3c19fab30805a1623c19126c61a8c0edf7e94148eaf6f278402d8b009d
|
7
|
+
data.tar.gz: 56e5b9760062b62ff658387685f5bbf16fc87231b102816c14b9c8a8059bf737708f80dbab577ddd8229ccf099735a9070fec8402732ead6a0d1c639a9de515a
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
shards (3.
|
4
|
+
shards (3.5)
|
5
5
|
aws-sdk-ec2 (~> 1.48)
|
6
6
|
aws-sdk-elasticloadbalancing (~> 1.5)
|
7
7
|
aws-sdk-elasticloadbalancingv2 (~> 1.14)
|
@@ -30,7 +30,7 @@ GEM
|
|
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.71.0)
|
34
34
|
aws-sdk-core (~> 3, >= 3.39.0)
|
35
35
|
aws-sigv4 (~> 1.0)
|
36
36
|
aws-sdk-elasticloadbalancing (1.8.0)
|
@@ -45,3 +45,6 @@ correct_steps_summary:
|
|
45
45
|
- commit_changes
|
46
46
|
|
47
47
|
start: validate_location
|
48
|
+
description: >
|
49
|
+
This workflow is the first that the *Site Deletion* job runs in the shards service application.
|
50
|
+
Then the application will run the Reload by API workflow to run the puppet agent, check fingerprints, reload task and then delete the database.
|
@@ -46,3 +46,9 @@ correct_steps_summary:
|
|
46
46
|
- dns_upsert
|
47
47
|
|
48
48
|
start: validate_client
|
49
|
+
description: >
|
50
|
+
This is the second workflow that the *Site Creation* job call after the Create By API.
|
51
|
+
The application run this workflow in a loop.
|
52
|
+
When the fingerprints don't match the puppet agent will be executed in order to update the shards and sites yml files.
|
53
|
+
The loop finish when the fingerprints are the same.
|
54
|
+
Then run the application reload shard task to upgrade the shards and sites data.
|
@@ -40,3 +40,7 @@ correct_steps_summary:
|
|
40
40
|
- dns_upsert
|
41
41
|
|
42
42
|
start: validate_client
|
43
|
+
description: |
|
44
|
+
This workflow is used by the shards gem command tool in the check_fingerprints command.
|
45
|
+
It will run the puppet agent in a loop when the fingerprints don't match.
|
46
|
+
Once the fingerprints match continue with reload shards task and a dns uspsert.
|
@@ -52,3 +52,7 @@ correct_steps_summary:
|
|
52
52
|
- delete_database
|
53
53
|
|
54
54
|
start: validate_client
|
55
|
+
description: |
|
56
|
+
This workflow will be executed after the *delete by api* worflow in the *Site Deletion* job.
|
57
|
+
When the fingerprints match the application reload task will be executed.
|
58
|
+
The final step is delete the database.
|
data/lib/shards/client.rb
CHANGED
@@ -230,6 +230,30 @@ module Shards
|
|
230
230
|
puts s.check_remote_process remote_check: :reload_shards!
|
231
231
|
|
232
232
|
end
|
233
|
+
|
234
|
+
desc "workflows", "Show the workflow list"
|
235
|
+
|
236
|
+
def workflows
|
237
|
+
Dotenv.load 'settings.env'
|
238
|
+
settings_files= Dir.entries(ENV['WORKFLOW_YAML_PATH']).reject { |x| %w(. .. base.yaml).include?x }.sort
|
239
|
+
puts settings_files.map { |x| x.chomp '.yaml' }
|
240
|
+
end
|
241
|
+
|
242
|
+
desc "workflow_steps", "Print the workflow steps"
|
243
|
+
option :name, required: true, desc: "workflow name"
|
244
|
+
|
245
|
+
def workflow_steps
|
246
|
+
|
247
|
+
name=options[:name].split('_').map { |x| x.capitalize }.join
|
248
|
+
|
249
|
+
wf=Kernel.const_get("Shards::Workflow::#{name}").new config
|
250
|
+
|
251
|
+
wf.print_description
|
252
|
+
wf.print_step
|
253
|
+
wf.print_extra_steps
|
254
|
+
|
255
|
+
end
|
256
|
+
|
233
257
|
private
|
234
258
|
|
235
259
|
def config
|
data/lib/shards/version.rb
CHANGED
data/lib/shards/workflow/base.rb
CHANGED
@@ -66,14 +66,18 @@ module Shards
|
|
66
66
|
gsub(/\s/, '_').downcase
|
67
67
|
end
|
68
68
|
|
69
|
-
def
|
69
|
+
def flow_init
|
70
70
|
@flow=shared_steps.merge yaml[wf]
|
71
|
+
end
|
72
|
+
|
73
|
+
def start
|
74
|
+
flow_init
|
71
75
|
@pointer=yaml['start']
|
72
76
|
run_step
|
73
77
|
end
|
74
78
|
|
75
79
|
def start_at pointer_step
|
76
|
-
|
80
|
+
flow_init
|
77
81
|
@pointer=pointer_step
|
78
82
|
run_step
|
79
83
|
end
|
@@ -98,6 +102,81 @@ module Shards
|
|
98
102
|
|
99
103
|
end
|
100
104
|
|
105
|
+
def correct_steps
|
106
|
+
@correct_steps||={}
|
107
|
+
end
|
108
|
+
|
109
|
+
def wrong_steps
|
110
|
+
@wrong_steps||={}
|
111
|
+
end
|
112
|
+
|
113
|
+
def print_step
|
114
|
+
|
115
|
+
if pointer.nil?
|
116
|
+
flow_init
|
117
|
+
@pointer=yaml['start']
|
118
|
+
puts "h2. Step List"
|
119
|
+
end
|
120
|
+
|
121
|
+
@step=flow[pointer]
|
122
|
+
@pointer_history << pointer
|
123
|
+
|
124
|
+
puts_step pointer, step
|
125
|
+
|
126
|
+
correct_steps[step['correct']]=flow[step['correct']]
|
127
|
+
wrong_steps[step['wrong']]=flow[step['wrong']] unless step['wrong'].nil?
|
128
|
+
@pointer=step['correct']
|
129
|
+
print_step if @step['correct']!='final_step'
|
130
|
+
|
131
|
+
end
|
132
|
+
|
133
|
+
def wf_title
|
134
|
+
wf.split('_').map { |x| x.capitalize }.join(' ')
|
135
|
+
end
|
136
|
+
|
137
|
+
def print_description
|
138
|
+
puts "h1. #{wf_title}"
|
139
|
+
puts yaml['description'] if yaml.has_key?('description')
|
140
|
+
end
|
141
|
+
|
142
|
+
def puts_step pointer, step
|
143
|
+
|
144
|
+
puts "|| #{pointer} "
|
145
|
+
puts " - Correct => #{step['correct']}" if step.has_key?('correct')
|
146
|
+
puts " - Wrong => #{step['wrong']}" if step.has_key?('wrong')
|
147
|
+
puts "|"
|
148
|
+
puts
|
149
|
+
|
150
|
+
end
|
151
|
+
|
152
|
+
def print_extra_steps
|
153
|
+
(wrong_steps.keys & correct_steps.keys).each { |k| wrong_steps.delete k }
|
154
|
+
|
155
|
+
loop do
|
156
|
+
initial_keys=wrong_steps.keys + correct_steps.keys
|
157
|
+
new_keys=[]
|
158
|
+
|
159
|
+
wrong_steps.each_pair do |k,v|
|
160
|
+
new_keys << v['correct'] if v.has_key?('correct') and !initial_keys.include?v['correct']
|
161
|
+
new_keys << v['wrong'] if v.has_key?('wrong') and !initial_keys.include?v['wrong']
|
162
|
+
end
|
163
|
+
if new_keys.empty?
|
164
|
+
break
|
165
|
+
else
|
166
|
+
new_keys.each do |k|
|
167
|
+
wrong_steps[k]=flow[k]
|
168
|
+
end
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
puts "h2. Additional Steps:" unless wrong_steps.empty?
|
173
|
+
|
174
|
+
wrong_steps.each_pair do |k,v|
|
175
|
+
puts_step k, v
|
176
|
+
end
|
177
|
+
|
178
|
+
end
|
179
|
+
|
101
180
|
def output_message message
|
102
181
|
puts message
|
103
182
|
end
|
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: '3.
|
4
|
+
version: '3.5'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Diego PL
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-03-
|
11
|
+
date: 2019-03-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|