builderator 2.0.3 → 2.0.4

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/builderator/util.rb +19 -15
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d61791d654bbf812e8a6fc0ff5c45516e97d46c1
4
- data.tar.gz: 37f685e6f924ce60a5a921409412c7eafadb44dd
3
+ metadata.gz: 546f19517e89098c1cbaebe6bf9c9142120d65f8
4
+ data.tar.gz: 2a212ca4c5cbddb3fb5d666ea282f81975374fd7
5
5
  SHA512:
6
- metadata.gz: e4515821bcc561de3c1bf73d771b187f52415a9010285c4540a565c52aa50307440f4b8062e62ea009b32042f10c03f4670210b500f8e3d372f8882e6cd71760
7
- data.tar.gz: 966b56ae5f3744be67d19e6fb501a0f77d8a0ace9852afd38a20e7597dbe876492f327e0d03eb3321b67863538ac83ac88c2bdf130e0504f11731035574ac469
6
+ metadata.gz: a459532c525027ba02cee9ff41512840d6cc7414d2a0371477dc31e817676573bbefb78ad2b2acada3cbbdc6e93fd39002b12098f8f7890235fe09583fd7fa93
7
+ data.tar.gz: 15843e363495491ec329584a9fba648a395ebc36610f7a3f6d88f2961862c246887d585bae23939da34922dcdcbb880371a983b7216b213ec20c597ceefdce75
@@ -89,7 +89,9 @@ module Builderator
89
89
  return
90
90
  end
91
91
  ec2 = ec2(region)
92
- resp = ec2.delete_security_group(group_id: group_id)
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
- resp = ec2.create_security_group(group_name: "BuilderatorSecurityGroupSSHOnly-#{ts_usec}",
112
- description: "Created by Builderator at #{Time.now}")
113
- group_id = resp[:group_id]
114
-
115
- resp = ec2.describe_security_groups(group_ids: [group_id])
116
- groups = resp[:security_groups]
117
- group = groups.first
118
-
119
- # Ensure the group_id has the right permissions
120
- resp = ec2.authorize_security_group_ingress(group_id: group_id,
121
- ip_protocol: 'tcp',
122
- from_port: 22,
123
- to_port: 22,
124
- cidr_ip: cidr_ip)
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.3
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-02 00:00:00.000000000 Z
11
+ date: 2018-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake