builderator 2.0.3 → 2.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/builderator/util.rb +19 -15
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 546f19517e89098c1cbaebe6bf9c9142120d65f8
|
4
|
+
data.tar.gz: 2a212ca4c5cbddb3fb5d666ea282f81975374fd7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a459532c525027ba02cee9ff41512840d6cc7414d2a0371477dc31e817676573bbefb78ad2b2acada3cbbdc6e93fd39002b12098f8f7890235fe09583fd7fa93
|
7
|
+
data.tar.gz: 15843e363495491ec329584a9fba648a395ebc36610f7a3f6d88f2961862c246887d585bae23939da34922dcdcbb880371a983b7216b213ec20c597ceefdce75
|
data/lib/builderator/util.rb
CHANGED
@@ -89,7 +89,9 @@ module Builderator
|
|
89
89
|
return
|
90
90
|
end
|
91
91
|
ec2 = ec2(region)
|
92
|
-
|
92
|
+
Retryable.retryable(:sleep => lambda { |n| 4**n }, :tries => 4, :on => [Aws::EC2::Errors::ServiceError, Aws::EC2::Errors::InternalError]) do |retries, _|
|
93
|
+
resp = ec2.delete_security_group(group_id: group_id)
|
94
|
+
end
|
93
95
|
puts "Deleted SecurityGroup #{group_id}"
|
94
96
|
end
|
95
97
|
|
@@ -108,20 +110,22 @@ module Builderator
|
|
108
110
|
|
109
111
|
# Create a security group with microsecond timestamp (to avoid collisions when using seconds)
|
110
112
|
ts_usec = (Time.now.to_f*1000000).to_i
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
113
|
+
Retryable.retryable(:sleep => lambda { |n| 4**n }, :tries => 4, :on => [Aws::EC2::Errors::ServiceError, Aws::EC2::Errors::InternalError]) do |retries, _|
|
114
|
+
resp = ec2.create_security_group(group_name: "BuilderatorSecurityGroupSSHOnly-#{ts_usec}",
|
115
|
+
description: "Created by Builderator at #{Time.now}")
|
116
|
+
group_id = resp[:group_id]
|
117
|
+
|
118
|
+
resp = ec2.describe_security_groups(group_ids: [group_id])
|
119
|
+
groups = resp[:security_groups]
|
120
|
+
group = groups.first
|
121
|
+
|
122
|
+
# Ensure the group_id has the right permissions
|
123
|
+
resp = ec2.authorize_security_group_ingress(group_id: group_id,
|
124
|
+
ip_protocol: 'tcp',
|
125
|
+
from_port: 22,
|
126
|
+
to_port: 22,
|
127
|
+
cidr_ip: cidr_ip)
|
128
|
+
end
|
125
129
|
puts "Created SecurityGroup #{group_id}"
|
126
130
|
group_id
|
127
131
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: builderator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Manero
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-04-
|
11
|
+
date: 2018-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|