sumomo 0.8.12 → 0.8.15

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: f1e4cdfef8da13f712a3b71c67b94462d70b0deddcb96bb53d9d2fca00dce3c4
4
- data.tar.gz: 720f5367efd7db19b35f53d849a247dc78bd2284b6737d8bb6592cd0e546d986
3
+ metadata.gz: 2d31828749cf57f094afad4100d0a2c41e1e23db623f4d83c7af92ea09973a2b
4
+ data.tar.gz: 2651d1c3f796f9153199aee4077f7f5ee3aa2c65d35fa764d01309fc90e7b117
5
5
  SHA512:
6
- metadata.gz: 5586092e335a09c3ac66a5ce182b7e7a400546fbc95434e04362d97edd0d661888aad6dfb2e1c52f2f278a6f2edcc5bfebbd9acf3f787ab4c9697eb6ad9f8dfa
7
- data.tar.gz: e0176d27503349f870de91783a2990f23c2873ad545185788cfa51ce44ad4bbff0799634266381f87b3af7e0cb8f4955c01f8bdb85d76c33a14f6526a2178621
6
+ metadata.gz: ea85e42594b8bd2c22396d9904277b97307256335f1a2a95c397ecd5cde7b90a2fdbd4a909576080d5e371c2d7130c7c5f3043d6e0086d7a8fbd965b6e7ad700
7
+ data.tar.gz: f963dd40b6a1ba5a4de069310d6c44e1d55254008093bbc7933ad37096e797b8a10faabc0936b6c591f6bea85a9ac80bb9f3862b33315b8bc7825c5921dd64ac
data/README.md CHANGED
@@ -75,22 +75,23 @@ Sumomo::wait_for_stack(name: "mystack", region: "ap-northeast-1")
75
75
  You can make a server
76
76
 
77
77
  ```ruby
78
- network = make_network(layers: [:web, :db])
79
-
78
+ network = make_network(layers: %w[web])
80
79
  eip = make "AWS::EC2::EIP"
81
80
 
82
81
  make_autoscaling_group(
83
- network: network,
84
- layers: :web,
85
- eip: eip,
86
- type: "c3.xlarge",
87
- vol_size: 15, # GB,
88
- script: <<-SCRIPT
89
- yum install git gcc g++
90
- echo "hello world" >> ~/hello
91
- SCRIPT
82
+ network: network,
83
+ layer: 'web',
84
+ eip: eip,
85
+ type: "a1.medium",
86
+ vol_size: 15, # GB,
87
+ script: <<-SCRIPT
88
+ yum install git gcc g++
89
+ echo "hello world" >> ~/hello
90
+ SCRIPT
92
91
  )
93
92
 
93
+ output 'IP', eip
94
+
94
95
  ```
95
96
 
96
97
  You can make apis with this now
@@ -4,6 +4,8 @@ var acm = new aws.ACM({region: cert_region});
4
4
 
5
5
  var return_properties = {};
6
6
 
7
+ var retries = 0;
8
+
7
9
  function extractRootDomain(domain)
8
10
  {
9
11
  var splitArr = domain.split('.');
@@ -12,26 +14,55 @@ function extractRootDomain(domain)
12
14
  //extracting the root domain here
13
15
  if (arrLen > 2)
14
16
  {
15
- domain = splitArr[arrLen - 2] + '.' + splitArr[arrLen - 1];
17
+ domain = splitArr.slice(1).join(".");
16
18
  }
17
19
  return domain;
18
20
  }
19
21
 
20
22
  function wait_for_approval(domain_name, on_success, on_fail)
21
23
  {
24
+ console.log('read domain: ', domain_name);
22
25
  get_domain(domain_name, function(data)
23
26
  {
27
+ console.log('loaded domain data: ');
28
+ console.log(data);
29
+
24
30
  var params = {
25
31
  CertificateArn: data.arn
26
32
  };
27
33
 
28
34
  acm.describeCertificate(params, function(err, cert_data) {
35
+ console.log('received certificate data');
36
+ console.log(cert_data);
37
+ console.log(cert_data.Certificate.DomainValidationOptions);
38
+ console.log(cert_data.Certificate.DomainValidationOptions[0]);
39
+
40
+
29
41
  if (err)
30
42
  {
31
43
  on_fail(err);
32
44
  }
33
45
  else
34
46
  {
47
+ if (!cert_data.Certificate.DomainValidationOptions[0].ResourceRecord)
48
+ {
49
+ // damn AWS now does not return this information immediately
50
+ // and we have to wait for it.
51
+ return setTimeout(function()
52
+ {
53
+ console.log('no ResourceRecord found, retrying...', "attempts:", retries);
54
+ if (retries < 60)
55
+ {
56
+ wait_for_approval(domain_name, on_success, on_fail);
57
+ retries += 1;
58
+ }
59
+ else
60
+ {
61
+ on_fail('AWS did not return ResourceRecord. (AWS issue)');
62
+ }
63
+
64
+ }, 1000);
65
+ }
35
66
  // Do not wait if we requested DNS validation
36
67
  if (request.ResourceProperties.ValidationMethod === "DNS")
37
68
  {
@@ -11,6 +11,8 @@ function wait_for_approval(on_success, on_fail)
11
11
  };
12
12
 
13
13
  acm.describeCertificate(params, function(err, cert_data) {
14
+ console.log('describe certificate data');
15
+ console.log(cert_data);;
14
16
  if (err)
15
17
  {
16
18
  on_fail(err);
@@ -38,6 +40,8 @@ function wait_for_approval(on_success, on_fail)
38
40
 
39
41
  function fail(err)
40
42
  {
43
+ console.log('Errored.');
44
+ console.log(err);
41
45
  Cloudformation.send(request, context, Cloudformation.FAILED, {}, "Error: " + err);
42
46
  }
43
47