cloudstrap 0.30.12.pre → 0.31.1.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/cloudstrap +1 -0
- data/lib/cloudstrap/amazon.rb +2 -0
- data/lib/cloudstrap/amazon/ec2.rb +10 -0
- data/lib/cloudstrap/amazon/elb.rb +45 -0
- data/lib/cloudstrap/amazon/route53.rb +42 -0
- data/lib/cloudstrap/amazon/support/rate_limit_handler.rb +4 -1
- data/lib/cloudstrap/bootstrap_agent.rb +5 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 74614e07862ccafa1e8a578fa6096f83193a82a1
|
4
|
+
data.tar.gz: 077627f919d13452fe56ec2a46721b1a081f261c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 141f91160f912706e61b4cda52a6abba92449120d94e65ade11cb876a9c4b474451053c514d49c794b757eb770442797b3d079133f53ab720dd57c23a2e4b019
|
7
|
+
data.tar.gz: 2ed68498c3fb49ab93feb1912cade807fdb36f822d74e9c253653aa383e41d48f31014a8c05f1f4ad63e1925a1209f962f0543868bd64e6ad4361e6115fc1ae5
|
data/bin/cloudstrap
CHANGED
@@ -65,6 +65,7 @@ BOOTSTRAP_WITHOUT_HUMAN_OVERSIGHT=#{!agent.requires_human_oversight?}
|
|
65
65
|
# These do not need configuration, and are presented as a debugging checklist
|
66
66
|
|
67
67
|
# DNS Support Enabled for VPC? #{agent.enable_dns_support}
|
68
|
+
# DNS Hostnames Enabled for VPC? #{agent.enable_dns_hostnames}
|
68
69
|
# Public IPs Enabled in Public Subnet? #{agent.enable_public_ips}
|
69
70
|
# Gateway Attached to VPC? #{agent.attach_gateway}
|
70
71
|
# Route to Internet via Gateway? #{agent.default_route}
|
data/lib/cloudstrap/amazon.rb
CHANGED
@@ -25,6 +25,16 @@ module Cloudstrap
|
|
25
25
|
call_api(:modify_vpc_attribute, vpc_id: vpc_id, enable_dns_support: { value: true }).successful?
|
26
26
|
end
|
27
27
|
|
28
|
+
Contract String => Bool
|
29
|
+
def vpc_supports_dns_hostnames?(vpc_id)
|
30
|
+
call_api(:describe_vpc_attribute, vpc_id: vpc_id, attribute: "enableDnsHostnames").enable_dns_hostnames.value
|
31
|
+
end
|
32
|
+
|
33
|
+
Contract String => Bool
|
34
|
+
def enable_dns_hostnames(vpc_id)
|
35
|
+
call_api(:modify_vpc_attribute, vpc_id: vpc_id, enable_dns_hostnames: { value: true }).successful?
|
36
|
+
end
|
37
|
+
|
28
38
|
Contract None => ArrayOf[::Aws::EC2::Types::Subnet]
|
29
39
|
def subnets
|
30
40
|
@subnets ||= subnets!
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'aws-sdk'
|
2
|
+
require 'contracts'
|
3
|
+
require_relative 'service'
|
4
|
+
|
5
|
+
module Cloudstrap
|
6
|
+
module Amazon
|
7
|
+
class ELB < Service
|
8
|
+
include ::Contracts::Core
|
9
|
+
include ::Contracts::Builtin
|
10
|
+
|
11
|
+
Contract None => ArrayOf[::Aws::ElasticLoadBalancing::Types::LoadBalancerDescription]
|
12
|
+
def list
|
13
|
+
@list ||= list!
|
14
|
+
end
|
15
|
+
|
16
|
+
Contract None => ArrayOf[::Aws::ElasticLoadBalancing::Types::LoadBalancerDescription]
|
17
|
+
def list!
|
18
|
+
@list = call_api(:describe_load_balancers).load_balancer_descriptions
|
19
|
+
end
|
20
|
+
|
21
|
+
Tags = HashOf[String, String]
|
22
|
+
|
23
|
+
Contract Args[String] => HashOf[String, Tags]
|
24
|
+
def tags(*elb_names)
|
25
|
+
describe_tags(*elb_names).each_with_object({}) do |description, hash|
|
26
|
+
hash[description.load_balancer_name] = description
|
27
|
+
.tags
|
28
|
+
.map(&:to_a)
|
29
|
+
.to_h
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
Contract Args[String] => ArrayOf[::Aws::ElasticLoadBalancing::Types::TagDescription]
|
36
|
+
def describe_tags(*elb_names)
|
37
|
+
call_api(:describe_tags, load_balancer_names: elb_names).tag_descriptions
|
38
|
+
end
|
39
|
+
|
40
|
+
def client
|
41
|
+
::Aws::ElasticLoadBalancing::Client
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'aws-sdk'
|
2
|
+
require 'contracts'
|
3
|
+
require_relative 'service'
|
4
|
+
|
5
|
+
module Cloudstrap
|
6
|
+
module Amazon
|
7
|
+
class Route53 < Service
|
8
|
+
include ::Contracts::Core
|
9
|
+
include ::Contracts::Builtin
|
10
|
+
|
11
|
+
Contract None => ArrayOf[::Aws::Route53::Types::HostedZone]
|
12
|
+
def zones
|
13
|
+
@zones ||= zones!
|
14
|
+
end
|
15
|
+
|
16
|
+
Contract None => ArrayOf[::Aws::Route53::Types::HostedZone]
|
17
|
+
def zones!
|
18
|
+
@zones = call_api(:list_hosted_zones).hosted_zones
|
19
|
+
end
|
20
|
+
|
21
|
+
Contract String => Maybe[::Aws::Route53::Types::HostedZone]
|
22
|
+
def zone(name)
|
23
|
+
name.tap { |string| string.concat('.') unless string.end_with?('.') }
|
24
|
+
|
25
|
+
zones.find { |zone| zone.name == name }
|
26
|
+
end
|
27
|
+
|
28
|
+
Contract String => Maybe[String]
|
29
|
+
def zone_id(name)
|
30
|
+
return unless zone = zone(name)
|
31
|
+
|
32
|
+
zone(name).id.split('/').last
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def client
|
38
|
+
::Aws::Route53::Client
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -19,7 +19,10 @@ module Cloudstrap
|
|
19
19
|
Contract Symbol, Args[Any] => Any
|
20
20
|
def call_api(method, *args)
|
21
21
|
with_retries(
|
22
|
-
rescue:
|
22
|
+
rescue: [
|
23
|
+
Aws::EC2::Errors::RequestLimitExceeded,
|
24
|
+
Aws::Route53::Errors::ThrottlingException
|
25
|
+
],
|
23
26
|
handler: request_limit_exceeded_handler,
|
24
27
|
base_sleep_seconds: 1.0,
|
25
28
|
max_sleep_seconds: 8.0
|
@@ -255,6 +255,11 @@ module Cloudstrap
|
|
255
255
|
ec2.vpc_supports_dns?(vpc) || ec2.enable_dns_support(vpc)
|
256
256
|
end
|
257
257
|
|
258
|
+
Contract None => Bool
|
259
|
+
def enable_dns_hostnames
|
260
|
+
ec2.vpc_supports_dns_hostnames?(vpc) || ec2.enable_dns_hostnames(vpc)
|
261
|
+
end
|
262
|
+
|
258
263
|
Contract None => String
|
259
264
|
def create_jumpbox
|
260
265
|
upload_ssh_key
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudstrap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.31.1.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Olstrom
|
@@ -205,7 +205,9 @@ files:
|
|
205
205
|
- lib/cloudstrap.rb
|
206
206
|
- lib/cloudstrap/amazon.rb
|
207
207
|
- lib/cloudstrap/amazon/ec2.rb
|
208
|
+
- lib/cloudstrap/amazon/elb.rb
|
208
209
|
- lib/cloudstrap/amazon/iam.rb
|
210
|
+
- lib/cloudstrap/amazon/route53.rb
|
209
211
|
- lib/cloudstrap/amazon/service.rb
|
210
212
|
- lib/cloudstrap/amazon/support/rate_limit_handler.rb
|
211
213
|
- lib/cloudstrap/bootstrap_agent.rb
|