sumomo 0.8.6 → 0.8.7

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
  SHA256:
3
- metadata.gz: c26b0a3b7272251c44640055c93cd3e985c47d60abb14a14f50584eda5b65184
4
- data.tar.gz: c08fc6ccc59a029ab43ef96c4e2a5e687189300998aaa34b9fd417c276339488
3
+ metadata.gz: d12954eb075b3c25afec4ba1455de77317d36ccbd2c4a79ad54657f1d130688f
4
+ data.tar.gz: f4c056344d60a16fbc66892ba9573c5b60658ea66b4e23588e7b179d58546cf3
5
5
  SHA512:
6
- metadata.gz: '08aa5eda9cc8144d2c5df4ba8622f65bef1f2f66ae54e30538afe8e943325ffcbd1e151bef541d58e47637e64fa759e405e9b4b3011038340ccc720b595cd301'
7
- data.tar.gz: b74848ddce1200d78c020e56ff0fcff3625fe22b6195b8167ad6338bc66449e5fb1613f96042a4497f962e6e764a4b68a61eb2703610c1844e0da2df3897bed4
6
+ metadata.gz: be41e7ed63492155a08c6ce68c16f66952e11d52b66d3d886d240a4946fd64d9203d19815630fba2ca24034e6f1bda2847070741457f1143f8ce4238301c0de3
7
+ data.tar.gz: 572f764ae21888889ff48fdae709648d3df0c41242e878fb884a7c8f9df28ce8432cbcf77f2935dbbdfe2ed1d7620608d072dcb7d1af1c13d3fbfc0da07928e9
@@ -0,0 +1,25 @@
1
+ function success()
2
+ {
3
+ Cloudformation.send(
4
+ request,
5
+ context,
6
+ Cloudformation.SUCCESS,
7
+ {},
8
+ "Success",
9
+ request.ResourceProperties.Value);
10
+ }
11
+
12
+ if (request.RequestType == "Create")
13
+ {
14
+ success()
15
+ }
16
+
17
+ if (request.RequestType == "Update")
18
+ {
19
+ success()
20
+ }
21
+
22
+ if (request.RequestType == "Delete")
23
+ {
24
+ success()
25
+ }
@@ -4,7 +4,7 @@ var copy_from_dir = request.ResourceProperties.CopyFromDirectory;
4
4
  var copy_from_bucket = request.ResourceProperties.CopyFromBucket;
5
5
  var success_obj = {
6
6
  Arn: "arn:aws:s3:::" + name,
7
- DomainName: name + ".s3.amazonaws.com"
7
+ DomainName: name + ".s3-" + request.ResourceProperties.Region + ".amazonaws.com"
8
8
  }
9
9
  var error_extra = "";
10
10
 
@@ -74,7 +74,12 @@ function copy_files(success, fail)
74
74
 
75
75
  function create_bucket(name, success, fail)
