MovableInkAWS 2.0.0 → 2.2.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 +4 -4
- data/.github/workflows/test.yaml +39 -0
- data/Gemfile.lock +15 -15
- data/lib/movable_ink/aws.rb +1 -0
- data/lib/movable_ink/aws/ec2.rb +18 -24
- data/lib/movable_ink/aws/sns.rb +47 -35
- data/lib/movable_ink/consul/consul.rb +21 -0
- data/lib/movable_ink/version.rb +1 -1
- data/spec/consul_spec.rb +22 -0
- data/spec/ec2_spec.rb +71 -90
- data/spec/sns_spec.rb +1 -1
- metadata +6 -4
- data/.travis.yml +0 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7b1d77334dfeeb0283ce569cb62b7bce8a2518de96c73156f2b25693f0a2168
|
4
|
+
data.tar.gz: 56b60538a821c7fab3e55ad7ee0a80ac85312ff003521764e0721dcf86d5577c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4132433dd73377d07d141297180ec17f983c4f124811ef45e474a78aa31d493d44ec2df98ed393707d13b095821182e54fcbcf23eff61f924d915aaf4eec1edd
|
7
|
+
data.tar.gz: e317ad0ac916a54ffd6042310906310ea5be40f3b6b88f83b3f8c6b45364bcea3df1282c5106a5d9032cf1804137e1c03002fd0cbc7942142ca2f7ec45245798
|
@@ -0,0 +1,39 @@
|
|
1
|
+
name: test
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: ['**']
|
6
|
+
tags: ['v*']
|
7
|
+
pull_request:
|
8
|
+
branches: [$default-branch]
|
9
|
+
|
10
|
+
jobs:
|
11
|
+
test:
|
12
|
+
|
13
|
+
runs-on: ubuntu-18.04
|
14
|
+
|
15
|
+
steps:
|
16
|
+
- uses: actions/checkout@v2
|
17
|
+
|
18
|
+
- name: Install ruby
|
19
|
+
uses: ruby/setup-ruby@v1
|
20
|
+
with:
|
21
|
+
ruby-version: 2.6
|
22
|
+
|
23
|
+
- name: Install dependencies
|
24
|
+
run: bundle install --retry=3
|
25
|
+
|
26
|
+
- name: Run tests
|
27
|
+
run: bundle exec rspec spec/
|
28
|
+
|
29
|
+
- name: Publish to RubyGems
|
30
|
+
if: startsWith(github.ref, 'refs/tags/')
|
31
|
+
run: |
|
32
|
+
mkdir -p $HOME/.gem
|
33
|
+
touch $HOME/.gem/credentials
|
34
|
+
chmod 0600 $HOME/.gem/credentials
|
35
|
+
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
36
|
+
gem build *.gemspec
|
37
|
+
gem push *.gem
|
38
|
+
env:
|
39
|
+
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
MovableInkAWS (
|
4
|
+
MovableInkAWS (2.2.0)
|
5
5
|
aws-sdk-athena (~> 1)
|
6
6
|
aws-sdk-autoscaling (~> 1)
|
7
7
|
aws-sdk-cloudwatch (~> 1)
|
@@ -24,47 +24,47 @@ GEM
|
|
24
24
|
addressable (2.7.0)
|
25
25
|
public_suffix (>= 2.0.2, < 5.0)
|
26
26
|
aws-eventstream (1.1.0)
|
27
|
-
aws-partitions (1.
|
27
|
+
aws-partitions (1.416.0)
|
28
28
|
aws-sdk-athena (1.33.0)
|
29
29
|
aws-sdk-core (~> 3, >= 3.109.0)
|
30
30
|
aws-sigv4 (~> 1.1)
|
31
|
-
aws-sdk-autoscaling (1.
|
31
|
+
aws-sdk-autoscaling (1.53.0)
|
32
32
|
aws-sdk-core (~> 3, >= 3.109.0)
|
33
33
|
aws-sigv4 (~> 1.1)
|
34
|
-
aws-sdk-cloudwatch (1.
|
34
|
+
aws-sdk-cloudwatch (1.47.0)
|
35
35
|
aws-sdk-core (~> 3, >= 3.109.0)
|
36
36
|
aws-sigv4 (~> 1.1)
|
37
|
-
aws-sdk-core (3.
|
37
|
+
aws-sdk-core (3.111.0)
|
38
38
|
aws-eventstream (~> 1, >= 1.0.2)
|
39
39
|
aws-partitions (~> 1, >= 1.239.0)
|
40
40
|
aws-sigv4 (~> 1.1)
|
41
41
|
jmespath (~> 1.0)
|
42
|
-
aws-sdk-ec2 (1.
|
42
|
+
aws-sdk-ec2 (1.220.0)
|
43
43
|
aws-sdk-core (~> 3, >= 3.109.0)
|
44
44
|
aws-sigv4 (~> 1.1)
|
45
|
-
aws-sdk-eks (1.
|
45
|
+
aws-sdk-eks (1.46.0)
|
46
46
|
aws-sdk-core (~> 3, >= 3.109.0)
|
47
47
|
aws-sigv4 (~> 1.1)
|
48
|
-
aws-sdk-elasticache (1.
|
48
|
+
aws-sdk-elasticache (1.50.0)
|
49
49
|
aws-sdk-core (~> 3, >= 3.109.0)
|
50
50
|
aws-sigv4 (~> 1.1)
|
51
|
-
aws-sdk-kms (1.
|
51
|
+
aws-sdk-kms (1.41.0)
|
52
52
|
aws-sdk-core (~> 3, >= 3.109.0)
|
53
53
|
aws-sigv4 (~> 1.1)
|
54
|
-
aws-sdk-rds (1.
|
54
|
+
aws-sdk-rds (1.110.0)
|
55
55
|
aws-sdk-core (~> 3, >= 3.109.0)
|
56
56
|
aws-sigv4 (~> 1.1)
|
57
|
-
aws-sdk-route53 (1.
|
57
|
+
aws-sdk-route53 (1.45.0)
|
58
58
|
aws-sdk-core (~> 3, >= 3.109.0)
|
59
59
|
aws-sigv4 (~> 1.1)
|
60
|
-
aws-sdk-s3 (1.
|
60
|
+
aws-sdk-s3 (1.87.0)
|
61
61
|
aws-sdk-core (~> 3, >= 3.109.0)
|
62
62
|
aws-sdk-kms (~> 1)
|
63
63
|
aws-sigv4 (~> 1.1)
|
64
|
-
aws-sdk-sns (1.
|
64
|
+
aws-sdk-sns (1.36.0)
|
65
65
|
aws-sdk-core (~> 3, >= 3.109.0)
|
66
66
|
aws-sigv4 (~> 1.1)
|
67
|
-
aws-sdk-ssm (1.
|
67
|
+
aws-sdk-ssm (1.102.0)
|
68
68
|
aws-sdk-core (~> 3, >= 3.109.0)
|
69
69
|
aws-sigv4 (~> 1.1)
|
70
70
|
aws-sigv4 (1.2.2)
|
@@ -85,7 +85,7 @@ GEM
|
|
85
85
|
jmespath (1.4.0)
|
86
86
|
mime-types (3.3.1)
|
87
87
|
mime-types-data (~> 3.2015)
|
88
|
-
mime-types-data (3.2020.
|
88
|
+
mime-types-data (3.2020.1104)
|
89
89
|
multi_xml (0.6.0)
|
90
90
|
multipart-post (2.1.1)
|
91
91
|
public_suffix (4.0.5)
|
data/lib/movable_ink/aws.rb
CHANGED
data/lib/movable_ink/aws/ec2.rb
CHANGED
@@ -112,47 +112,41 @@ module MovableInk
|
|
112
112
|
raise MovableInk::AWS::Errors::RoleNameRequiredError
|
113
113
|
end
|
114
114
|
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
end
|
115
|
+
consul_service_options = {
|
116
|
+
dc: datacenter(region: region),
|
117
|
+
stale: true,
|
118
|
+
cached: true,
|
119
|
+
passing: true,
|
120
|
+
}
|
121
|
+
consul_service_options[:node_meta] = "availability_zone:#{availability_zone}" unless availability_zone.nil?
|
123
122
|
|
124
|
-
|
123
|
+
# We replace underscores with dashes in the role name in order to comply with
|
124
|
+
# consul service naming conventions while still retaining the role name we use
|
125
|
+
# within MI configuration
|
126
|
+
Diplomat::Health.service(role.gsub('_', '-'), consul_service_options).map { |endpoint|
|
125
127
|
OpenStruct.new (
|
126
|
-
|
127
|
-
private_ip_address:
|
128
|
-
instance_id:
|
128
|
+
{
|
129
|
+
private_ip_address: endpoint.Node['Address'],
|
130
|
+
instance_id: endpoint.Node['Meta']['instance_id'],
|
129
131
|
tags: [
|
130
132
|
{
|
131
133
|
key: 'Name',
|
132
|
-
value:
|
134
|
+
value: endpoint.Node['Node']
|
133
135
|
},
|
134
136
|
{
|
135
137
|
key: 'mi:roles',
|
136
|
-
value:
|
138
|
+
value: endpoint.Node['Meta']['mi_roles']
|
137
139
|
},
|
138
140
|
{
|
139
141
|
key: 'mi:monitoring_roles',
|
140
|
-
value:
|
142
|
+
value: endpoint.Node['Meta']['mi_monitoring_roles']
|
141
143
|
}
|
142
144
|
],
|
143
145
|
placement: {
|
144
|
-
availability_zone:
|
146
|
+
availability_zone: endpoint.Node['Meta']['availability_zone']
|
145
147
|
}
|
146
148
|
})
|
147
149
|
}
|
148
|
-
|
149
|
-
if availability_zone
|
150
|
-
consul_instances.select { |consul_instance|
|
151
|
-
consul_instance.placement[:availability_zone] == availability_zone
|
152
|
-
}
|
153
|
-
else
|
154
|
-
consul_instances
|
155
|
-
end
|
156
150
|
end
|
157
151
|
|
158
152
|
def instances(role:, exclude_roles: [], region: my_region, availability_zone: nil, exact_match: false, use_cache: true, discovery_type: 'ec2')
|
data/lib/movable_ink/aws/sns.rb
CHANGED
@@ -29,42 +29,27 @@ module MovableInk
|
|
29
29
|
sleep seconds
|
30
30
|
end
|
31
31
|
|
32
|
-
def
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
summary = "Unable to drain NSQ for instance #{instance_id} in region #{region}"
|
40
|
-
|
41
|
-
# the PagerDuty integration key is added to the payload in the AWS integration
|
42
|
-
json_message = {
|
43
|
-
pagerduty: {
|
44
|
-
event_action: 'trigger',
|
45
|
-
payload: {
|
46
|
-
source: 'MovableInkAWS',
|
47
|
-
summary: summary,
|
48
|
-
timestamp: Time.now.utc.iso8601,
|
49
|
-
severity: 'error',
|
50
|
-
component: 'nsq',
|
51
|
-
group: 'nsq',
|
52
|
-
custom_details: {
|
53
|
-
InstanceId: instance_id,
|
54
|
-
},
|
55
|
-
},
|
56
|
-
dedup_key: "nsq-not-draining-#{instance_id}",
|
57
|
-
links: [{
|
58
|
-
href: "https://#{region}.console.aws.amazon.com/ec2/v2/home?region=#{region}#Instances:search=#{instance_id};sort=instanceId",
|
59
|
-
text: 'View Instance'
|
60
|
-
}],
|
61
|
-
}
|
62
|
-
}.to_json
|
63
|
-
|
32
|
+
def send_alert(
|
33
|
+
source: instance_id,
|
34
|
+
links: [],
|
35
|
+
custom_details: {},
|
36
|
+
summary:,
|
37
|
+
dedup_key:
|
38
|
+
)
|
64
39
|
run_with_backoff do
|
65
|
-
|
66
|
-
|
67
|
-
|
40
|
+
message_json = pd_message_json({
|
41
|
+
source: source,
|
42
|
+
summary: summary,
|
43
|
+
links: links,
|
44
|
+
custom_details: custom_details,
|
45
|
+
dedup_key: dedup_key,
|
46
|
+
})
|
47
|
+
|
48
|
+
sns.publish({
|
49
|
+
topic_arn: sns_pagerduty_topic_arn,
|
50
|
+
subject: summary,
|
51
|
+
message: message_json
|
52
|
+
})
|
68
53
|
end
|
69
54
|
end
|
70
55
|
|
@@ -78,6 +63,33 @@ module MovableInk
|
|
78
63
|
message: "#{required_info}\n#{message}")
|
79
64
|
end
|
80
65
|
end
|
66
|
+
|
67
|
+
private
|
68
|
+
|
69
|
+
def pd_message_json(
|
70
|
+
source:,
|
71
|
+
summary:,
|
72
|
+
links:,
|
73
|
+
custom_details:,
|
74
|
+
dedup_key:
|
75
|
+
)
|
76
|
+
{
|
77
|
+
pagerduty: {
|
78
|
+
event_action: 'trigger',
|
79
|
+
payload: {
|
80
|
+
source: source,
|
81
|
+
summary: summary,
|
82
|
+
timestamp: Time.now.utc.iso8601,
|
83
|
+
severity: 'error',
|
84
|
+
component: source,
|
85
|
+
group: source,
|
86
|
+
custom_details: custom_details,
|
87
|
+
},
|
88
|
+
dedup_key: dedup_key,
|
89
|
+
links: links,
|
90
|
+
}
|
91
|
+
}.to_json
|
92
|
+
end
|
81
93
|
end
|
82
94
|
end
|
83
95
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'diplomat'
|
2
|
+
|
3
|
+
Diplomat.configure do |config|
|
4
|
+
config.url = "https://localhost:8501"
|
5
|
+
config.options = { ssl: { verify: false } }
|
6
|
+
end
|
7
|
+
|
8
|
+
module MovableInk
|
9
|
+
module Consul
|
10
|
+
module Kv
|
11
|
+
def self.get(*args)
|
12
|
+
begin
|
13
|
+
result = Diplomat::Kv.get(*args)
|
14
|
+
JSON.parse(result) if !result.nil?
|
15
|
+
rescue JSON::ParserError
|
16
|
+
result
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/movable_ink/version.rb
CHANGED
data/spec/consul_spec.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require_relative '../lib/movable_ink/aws'
|
2
|
+
require 'webmock/rspec'
|
3
|
+
|
4
|
+
describe MovableInk::Consul do
|
5
|
+
describe MovableInk::Consul::Kv do
|
6
|
+
it 'get returns a hash of json content' do
|
7
|
+
allow(Diplomat::Kv).to receive(:get).and_return({ hello: 'world' }.to_json)
|
8
|
+
expect(MovableInk::Consul::Kv.get('ham')).to eq({ 'hello' => 'world' })
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'returns a string if the stored value is not json' do
|
12
|
+
value = 'some-database-password'
|
13
|
+
allow(Diplomat::Kv).to receive(:get).and_return(value)
|
14
|
+
expect(MovableInk::Consul::Kv.get('db_password')).to eq(value)
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'forwards all arguments to Diplomat' do
|
18
|
+
expect(Diplomat::Kv).to receive(:get).with('foo/', recurse: true)
|
19
|
+
MovableInk::Consul::Kv.get('foo/', recurse: true)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/spec/ec2_spec.rb
CHANGED
@@ -312,93 +312,78 @@ describe MovableInk::AWS::EC2 do
|
|
312
312
|
let(:my_datacenter) { 'iad' }
|
313
313
|
let(:other_availability_zone) { 'us-east-1b' }
|
314
314
|
let(:consul_app_service_instances) {
|
315
|
-
[
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
315
|
+
[{
|
316
|
+
Node: {
|
317
|
+
Node: 'app_instance1',
|
318
|
+
Address: '10.0.0.1',
|
319
|
+
Datacenter: my_datacenter,
|
320
|
+
Meta: {
|
321
|
+
availability_zone: my_availability_zone,
|
322
|
+
instance_id: 'i-12345',
|
323
|
+
mi_monitoring_roles: 'app',
|
324
|
+
mi_roles: 'app'
|
325
|
+
},
|
326
|
+
ServiceID: 'app',
|
327
|
+
ServiceName: 'app',
|
328
|
+
ServiceTags: ['foo', 'bar'],
|
329
|
+
ServicePort: 80,
|
330
|
+
}
|
331
|
+
},
|
332
|
+
{
|
333
|
+
Node: {
|
334
|
+
Node: 'app_instance2',
|
335
|
+
Address: '10.0.0.2',
|
336
|
+
Datacenter: my_datacenter,
|
337
|
+
Meta: {
|
338
|
+
availability_zone: my_availability_zone,
|
339
|
+
instance_id: 'i-54321',
|
340
|
+
mi_monitoring_roles: 'app',
|
341
|
+
mi_roles: 'app'
|
342
|
+
},
|
343
|
+
ServiceID: 'app',
|
344
|
+
ServiceName: 'app',
|
345
|
+
ServiceTags: ['foo', 'bar'],
|
346
|
+
ServicePort: 80,
|
347
|
+
}
|
348
|
+
}]
|
349
349
|
}
|
350
350
|
|
351
351
|
let(:consul_ojos_service_instances) {
|
352
352
|
[
|
353
|
-
|
354
|
-
Node:
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
},
|
369
|
-
{
|
370
|
-
Node: 'ojos_instance2',
|
371
|
-
Address: '10.0.0.4',
|
372
|
-
Datacenter: my_datacenter,
|
373
|
-
NodeMeta:
|
374
|
-
{
|
375
|
-
availability_zone: other_availability_zone,
|
376
|
-
instance_id: 'i-zyx987',
|
377
|
-
mi_monitoring_roles: 'ojos',
|
378
|
-
mi_roles: 'ojos'
|
379
|
-
},
|
380
|
-
ServiceID: 'ojos',
|
381
|
-
ServiceName: 'ojos',
|
382
|
-
ServiceTags: ['foo', 'bar'],
|
383
|
-
ServicePort: 2702,
|
384
|
-
},
|
385
|
-
{
|
386
|
-
Node: 'ojos_instance3',
|
387
|
-
Address: '10.0.0.5',
|
388
|
-
Datacenter: my_datacenter,
|
389
|
-
NodeMeta:
|
390
|
-
{
|
391
|
-
availability_zone: other_availability_zone,
|
392
|
-
instance_id: 'i-987654',
|
393
|
-
mi_monitoring_roles: 'ojos',
|
394
|
-
mi_roles: 'ojos'
|
353
|
+
{
|
354
|
+
Node: {
|
355
|
+
Node: 'ojos_instance2',
|
356
|
+
Address: '10.0.0.4',
|
357
|
+
Datacenter: my_datacenter,
|
358
|
+
Meta: {
|
359
|
+
availability_zone: other_availability_zone,
|
360
|
+
instance_id: 'i-zyx987',
|
361
|
+
mi_monitoring_roles: 'ojos',
|
362
|
+
mi_roles: 'ojos'
|
363
|
+
},
|
364
|
+
ServiceID: 'ojos',
|
365
|
+
ServiceName: 'ojos',
|
366
|
+
ServiceTags: ['foo', 'bar'],
|
367
|
+
ServicePort: 2702,
|
395
368
|
},
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
369
|
+
},
|
370
|
+
{
|
371
|
+
Node: {
|
372
|
+
Node: 'ojos_instance3',
|
373
|
+
Address: '10.0.0.5',
|
374
|
+
Datacenter: my_datacenter,
|
375
|
+
Meta: {
|
376
|
+
availability_zone: other_availability_zone,
|
377
|
+
instance_id: 'i-987654',
|
378
|
+
mi_monitoring_roles: 'ojos',
|
379
|
+
mi_roles: 'ojos'
|
380
|
+
},
|
381
|
+
ServiceID: 'ojos',
|
382
|
+
ServiceName: 'ojos',
|
383
|
+
ServiceTags: ['foo', 'bar'],
|
384
|
+
ServicePort: 2702,
|
385
|
+
}
|
386
|
+
}]
|
402
387
|
}
|
403
388
|
|
404
389
|
before(:each) do
|
@@ -412,16 +397,12 @@ describe MovableInk::AWS::EC2 do
|
|
412
397
|
expect{ aws.instances(role: nil, discovery_type: 'consul') }.to raise_error(MovableInk::AWS::Errors::RoleNameRequiredError)
|
413
398
|
end
|
414
399
|
|
415
|
-
it "returns an error if an invalid role is passed" do
|
416
|
-
expect{ aws.instances(role: 'asset_proxy', discovery_type: 'consul') }.to raise_error(MovableInk::AWS::Errors::RoleNameInvalidError)
|
417
|
-
end
|
418
|
-
|
419
400
|
it "returns all instances matching a consul service" do
|
420
401
|
miaws = double(MovableInk::AWS)
|
421
402
|
allow(miaws).to receive(:my_region).and_return('us-east-1')
|
422
403
|
|
423
404
|
json = JSON.generate(consul_app_service_instances)
|
424
|
-
stub_request(:get, "https://localhost:8501/v1/
|
405
|
+
stub_request(:get, "https://localhost:8501/v1/health/service/app?cached&dc=#{my_datacenter}&passing&stale").
|
425
406
|
with(
|
426
407
|
headers: {
|
427
408
|
'Accept'=>'*/*',
|
@@ -434,7 +415,7 @@ describe MovableInk::AWS::EC2 do
|
|
434
415
|
expect(app_instances.map{|i| i.tags.first[:value]}).to eq(['app_instance1', 'app_instance2'])
|
435
416
|
|
436
417
|
json = JSON.generate(consul_ojos_service_instances)
|
437
|
-
stub_request(:get, "https://localhost:8501/v1/
|
418
|
+
stub_request(:get, "https://localhost:8501/v1/health/service/ojos?cached&dc=#{my_datacenter}&passing&stale").
|
438
419
|
with(
|
439
420
|
headers: {
|
440
421
|
'Accept'=>'*/*',
|
@@ -444,7 +425,7 @@ describe MovableInk::AWS::EC2 do
|
|
444
425
|
to_return(status: 200, body: json, headers: {})
|
445
426
|
|
446
427
|
ojos_instances = aws.instances(role: 'ojos', discovery_type: 'consul')
|
447
|
-
expect(ojos_instances.map{|i| i.tags.first[:value ]}).to eq(['
|
428
|
+
expect(ojos_instances.map{|i| i.tags.first[:value ]}).to eq(['ojos_instance2', 'ojos_instance3'])
|
448
429
|
end
|
449
430
|
|
450
431
|
it "returns all instances matching a consul service filtered by availability_zone" do
|
@@ -452,7 +433,7 @@ describe MovableInk::AWS::EC2 do
|
|
452
433
|
allow(miaws).to receive(:my_region).and_return('us-east-1')
|
453
434
|
|
454
435
|
json = JSON.generate(consul_ojos_service_instances)
|
455
|
-
stub_request(:get, "https://localhost:8501/v1/
|
436
|
+
stub_request(:get, "https://localhost:8501/v1/health/service/ojos?cached&dc=#{my_datacenter}&node-meta=availability_zone:#{other_availability_zone}&passing&stale").
|
456
437
|
with(
|
457
438
|
headers: {
|
458
439
|
'Accept'=>'*/*',
|
data/spec/sns_spec.rb
CHANGED
@@ -47,7 +47,7 @@ describe MovableInk::AWS::SNS do
|
|
47
47
|
allow(aws).to receive(:sns).and_return(sns)
|
48
48
|
allow(aws).to receive(:private_ipv4).and_return('10.0.0.1')
|
49
49
|
|
50
|
-
expect(aws.
|
50
|
+
expect(aws.send_alert(summary: 'Something bad happened', dedup_key: 'i-987654321').message_id).to eq('messageId')
|
51
51
|
end
|
52
52
|
|
53
53
|
it "should truncate subjects longer than 100 characters" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: MovableInkAWS
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Chesler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-core
|
@@ -227,7 +227,7 @@ extensions: []
|
|
227
227
|
extra_rdoc_files: []
|
228
228
|
files:
|
229
229
|
- ".github/workflows/pr-lint.yaml"
|
230
|
-
- ".
|
230
|
+
- ".github/workflows/test.yaml"
|
231
231
|
- Gemfile
|
232
232
|
- Gemfile.lock
|
233
233
|
- MovableInkAWS.gemspec
|
@@ -246,9 +246,11 @@ files:
|
|
246
246
|
- lib/movable_ink/aws/s3.rb
|
247
247
|
- lib/movable_ink/aws/sns.rb
|
248
248
|
- lib/movable_ink/aws/ssm.rb
|
249
|
+
- lib/movable_ink/consul/consul.rb
|
249
250
|
- lib/movable_ink/version.rb
|
250
251
|
- spec/autoscaling_spec.rb
|
251
252
|
- spec/aws_spec.rb
|
253
|
+
- spec/consul_spec.rb
|
252
254
|
- spec/ec2_spec.rb
|
253
255
|
- spec/elasticache_spec.rb
|
254
256
|
- spec/metadata_spec.rb
|
@@ -274,7 +276,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
274
276
|
- !ruby/object:Gem::Version
|
275
277
|
version: '0'
|
276
278
|
requirements: []
|
277
|
-
rubygems_version: 3.0.
|
279
|
+
rubygems_version: 3.0.3
|
278
280
|
signing_key:
|
279
281
|
specification_version: 4
|
280
282
|
summary: AWS Utility methods for MovableInk
|
data/.travis.yml
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
|
3
|
-
rvm:
|
4
|
-
- 2.6
|
5
|
-
|
6
|
-
bundler_args: "--retry=3"
|
7
|
-
|
8
|
-
script:
|
9
|
-
- rspec spec/
|
10
|
-
|
11
|
-
deploy:
|
12
|
-
provider: rubygems
|
13
|
-
api_key:
|
14
|
-
secure: NAHVFo9MwOnAYhq1NzZz22/2p34Iw/L71ZNt2WHSbWuMVnA/xyvVu7Ja/S25aQmaV/btNkxTYtbJbf83QZTO9/IwkashWFcWJtLiptZkBRdpkiunMPWX9Gw3Ap5fODUIPxLFyLYWd53huNBJppBCVQTUPwkLEcWJcQZP4MU7dkhW5QKdQgmyNTlMy8epxyMqCQe7V0n98LCwreUsHxHMToe6/V0FemysjYjpnyNvcFpGFa9kf28VQw8ZpDR0iobw9hg6qs61Xj69Y3ns9fWI3sdnk8VjY29M+V415/ksyn7kzCjYiQsGGCFerzjMffIt/4PXqX81GRvcymxmpXWwtikJYP95kiHYbLGFUNS5GJngbyVgO5+amjx7vSZfaBGSXcUCSkxLV1Ki4QfMYnA4ihogwTdQhIALSEV9GzOfFt147lUok2LgZDzNfn9nCPL+qKMBNaBRe7/YoWGuvLQG/smYjunPYhis0ynAQ1Sytc7lgtbdEtLFzfET87ITVS4Y2F9TQ+z1fxROAn/YwMmdSPyiaXVLEOIUc/gx0BjJneTl43M4l6ZId8Q6maJTNG2Fd0yK0hwLJcsN/257HbnPEiTTgkXBcg58E6/ABfZqwDnJrP3sQPem85M4BxLJIPUvfBkYzyeAEV+ALYDJx+KLaqYCCgavF9M+41VbkkNZyKU=
|
15
|
-
gem: MovableInkAWS
|
16
|
-
on:
|
17
|
-
tags: true
|
18
|
-
repo: movableink/awslib
|