elastip 0.2.4 → 1.0.0
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.
- checksums.yaml +4 -4
- data/README.md +8 -0
- data/exe/elastip +5 -1
- data/lib/elastip.rb +23 -4
- data/lib/elastip/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71b572c3688c118ed0f3fac34c6ae818cc8d7067
|
4
|
+
data.tar.gz: 334a927e586c2df5c93455103416a7a767e34a32
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a137ed38d4163fc1bb73430e6eb70ab665d04dd7c6ac8d186378a529ca90fe224c45a2fbeecf98151acf3dd7166fb2b1a5c826e9128eac7b70e8029a95c2cb2e
|
7
|
+
data.tar.gz: '0118daa3fde71beeea16db8fbc7166596a5d55bab1475d8a29bc52fbeb6af5feb769051c1cde1a8743d802c16482576d83ac4f471860e62263bcb2ca8b57d4a6'
|
data/README.md
CHANGED
@@ -40,6 +40,14 @@ $> elastip project_name production --all
|
|
40
40
|
You got the idea. You can then use it directly in an alias doing `ssh ec2-user@$(elastip project-name production)`
|
41
41
|
|
42
42
|
|
43
|
+
### Killing the inactive instances
|
44
|
+
```
|
45
|
+
$> elastip project_name production --inactive --terminate
|
46
|
+
$>
|
47
|
+
```
|
48
|
+
|
49
|
+
Careful with this one but it'll terminate all the instances marked as 'inactive' in their cname.
|
50
|
+
|
43
51
|
## Contributing
|
44
52
|
|
45
53
|
Bug reports and pull requests are welcome on GitHub at https://github.com/pcboy/elastip. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
data/exe/elastip
CHANGED
@@ -9,4 +9,8 @@ if !project or !env
|
|
9
9
|
"Example: elastip 'my_pro*ect' production"
|
10
10
|
end
|
11
11
|
|
12
|
-
|
12
|
+
if options.include?('--inactive')
|
13
|
+
puts Elastip::Elastip.new(project, env, all: options.include?('--all')).inactive_instances(terminate: options.include?('--terminate')).join("\n")
|
14
|
+
else
|
15
|
+
puts Elastip::Elastip.new(project, env, all: options.include?('--all')).ip.join("\n")
|
16
|
+
end
|
data/lib/elastip.rb
CHANGED
@@ -5,17 +5,17 @@ require 'aws-sdk'
|
|
5
5
|
|
6
6
|
module Elastip
|
7
7
|
class Elastip
|
8
|
-
def initialize(project, env,
|
8
|
+
def initialize(project, env, all: false)
|
9
9
|
abort "You need to specify a project and an environnement (e.g staging,production)" if !project or !env
|
10
10
|
@project_re = Regexp.new(project)
|
11
11
|
@env = env
|
12
|
-
@all =
|
12
|
+
@all = all
|
13
13
|
end
|
14
14
|
|
15
15
|
def ip
|
16
16
|
active_envs = environments.map do |env|
|
17
|
-
if @project_re =~ env[:application_name] && env[:environment_name].include?(@env)
|
18
|
-
if @all || env[:health] == 'Green'
|
17
|
+
if @project_re =~ env[:application_name].downcase && env[:environment_name].include?(@env)
|
18
|
+
if @all || (env[:health] == 'Green' && env[:status] == 'Ready')
|
19
19
|
env[:environment_name]
|
20
20
|
end
|
21
21
|
end
|
@@ -31,6 +31,25 @@ module Elastip
|
|
31
31
|
target_instances.map{|x| x[:ip]}
|
32
32
|
end
|
33
33
|
|
34
|
+
def inactive_instances(terminate: false)
|
35
|
+
inactive_envs = environments.map do |env|
|
36
|
+
if @project_re =~ env[:application_name].downcase && env[:environment_name].include?(@env)
|
37
|
+
if env[:cname] =~ /inactive/ && env[:status] == 'Ready'
|
38
|
+
env
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end.compact
|
42
|
+
|
43
|
+
if terminate
|
44
|
+
inactive_envs.each do |env|
|
45
|
+
STDERR.puts "terminate: #{env[:environment_name]}"
|
46
|
+
ebs.terminate_environment(environment_name: env[:environment_name])
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
inactive_envs
|
51
|
+
end
|
52
|
+
|
34
53
|
private
|
35
54
|
|
36
55
|
def ebs
|
data/lib/elastip/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elastip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- pcboy
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-10-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -135,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
135
135
|
version: '0'
|
136
136
|
requirements: []
|
137
137
|
rubyforge_project:
|
138
|
-
rubygems_version: 2.6.
|
138
|
+
rubygems_version: 2.6.14
|
139
139
|
signing_key:
|
140
140
|
specification_version: 4
|
141
141
|
summary: Elastip helps you find the ip addresses of your elastic beanstalk instances
|