sumomo 0.8.17 → 0.8.20

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 861b39ec9371ce0ecf43abc366deedd675c34e38e3489712797acb7231361c54
4
- data.tar.gz: a5411af6f6cb532a72c80ca5cf575e0ba5a2f1cce9ef7742e4a9d50ebfb704c6
3
+ metadata.gz: 35f25db9aa077d872665229ae4c73d9ca26756b1dd321c50fc5d71e42d091227
4
+ data.tar.gz: 6dd294034dcca5b060397c3452b144484cf017448c73a5f73e9b1f93d4fd4596
5
5
  SHA512:
6
- metadata.gz: 948c3afa11295e67d58e4c487be8fd296026ff392f5da3c50d9c718875524c47dfeb76cea0ec00a6fc436844800aeea6a59d5d559193bc3016428e285d14d659
7
- data.tar.gz: 07f8164e9b86b8dcce2c50f9bec120078cb5cf2acf7b6a37e489972309e3e3aab6a55aba2bac70f057d8bde06e25f7c43d1bff0e793edc6eaf0b4e8b5989aef1
6
+ metadata.gz: b6d83f89c5ff4f4a5b2a76dad74234faa148c38104e4155f34978aa072ee977d641b4084bdb5b31c5e501ef75747f6a14dbe92e117d2b085dc32591d36932e85
7
+ data.tar.gz: 7336f10b0bf428c5c327d14d9e12c33c5a02373cda72109cc17dadfcc8d47d7b55f0a183576d3896cfddcbbefea14a6bcd15ba3cadfe0e5b67394383800e2d55
@@ -0,0 +1,70 @@
1
+ var ec2 = new aws.EC2();
2
+ function success()
3
+ {
4
+ Cloudformation.send(
5
+ request,
6
+ context,
7
+ Cloudformation.SUCCESS,
8
+ {},
9
+ "Success",
10
+ request.ResourceProperties.SecurityGroups.join(','));
11
+ }
12
+
13
+ function fail(err)
14
+ {
15
+ console.log('Errored.');
16
+ console.log(err);
17
+ Cloudformation.send(
18
+ request,
19
+ context,
20
+ Cloudformation.FAILED,
21
+ {},
22
+ "Error: " + err
23
+ );
24
+ }
25
+
26
+ if (request.RequestType == "Create")
27
+ {
28
+ success()
29
+ }
30
+
31
+ if (request.RequestType == "Update")
32
+ {
33
+ success()
34
+ }
35
+
36
+ if (request.RequestType == "Delete")
37
+ {
38
+ var params = {
39
+ Filters: [
40
+ {
41
+ Name: 'group-id',
42
+ Values: request.ResourceProperties.SecurityGroups
43
+ },
44
+ {
45
+ Name: 'description',
46
+ Values: ['AWS Lambda VPC ENI: *']
47
+ }
48
+ ]
49
+ };
50
+ console.log("Deleting attachments!");
51
+
52
+ // Detach all network-interface attachments
53
+ ec2.describeNetworkInterfaces(params).promise().then(function(data) {
54
+ console.log("Got Interfaces:\n", JSON.stringify(data));
55
+ return Promise.all(data.NetworkInterfaces.map(function(networkInterface) {
56
+ var networkInterfaceId = networkInterface.NetworkInterfaceId;
57
+ var attachmentId = networkInterface.Attachment.AttachmentId;
58
+ return ec2.detachNetworkInterface({AttachmentId: attachmentId}).promise().then(function(data) {
59
+ return ec2.waitFor('networkInterfaceAvailable', {NetworkInterfaceIds: [networkInterfaceId]}).promise();
60
+ }).then(function(data) {
61
+ console.log("Detached Interface, deleting:\n", networkInterfaceId);
62
+ return ec2.deleteNetworkInterface({NetworkInterfaceId: networkInterfaceId}).promise();
63
+ });
64
+ }));
65
+ }).then(function(data) {
66
+ success()
67
+ }).catch(function(err) {
68
+ fail(err)
69
+ });
70
+ }
data/exe/sumomo CHANGED
@@ -62,7 +62,7 @@ cmd_opts = case cmd
62
62
  gsub(/(.{64}) /, "\\1\n")
63
63
  File.write('key.pem', key)
64
64
  `chmod 0600 key.pem`
65
- exec "ssh -i 'key.pem' ec2-user@#{ARGV[1]} #{ARGV[2]}"
65
+ exec "ssh -i -hostkey=* 'key.pem' ec2-user@#{ARGV[1]} #{ARGV[2]}"
66
66
 
67
67
  when 'testapi'
68
68
  local_opts = Trollop.options do
data/lib/sumomo/ec2.rb CHANGED
@@ -268,7 +268,7 @@ module Sumomo
268
268
  docker_password: '',
269
269
  eip: nil,
270
270
  policies: [],
271
- scalein_protection: true,
271
+ scalein_protection: false,
272
272
  &block
273
273
  )
274
274
 
data/lib/sumomo/stack.rb CHANGED
@@ -64,6 +64,10 @@ module Sumomo
64
64
  VpcId network.vpc
65
65
  end
66
66
 
67
+ make 'Custom::VPCDestroyENI' do
68
+ SecurityGroups [lambda_sec_group]
69
+ end
70
+
67
71
  subnetids = network.subnets[layer].map { |x| x[:name] }
68
72
  vpcconfig = {
69
73
  SecurityGroupIds: [lambda_sec_group],
@@ -84,10 +88,22 @@ module Sumomo
84
88
  Runtime runtime
85
89
  Timeout timeout
86
90
  Role role.Arn
87
- VpcConfig vpcconfig unless vpcconfig.nil?
91
+
88
92
  Environment do
89
93
  Variables env
90
94
  end
95
+
96
+ if !vpcconfig.nil?
97
+ VpcConfig vpcconfig
98
+
99
+ vpcconfig[:SecurityGroupIds].each do |x|
100
+ depends_on x
101
+ end
102
+
103
+ vpcconfig[:SubnetIds].each do |x|
104
+ depends_on x
105
+ end
106
+ end
91
107
  end
92
108
 
93
109
  if enable_logging
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Sumomo
4
- VERSION = '0.8.17'
4
+ VERSION = '0.8.20'
5
5
  end
data/lib/sumomo.rb CHANGED
@@ -117,10 +117,11 @@ module Sumomo
117
117
  stack_name: name,
118
118
  template_url: store.url('cloudformation/template'),
119
119
  parameters: hidden_values,
120
- disable_rollback: false,
121
120
  capabilities: ['CAPABILITY_IAM', 'CAPABILITY_NAMED_IAM']
122
121
  }
123
122
 
123
+ update_options[disable_rollback] = false if !changeset
124
+
124
125
  begin
125
126
  if changeset
126
127
  cf.create_change_set(
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sumomo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.17
4
+ version: 0.8.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Siaw
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-09-16 00:00:00.000000000 Z
11
+ date: 2022-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -2556,6 +2556,7 @@ files:
2556
2556
  - data/sumomo/custom_resources/OriginAccessIdentity.js
2557
2557
  - data/sumomo/custom_resources/SelectSpot.js
2558
2558
  - data/sumomo/custom_resources/TempS3Bucket.js
2559
+ - data/sumomo/custom_resources/VPCDestroyENI.js
2559
2560
  - data/sumomo/sources/spot-watcher-poller.sh
2560
2561
  - data/sumomo/sources/spot-watcher.sh
2561
2562
  - exe/sumomo