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 +4 -4
- data/data/sumomo/custom_resources/Echo.js +25 -0
- data/data/sumomo/custom_resources/TempS3Bucket.js +7 -2
- data/data/sumomo/custom_resources/USEastCertificate.js +44 -31
- data/data/sumomo/custom_resources/USEastCertificateWaiter.js +60 -0
- data/lib/sumomo.rb +2 -1
- data/lib/sumomo/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d12954eb075b3c25afec4ba1455de77317d36ccbd2c4a79ad54657f1d130688f
|
4
|
+
data.tar.gz: f4c056344d60a16fbc66892ba9573c5b60658ea66b4e23588e7b179d58546cf3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 = {
|
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
|
-
|
20
|
+
get_domain(domain_name, function(data)
|
19
21
|
{
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
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(
|
48
|
+
on_fail("Verification Failed");
|
29
49
|
}
|
30
50
|
else
|
31
51
|
{
|
32
|
-
|
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
|
-
|
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,
|
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,
|
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,
|
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,
|
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,
|
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
|
+
}
|
data/lib/sumomo.rb
CHANGED
@@ -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] =
|
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
|
data/lib/sumomo/version.rb
CHANGED
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.
|
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-
|
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
|