76
76
  {
77
- var create_params = { Bucket: name };
77
+ var create_params = {
78
+ Bucket: name,
79
+ CreateBucketConfiguration: {
80
+ LocationConstraint: request.ResourceProperties.Region
81
+ }
82
+ };
78
83
 
79
84
  s3.createBucket(create_params, function(err, data)
80
85
  {
@@ -1,5 +1,7 @@
1
1
  var acm = new aws.ACM({region: "us-east-1"}); // MUST be us-east-1.
2
2
 
3
+ var return_properties = {};
4
+
3
5
  function extractRootDomain(domain)
4
6
  {
5
7
  var splitArr = domain.split('.');
@@ -15,39 +17,46 @@ function extractRootDomain(domain)
15
17
 
16
18
  function wait_for_approval(domain_name, on_success, on_fail)
17
19
  {
18
- setTimeout(function()
20
+ get_domain(domain_name, function(data)
19
21
  {
20
- get_domain(domain_name, function(data)
21
- {
22
- var params = {
23
- CertificateArn: data.arn
24
- };
25
- acm.describeCertificate(params, function(err, cert_data) {
26
- if (err)
22
+ var params = {
23
+ CertificateArn: data.arn
24
+ };
25
+
26
+ acm.describeCertificate(params, function(err, cert_data) {
27
+ if (err)
28
+ {
29
+ on_fail(err);
30
+ }
31
+ else
32
+ {
33
+ // Do not wait if we requested DNS validation
34
+ if (request.ResourceProperties.ValidationMethod === "DNS")
35
+ {
36
+ return_properties.RecordName = cert_data.Certificate.DomainValidationOptions[0].ResourceRecord.Name;
37
+ return_properties.RecordType = cert_data.Certificate.DomainValidationOptions[0].ResourceRecord.Type;
38
+ return_properties.RecordValue = cert_data.Certificate.DomainValidationOptions[0].ResourceRecord.Value;
39
+ return on_success(data.arn);
40
+ }
41
+
42
+ if (cert_data.Certificate.DomainValidationOptions[0].ValidationStatus === "SUCCESS")
43
+ {
44
+ on_success(data.arn);
45
+ }
46
+ else if (cert_data.Certificate.DomainValidationOptions[0].ValidationStatus === "FAILED")
27
47
  {
28
- on_fail(err);
48
+ on_fail("Verification Failed");
29
49
  }
30
50
  else
31
51
  {
32
- if (cert_data.Certificate.DomainValidationOptions[0].ValidationStatus === "SUCCESS")
33
- {
34
- on_success(data.arn);
35
- }
36
- else if (cert_data.Certificate.DomainValidationOptions[0].ValidationStatus === "FAILED")
37
- {
38
- on_fail("Verification Failed");
39
- }
40
- else
52
+ setTimeout(function()
41
53
  {
42
54
  wait_for_approval(domain_name, on_success, on_fail);
43
- }
55
+ }, 3000);
44
56
  }
45
- });
46
-
47
- }, on_fail);
48
-
49
-
50
- }, 3000);
57
+ }
58
+ });
59
+ }, on_fail);
51
60
  }
52
61
 
53
62
  function create(domain_name, on_success, on_fail)
@@ -62,6 +71,11 @@ function create(domain_name, on_success, on_fail)
62
71
  ]
63
72
  }
64
73
 
74
+ if (request.ResourceProperties.ValidationMethod === "DNS")
75
+ {
76
+ params.ValidationMethod = "DNS";
77
+ }
78
+
65
79
  console.log("Requesting Cert");
66
80
  acm.requestCertificate(params, function(err, data)
67
81
  {
@@ -129,12 +143,11 @@ function fail(err)
129
143
  Cloudformation.send(request, context, Cloudformation.FAILED, {}, "Error: " + err);
130
144
  }
131
145
 
132
-
133
146
  if (request.RequestType == "Create")
134
147
  {
135
148
  create(request.ResourceProperties.DomainName, function(data)
136
149
  {
137
- Cloudformation.send(request, context, Cloudformation.SUCCESS, {}, "Success", data);
150
+ Cloudformation.send(request, context, Cloudformation.SUCCESS, return_properties, "Success", data);
138
151
  }, fail);
139
152
  }
140
153
 
@@ -144,14 +157,14 @@ if (request.RequestType == "Update")
144
157
  {
145
158
  create(request.ResourceProperties.DomainName, function(data)
146
159
  {
147
- Cloudformation.send(request, context, Cloudformation.SUCCESS, {}, "Success", data);
160
+ Cloudformation.send(request, context, Cloudformation.SUCCESS, return_properties, "Success", data);
148
161
  }, fail);
149
162
  }
150
163
  else
151
164
  {
152
165
  get_domain(function(data)
153
166
  {
154
- Cloudformation.send(request, context, Cloudformation.SUCCESS, {}, "Success", data.arn);
167
+ Cloudformation.send(request, context, Cloudformation.SUCCESS, return_properties, "Success", data.arn);
155
168
  }, fail);
156
169
  }
157
170
  }
@@ -160,10 +173,10 @@ if (request.RequestType == "Delete")
160
173
  {
161
174
  destroy(request.ResourceProperties.DomainName, function()
162
175
  {
163
- Cloudformation.send(request, context, Cloudformation.SUCCESS, {}, "Success", "(deleted)");
176
+ Cloudformation.send(request, context, Cloudformation.SUCCESS, return_properties, "Success", "(deleted)");
164
177
  },
165
178
  function()
166
179
  {
167
- Cloudformation.send(request, context, Cloudformation.SUCCESS, {}, "Success", "(don't care)");
180
+ Cloudformation.send(request, context, Cloudformation.SUCCESS, return_properties, "Success", "(don't care)");
168
181
  });
169
182
  }
