meroku 2.0.22 → 2.0.23
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/.travis.yml +0 -10
- data/Guardfile +43 -0
- data/LICENSE.txt +1 -1
- data/README.md +29 -89
- data/bin/meroku +5 -3
- data/{frontend → data}/etc_nginx_sites-enabled_template +0 -0
- data/guard +25 -0
- data/lib/meroku.rb +17 -20
- data/lib/meroku/api.rb +15 -3
- data/lib/meroku/aws.rb +69 -6
- data/lib/meroku/cli.rb +23 -91
- data/lib/meroku/error.rb +11 -0
- data/lib/meroku/node.rb +70 -70
- data/lib/meroku/options.rb +79 -0
- data/lib/meroku/secrets.rb +38 -0
- data/lib/meroku/shared.rb +23 -0
- data/lib/meroku/user.rb +25 -0
- data/lib/meroku/version.rb +3 -1
- data/meroku.gemspec +10 -19
- metadata +20 -319
- data/circle.yml +0 -23
- data/frontend/.gitignore +0 -23
- data/frontend/.ruby-version +0 -2
- data/frontend/Gemfile +0 -61
- data/frontend/Gemfile.lock +0 -236
- data/frontend/README.md +0 -24
- data/frontend/Rakefile +0 -6
- data/frontend/app/assets/config/manifest.js +0 -3
- data/frontend/app/assets/images/.keep +0 -0
- data/frontend/app/assets/javascripts/application.js +0 -15
- data/frontend/app/assets/javascripts/apps.coffee +0 -3
- data/frontend/app/assets/javascripts/cable.js +0 -13
- data/frontend/app/assets/javascripts/channels/.keep +0 -0
- data/frontend/app/assets/javascripts/pages.coffee +0 -3
- data/frontend/app/assets/javascripts/publickeys.coffee +0 -3
- data/frontend/app/assets/stylesheets/application.css +0 -15
- data/frontend/app/assets/stylesheets/apps.scss +0 -3
- data/frontend/app/assets/stylesheets/pages.scss +0 -3
- data/frontend/app/assets/stylesheets/publickeys.scss +0 -3
- data/frontend/app/assets/stylesheets/scaffolds.scss +0 -84
- data/frontend/app/channels/application_cable/channel.rb +0 -4
- data/frontend/app/channels/application_cable/connection.rb +0 -4
- data/frontend/app/controllers/application_controller.rb +0 -4
- data/frontend/app/controllers/apps_controller.rb +0 -83
- data/frontend/app/controllers/concerns/.keep +0 -0
- data/frontend/app/controllers/publickeys_controller.rb +0 -82
- data/frontend/app/controllers/users/confirmations_controller.rb +0 -28
- data/frontend/app/controllers/users/omniauth_callbacks_controller.rb +0 -28
- data/frontend/app/controllers/users/passwords_controller.rb +0 -32
- data/frontend/app/controllers/users/registrations_controller.rb +0 -74
- data/frontend/app/controllers/users/sessions_controller.rb +0 -34
- data/frontend/app/controllers/users/unlocks_controller.rb +0 -28
- data/frontend/app/helpers/application_helper.rb +0 -2
- data/frontend/app/helpers/apps_helper.rb +0 -2
- data/frontend/app/helpers/pages_helper.rb +0 -2
- data/frontend/app/helpers/publickeys_helper.rb +0 -2
- data/frontend/app/jobs/application_job.rb +0 -2
- data/frontend/app/lib/cmd.rb +0 -11
- data/frontend/app/mailers/application_mailer.rb +0 -4
- data/frontend/app/models/app.rb +0 -37
- data/frontend/app/models/application_record.rb +0 -3
- data/frontend/app/models/concerns/.keep +0 -0
- data/frontend/app/models/publickey.rb +0 -15
- data/frontend/app/models/user.rb +0 -22
- data/frontend/app/policies/application_policy.rb +0 -53
- data/frontend/app/policies/publickey_policy.rb +0 -7
- data/frontend/app/serializable/serializable_app.rb +0 -6
- data/frontend/app/serializable/serializable_publickey.rb +0 -7
- data/frontend/app/serializable/serializable_user.rb +0 -8
- data/frontend/app/serializers/app_serializer.rb +0 -3
- data/frontend/app/serializers/publickey_serializer.rb +0 -4
- data/frontend/app/views/apps/_app.json.jbuilder +0 -2
- data/frontend/app/views/apps/_form.html.erb +0 -22
- data/frontend/app/views/apps/edit.html.erb +0 -6
- data/frontend/app/views/apps/index.html.erb +0 -27
- data/frontend/app/views/apps/index.json.jbuilder +0 -1
- data/frontend/app/views/apps/new.html.erb +0 -5
- data/frontend/app/views/apps/show.html.erb +0 -9
- data/frontend/app/views/apps/show.json.jbuilder +0 -1
- data/frontend/app/views/devise/confirmations/new.html.erb +0 -16
- data/frontend/app/views/devise/mailer/confirmation_instructions.html.erb +0 -5
- data/frontend/app/views/devise/mailer/email_changed.html.erb +0 -7
- data/frontend/app/views/devise/mailer/password_change.html.erb +0 -3
- data/frontend/app/views/devise/mailer/reset_password_instructions.html.erb +0 -8
- data/frontend/app/views/devise/mailer/unlock_instructions.html.erb +0 -7
- data/frontend/app/views/devise/passwords/edit.html.erb +0 -25
- data/frontend/app/views/devise/passwords/new.html.erb +0 -16
- data/frontend/app/views/devise/registrations/edit.html.erb +0 -43
- data/frontend/app/views/devise/registrations/new.html.erb +0 -29
- data/frontend/app/views/devise/sessions/new.html.erb +0 -26
- data/frontend/app/views/devise/shared/_links.html.erb +0 -25
- data/frontend/app/views/devise/unlocks/new.html.erb +0 -16
- data/frontend/app/views/layouts/application.html.erb +0 -16
- data/frontend/app/views/layouts/mailer.html.erb +0 -13
- data/frontend/app/views/layouts/mailer.text.erb +0 -1
- data/frontend/app/views/publickeys/_form.html.erb +0 -32
- data/frontend/app/views/publickeys/_publickey.json.jbuilder +0 -2
- data/frontend/app/views/publickeys/edit.html.erb +0 -6
- data/frontend/app/views/publickeys/index.html.erb +0 -31
- data/frontend/app/views/publickeys/index.json.jbuilder +0 -1
- data/frontend/app/views/publickeys/new.html.erb +0 -5
- data/frontend/app/views/publickeys/show.html.erb +0 -19
- data/frontend/app/views/publickeys/show.json.jbuilder +0 -1
- data/frontend/bin/bundle +0 -3
- data/frontend/bin/rails +0 -9
- data/frontend/bin/rake +0 -9
- data/frontend/bin/setup +0 -38
- data/frontend/bin/spring +0 -17
- data/frontend/bin/update +0 -29
- data/frontend/bin/yarn +0 -11
- data/frontend/config.ru +0 -5
- data/frontend/config/application.rb +0 -18
- data/frontend/config/boot.rb +0 -3
- data/frontend/config/cable.yml +0 -10
- data/frontend/config/database.yml +0 -87
- data/frontend/config/environment.rb +0 -5
- data/frontend/config/environments/development.rb +0 -56
- data/frontend/config/environments/production.rb +0 -97
- data/frontend/config/environments/test.rb +0 -42
- data/frontend/config/initializers/ams.rb +0 -3
- data/frontend/config/initializers/application_controller_renderer.rb +0 -8
- data/frontend/config/initializers/assets.rb +0 -14
- data/frontend/config/initializers/backtrace_silencers.rb +0 -7
- data/frontend/config/initializers/cookies_serializer.rb +0 -5
- data/frontend/config/initializers/devise.rb +0 -277
- data/frontend/config/initializers/filter_parameter_logging.rb +0 -4
- data/frontend/config/initializers/inflections.rb +0 -16
- data/frontend/config/initializers/mime_types.rb +0 -4
- data/frontend/config/initializers/wrap_parameters.rb +0 -14
- data/frontend/config/locales/devise.en.yml +0 -64
- data/frontend/config/locales/en.yml +0 -33
- data/frontend/config/puma.rb +0 -66
- data/frontend/config/routes.rb +0 -11
- data/frontend/config/secrets.yml +0 -32
- data/frontend/config/spring.rb +0 -6
- data/frontend/db/migrate/20171023223732_devise_create_users.rb +0 -42
- data/frontend/db/migrate/20171025203706_create_apps.rb +0 -9
- data/frontend/db/migrate/20171025223804_add_user_to_apps.rb +0 -5
- data/frontend/db/migrate/20171026071440_create_publickeys.rb +0 -11
- data/frontend/db/migrate/20171028150506_add_apisecret_to_users.rb +0 -6
- data/frontend/db/schema.rb +0 -32
- data/frontend/db/seeds.rb +0 -7
- data/frontend/etc_nginx_sites-enabled_default +0 -29
- data/frontend/lib/assets/.keep +0 -0
- data/frontend/lib/tasks/.keep +0 -0
- data/frontend/log/.keep +0 -0
- data/frontend/package.json +0 -5
- data/frontend/public/404.html +0 -67
- data/frontend/public/422.html +0 -67
- data/frontend/public/500.html +0 -66
- data/frontend/public/Meroku.html +0 -140
- data/frontend/public/Meroku/Api.html +0 -129
- data/frontend/public/Meroku/Api/Request.html +0 -221
- data/frontend/public/Meroku/Aws/Ec2.html +0 -477
- data/frontend/public/Meroku/CLI.html +0 -796
- data/frontend/public/Meroku/CLI/Help.html +0 -224
- data/frontend/public/Meroku/CLI/Secrets.html +0 -191
- data/frontend/public/Meroku/CLI/Session.html +0 -456
- data/frontend/public/Meroku/Extensions.html +0 -405
- data/frontend/public/Meroku/Infrastructure.html +0 -279
- data/frontend/public/Meroku/Infrastructure/Server.html +0 -373
- data/frontend/public/Meroku/Node.html +0 -845
- data/frontend/public/Meroku/Tunnelable.html +0 -247
- data/frontend/public/_index.html +0 -273
- data/frontend/public/apple-touch-icon-precomposed.png +0 -0
- data/frontend/public/apple-touch-icon.png +0 -0
- data/frontend/public/class_list.html +0 -51
- data/frontend/public/css/common.css +0 -1
- data/frontend/public/css/full_list.css +0 -58
- data/frontend/public/css/style.css +0 -492
- data/frontend/public/favicon.ico +0 -0
- data/frontend/public/file.README.html +0 -179
- data/frontend/public/file_list.html +0 -56
- data/frontend/public/frames.html +0 -17
- data/frontend/public/index.html +0 -179
- data/frontend/public/js/app.js +0 -248
- data/frontend/public/js/full_list.js +0 -216
- data/frontend/public/js/jquery.js +0 -4
- data/frontend/public/method_list.html +0 -395
- data/frontend/public/robots.txt +0 -2
- data/frontend/public/top-level-namespace.html +0 -110
- data/frontend/test/application_system_test_case.rb +0 -5
- data/frontend/test/controllers/.keep +0 -0
- data/frontend/test/controllers/apps_controller_test.rb +0 -48
- data/frontend/test/controllers/pages_controller_test.rb +0 -9
- data/frontend/test/controllers/publickeys_controller_test.rb +0 -48
- data/frontend/test/fixtures/.keep +0 -0
- data/frontend/test/fixtures/apps.yml +0 -7
- data/frontend/test/fixtures/files/.keep +0 -0
- data/frontend/test/fixtures/publickeys.yml +0 -11
- data/frontend/test/fixtures/users.yml +0 -11
- data/frontend/test/helpers/.keep +0 -0
- data/frontend/test/integration/.keep +0 -0
- data/frontend/test/mailers/.keep +0 -0
- data/frontend/test/models/.keep +0 -0
- data/frontend/test/models/app_test.rb +0 -7
- data/frontend/test/models/publickey_test.rb +0 -7
- data/frontend/test/models/user_test.rb +0 -7
- data/frontend/test/policies/publickey_policy_test.rb +0 -19
- data/frontend/test/system/.keep +0 -0
- data/frontend/test/system/apps_test.rb +0 -9
- data/frontend/test/system/publickeys_test.rb +0 -9
- data/frontend/test/test_helper.rb +0 -9
- data/frontend/tmp/.keep +0 -0
- data/frontend/vendor/.keep +0 -0
- data/lib/meroku/api/request.rb +0 -17
- data/lib/meroku/aws/ec2.rb +0 -59
- data/lib/meroku/cli/help.rb +0 -27
- data/lib/meroku/cli/secrets.rb +0 -23
- data/lib/meroku/cli/session.rb +0 -46
- data/lib/meroku/extensions.rb +0 -32
- data/lib/meroku/infrastructure.rb +0 -23
- data/lib/meroku/infrastructure/server.rb +0 -20
- data/lib/meroku/tunnelable.rb +0 -35
- data/modified-cedar-14.sh +0 -171
data/frontend/public/robots.txt
DELETED
@@ -1,110 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<meta charset="utf-8">
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
-
<title>
|
7
|
-
Top Level Namespace
|
8
|
-
|
9
|
-
— Documentation by YARD 0.9.9
|
10
|
-
|
11
|
-
</title>
|
12
|
-
|
13
|
-
<link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
|
14
|
-
|
15
|
-
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
|
16
|
-
|
17
|
-
<script type="text/javascript" charset="utf-8">
|
18
|
-
pathId = "";
|
19
|
-
relpath = '';
|
20
|
-
</script>
|
21
|
-
|
22
|
-
|
23
|
-
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
24
|
-
|
25
|
-
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
26
|
-
|
27
|
-
|
28
|
-
</head>
|
29
|
-
<body>
|
30
|
-
<div class="nav_wrap">
|
31
|
-
<iframe id="nav" src="class_list.html?1"></iframe>
|
32
|
-
<div id="resizer"></div>
|
33
|
-
</div>
|
34
|
-
|
35
|
-
<div id="main" tabindex="-1">
|
36
|
-
<div id="header">
|
37
|
-
<div id="menu">
|
38
|
-
|
39
|
-
<a href="_index.html">Index</a> »
|
40
|
-
|
41
|
-
|
42
|
-
<span class="title">Top Level Namespace</span>
|
43
|
-
|
44
|
-
</div>
|
45
|
-
|
46
|
-
<div id="search">
|
47
|
-
|
48
|
-
<a class="full_list_link" id="class_list_link"
|
49
|
-
href="class_list.html">
|
50
|
-
|
51
|
-
<svg width="24" height="24">
|
52
|
-
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
-
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
-
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
-
</svg>
|
56
|
-
</a>
|
57
|
-
|
58
|
-
</div>
|
59
|
-
<div class="clear"></div>
|
60
|
-
</div>
|
61
|
-
|
62
|
-
<div id="content"><h1>Top Level Namespace
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
</h1>
|
67
|
-
<div class="box_info">
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
</div>
|
80
|
-
|
81
|
-
<h2>Defined Under Namespace</h2>
|
82
|
-
<p class="children">
|
83
|
-
|
84
|
-
|
85
|
-
<strong class="modules">Modules:</strong> <span class='object_link'><a href="Meroku.html" title="Meroku (module)">Meroku</a></span>
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
</p>
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
</div>
|
101
|
-
|
102
|
-
<div id="footer">
|
103
|
-
Generated on Wed Nov 1 08:50:09 2017 by
|
104
|
-
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
105
|
-
0.9.9 (ruby-2.4.2).
|
106
|
-
</div>
|
107
|
-
|
108
|
-
</div>
|
109
|
-
</body>
|
110
|
-
</html>
|
File without changes
|
@@ -1,48 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class AppsControllerTest < ActionDispatch::IntegrationTest
|
4
|
-
setup do
|
5
|
-
@app = apps(:one)
|
6
|
-
end
|
7
|
-
|
8
|
-
test "should get index" do
|
9
|
-
get apps_url
|
10
|
-
assert_response :success
|
11
|
-
end
|
12
|
-
|
13
|
-
test "should get new" do
|
14
|
-
get new_app_url
|
15
|
-
assert_response :success
|
16
|
-
end
|
17
|
-
|
18
|
-
test "should create app" do
|
19
|
-
assert_difference('App.count') do
|
20
|
-
post apps_url, params: { app: { name: @app.name } }
|
21
|
-
end
|
22
|
-
|
23
|
-
assert_redirected_to app_url(App.last)
|
24
|
-
end
|
25
|
-
|
26
|
-
test "should show app" do
|
27
|
-
get app_url(@app)
|
28
|
-
assert_response :success
|
29
|
-
end
|
30
|
-
|
31
|
-
test "should get edit" do
|
32
|
-
get edit_app_url(@app)
|
33
|
-
assert_response :success
|
34
|
-
end
|
35
|
-
|
36
|
-
test "should update app" do
|
37
|
-
patch app_url(@app), params: { app: { name: @app.name } }
|
38
|
-
assert_redirected_to app_url(@app)
|
39
|
-
end
|
40
|
-
|
41
|
-
test "should destroy app" do
|
42
|
-
assert_difference('App.count', -1) do
|
43
|
-
delete app_url(@app)
|
44
|
-
end
|
45
|
-
|
46
|
-
assert_redirected_to apps_url
|
47
|
-
end
|
48
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class PublickeysControllerTest < ActionDispatch::IntegrationTest
|
4
|
-
setup do
|
5
|
-
@publickey = publickeys(:one)
|
6
|
-
end
|
7
|
-
|
8
|
-
test "should get index" do
|
9
|
-
get publickeys_url
|
10
|
-
assert_response :success
|
11
|
-
end
|
12
|
-
|
13
|
-
test "should get new" do
|
14
|
-
get new_publickey_url
|
15
|
-
assert_response :success
|
16
|
-
end
|
17
|
-
|
18
|
-
test "should create publickey" do
|
19
|
-
assert_difference('Publickey.count') do
|
20
|
-
post publickeys_url, params: { publickey: { data: @publickey.data, name: @publickey.name, user_id: @publickey.user_id } }
|
21
|
-
end
|
22
|
-
|
23
|
-
assert_redirected_to publickey_url(Publickey.last)
|
24
|
-
end
|
25
|
-
|
26
|
-
test "should show publickey" do
|
27
|
-
get publickey_url(@publickey)
|
28
|
-
assert_response :success
|
29
|
-
end
|
30
|
-
|
31
|
-
test "should get edit" do
|
32
|
-
get edit_publickey_url(@publickey)
|
33
|
-
assert_response :success
|
34
|
-
end
|
35
|
-
|
36
|
-
test "should update publickey" do
|
37
|
-
patch publickey_url(@publickey), params: { publickey: { data: @publickey.data, name: @publickey.name, user_id: @publickey.user_id } }
|
38
|
-
assert_redirected_to publickey_url(@publickey)
|
39
|
-
end
|
40
|
-
|
41
|
-
test "should destroy publickey" do
|
42
|
-
assert_difference('Publickey.count', -1) do
|
43
|
-
delete publickey_url(@publickey)
|
44
|
-
end
|
45
|
-
|
46
|
-
assert_redirected_to publickeys_url
|
47
|
-
end
|
48
|
-
end
|
File without changes
|
File without changes
|
@@ -1,11 +0,0 @@
|
|
1
|
-
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
2
|
-
|
3
|
-
# This model initially had no columns defined. If you add columns to the
|
4
|
-
# model remove the '{}' from the fixture names and add the columns immediately
|
5
|
-
# below each fixture, per the syntax in the comments below
|
6
|
-
#
|
7
|
-
one: {}
|
8
|
-
# column: value
|
9
|
-
#
|
10
|
-
two: {}
|
11
|
-
# column: value
|
data/frontend/test/helpers/.keep
DELETED
File without changes
|
File without changes
|
data/frontend/test/mailers/.keep
DELETED
File without changes
|
data/frontend/test/models/.keep
DELETED
File without changes
|
data/frontend/test/system/.keep
DELETED
File without changes
|
@@ -1,9 +0,0 @@
|
|
1
|
-
require File.expand_path('../../config/environment', __FILE__)
|
2
|
-
require 'rails/test_help'
|
3
|
-
|
4
|
-
class ActiveSupport::TestCase
|
5
|
-
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
|
6
|
-
fixtures :all
|
7
|
-
|
8
|
-
# Add more helper methods to be used by all tests here...
|
9
|
-
end
|
data/frontend/tmp/.keep
DELETED
File without changes
|
data/frontend/vendor/.keep
DELETED
File without changes
|
data/lib/meroku/api/request.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
module Meroku
|
2
|
-
module Api
|
3
|
-
# Wrapper around RestClient.post
|
4
|
-
module Request
|
5
|
-
def self.post(url, data)
|
6
|
-
response = RestClient.post(url, data.to_json,
|
7
|
-
timeout: 1,
|
8
|
-
content_type: :json,
|
9
|
-
accept: :json)
|
10
|
-
r = JSON.parse(response)
|
11
|
-
yield(r["data"]) if r.key?("data")
|
12
|
-
return unless r.key?("errors") && r["errors"].size.positive?
|
13
|
-
puts "error: #{r['errors'].map { |x| x['detail'] }.join('. ')}"
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
data/lib/meroku/aws/ec2.rb
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
|
2
|
-
module Meroku
|
3
|
-
module Aws
|
4
|
-
# Logic related to the ec2 instances we use as servers
|
5
|
-
module Ec2
|
6
|
-
def tag
|
7
|
-
{
|
8
|
-
resource_type: 'instance',
|
9
|
-
tags: [
|
10
|
-
{
|
11
|
-
key: 'Name',
|
12
|
-
value: 'node'
|
13
|
-
}
|
14
|
-
]
|
15
|
-
}
|
16
|
-
end
|
17
|
-
|
18
|
-
def make_instance
|
19
|
-
ec2_client.run_instances(
|
20
|
-
image_id: 'ami-841f46ff',
|
21
|
-
min_count: 1,
|
22
|
-
max_count: 1,
|
23
|
-
key_name: 'meroku.id_rsa',
|
24
|
-
instance_type: 't2.micro',
|
25
|
-
tag_specifications: [tag]
|
26
|
-
).instances.first
|
27
|
-
end
|
28
|
-
|
29
|
-
def ec2_client
|
30
|
-
::Aws::EC2::Client.new(
|
31
|
-
region: 'us-east-1',
|
32
|
-
credentials: ::Aws::Credentials.new(
|
33
|
-
ENV['AWS_ACCESS_KEY'],
|
34
|
-
ENV['AWS_SECRET']
|
35
|
-
)
|
36
|
-
)
|
37
|
-
end
|
38
|
-
|
39
|
-
def self.ec2_client
|
40
|
-
::Aws::EC2::Client.new(
|
41
|
-
region: 'us-east-1',
|
42
|
-
credentials: ::Aws::Credentials.new(
|
43
|
-
ENV['AWS_ACCESS_KEY'],
|
44
|
-
ENV['AWS_SECRET']
|
45
|
-
)
|
46
|
-
)
|
47
|
-
end
|
48
|
-
|
49
|
-
def self.associate_address(eipalloc, id)
|
50
|
-
retries ||= 0
|
51
|
-
ec2_client.associate_address(allocation_id: eipalloc, instance_id: id)
|
52
|
-
rescue ::Aws::EC2::Errors::InvalidInstanceID
|
53
|
-
sleep 1
|
54
|
-
puts 'retrying associate_address()'
|
55
|
-
retry if (retries += 1) < 15
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|