sumomo 0.8.17 → 0.8.21

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: 46ab2e171518c606e170495945ded07306818f92a87ed861ed1ff828f639a6ff
4
+ data.tar.gz: da07132440368143499523b7dc2bc601601a0b31079c7f524595c23673a898a9
5
5
  SHA512:
6
- metadata.gz: 948c3afa11295e67d58e4c487be8fd296026ff392f5da3c50d9c718875524c47dfeb76cea0ec00a6fc436844800aeea6a59d5d559193bc3016428e285d14d659
7
- data.tar.gz: 07f8164e9b86b8dcce2c50f9bec120078cb5cf2acf7b6a37e489972309e3e3aab6a55aba2bac70f057d8bde06e25f7c43d1bff0e793edc6eaf0b4e8b5989aef1
6
+ metadata.gz: 7e1b460d2434ca8bbd0d4e82aec0591f1b8d1fb6f70f899a5f4c73bda3126cfe4bb8176a54a36f884db5b6f1accf6c20e9cd6639a941304a1015c3e6ee122088
7
+ data.tar.gz: 18b4b61fca0334882e970210a284723f4036d6876c9028aa046d709bb5fc3500b8d51d3ca8d1a58804c1e9a06bb30f08c0cc33a5f6b6ee882597a60e4eba3c9b
@@ -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.21'
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.21
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