@@ -0,0 +1,60 @@
1
+ var acm = new aws.ACM({region: "us-east-1"}); // MUST be us-east-1.
2
+
3
+ var arn = request.ResourceProperties.Certificate;
4
+
5
+ function wait_for_approval(on_success, on_fail)
6
+ {
7
+ var params = {
8
+ CertificateArn: arn
9
+ };
10
+
11
+ acm.describeCertificate(params, function(err, cert_data) {
12
+ if (err)
13
+ {
14
+ on_fail(err);
15
+ }
16
+ else
17
+ {
18
+ if (cert_data.Certificate.DomainValidationOptions[0].ValidationStatus === "SUCCESS")
19
+ {
20
+ on_success();
21
+ }
22
+ else if (cert_data.Certificate.DomainValidationOptions[0].ValidationStatus === "FAILED")
23
+ {
24
+ on_fail("Verification Failed");
25
+ }
26
+ else
27
+ {
28
+ setTimeout(function()
29
+ {
30
+ wait_for_approval(on_success, on_fail);
31
+ }, 3000);
32
+ }
33
+ }
34
+ });
35
+ }
36
+
37
+ function fail(err)
38
+ {
39
+ Cloudformation.send(request, context, Cloudformation.FAILED, {}, "Error: " + err);
40
+ }
41
+
42
+ function success()
43
+ {
44
+ Cloudformation.send(request, context, Cloudformation.SUCCESS, {}, "Success");
45
+ }
46
+
47
+ if (request.RequestType == "Create")
48
+ {
49
+ wait_for_approval(success, fail);
50
+ }
51
+
52
+ if (request.RequestType == "Update")
53
+ {
54
+ wait_for_approval(success, fail);
55
+ }
56
+
57
+ if (request.RequestType == "Delete")
58
+ {
59
+ success();
60
+ }
@@ -80,6 +80,7 @@ module Sumomo
80
80
  @s3 = s3
81
81
  @has_dummy = true
82
82
  @dummy_vpc = nil
83
+ @timeout = nil
83
84
 
84
85
  instance_eval(&block)
85
86
 
@@ -113,7 +114,7 @@ module Sumomo
113
114
  cf.update_stack(update_options)
114
115
  rescue StandardError => e
115
116
  if e.message.end_with? 'does not exist'
116
- update_options[:timeout_in_minutes] = 30
117
+ update_options[:timeout_in_minutes] = @timeout if @timeout
117
118
  update_options[:notification_arns] = sns_arn if sns_arn
118
119
  cf.create_stack(update_options)
119
120
  else
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Sumomo
4
- VERSION = '0.8.6'
4
+ VERSION = '0.8.7'
5
5
  end
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.6
4
+ version: 0.8.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Siaw
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-11-06 00:00:00.000000000 Z
11
+ date: 2019-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -2521,11 +2521,13 @@ files:
2521
2521
  - data/sumomo/custom_resources/AvailabilityZones.js
2522
2522
  - data/sumomo/custom_resources/CloudflareDNSEntry.js
2523
2523
  - data/sumomo/custom_resources/DeployTime.js
2524
+ - data/sumomo/custom_resources/Echo.js
2524
2525
  - data/sumomo/custom_resources/ListLength.js
2525
2526
  - data/sumomo/custom_resources/OriginAccessIdentity.js
2526
2527
  - data/sumomo/custom_resources/SelectSpot.js
2527
2528
  - data/sumomo/custom_resources/TempS3Bucket.js
2528
2529
  - data/sumomo/custom_resources/USEastCertificate.js
2530
+ - data/sumomo/custom_resources/USEastCertificateWaiter.js
2529
2531
  - data/sumomo/sources/spot-watcher-poller.sh
2530
2532
  - data/sumomo/sources/spot-watcher.sh
2531
2533
  - exe/sumomo