launch_configuration_cleaner 0.1.0 → 0.1.1
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/lib/launch_configuration_cleaner/version.rb +1 -1
- metadata +2 -3
- data/cleaner.rb +0 -61
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 923edc38aeb1eb268a0d7757320b87f39f7f16b3
|
4
|
+
data.tar.gz: 43f63f98c64430caec1223791059b444c1bcc0ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: baf6b7c4b4fddc47ab521f998ce7311460a77e6e6f5fd8459bdf08382423edafe6fa29c6691638aff39b4498c6e346fa63cf18b3a00345adf67e794f611e41da
|
7
|
+
data.tar.gz: 534e381e0db2b5279e41f38cb7ebac8a7ecf81876a42c03beccda8776b350ca2c2bf354b0d6e39a47c599922f58fb6b64232e3ed378bf2618ac7d39eabcc1535
|
data/README.md
CHANGED
@@ -18,6 +18,14 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
$ gem install launch_configuration_cleaner
|
20
20
|
|
21
|
+
Set these enviroment variable
|
22
|
+
|
23
|
+
```
|
24
|
+
export AWS_ACCESS_KEY_ID=your-access-key-id
|
25
|
+
export AWS_SECRET_ACCESS_KEY=your-secret-access-key
|
26
|
+
export AWS_REGION=your-region
|
27
|
+
```
|
28
|
+
|
21
29
|
## Usage
|
22
30
|
|
23
31
|
1. Execute `clean_lc` in your terminal.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: launch_configuration_cleaner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ryonext
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|
@@ -99,7 +99,6 @@ files:
|
|
99
99
|
- bin/clean_lc
|
100
100
|
- bin/console
|
101
101
|
- bin/setup
|
102
|
-
- cleaner.rb
|
103
102
|
- launch_configuration_cleaner.gemspec
|
104
103
|
- lib/launch_configuration_cleaner.rb
|
105
104
|
- lib/launch_configuration_cleaner/CLI.rb
|
data/cleaner.rb
DELETED
@@ -1,61 +0,0 @@
|
|
1
|
-
require "bundler"
|
2
|
-
Bundler.require
|
3
|
-
|
4
|
-
def client
|
5
|
-
@client ||= Aws::AutoScaling::Client.new(region: 'ap-southeast-1')
|
6
|
-
end
|
7
|
-
|
8
|
-
def launch_configurations
|
9
|
-
@launch_configurations ||= client.describe_launch_configurations.launch_configurations
|
10
|
-
end
|
11
|
-
|
12
|
-
def list_current_configurations
|
13
|
-
puts "These are your launch configurations"
|
14
|
-
puts "["
|
15
|
-
launch_configurations.each do |l|
|
16
|
-
puts " #{l.launch_configuration_name},"
|
17
|
-
end
|
18
|
-
puts "]"
|
19
|
-
end
|
20
|
-
|
21
|
-
def ask_delete_target
|
22
|
-
launch_configurations.map do |l|
|
23
|
-
puts "Do you want to delete #{l.launch_configuration_name}? (y/n)"
|
24
|
-
answer = gets.strip
|
25
|
-
if answer == "y"
|
26
|
-
puts "Delete #{l.launch_configuration_name} later..."
|
27
|
-
l
|
28
|
-
end
|
29
|
-
end.compact
|
30
|
-
end
|
31
|
-
|
32
|
-
def list_delete_target(delete_list)
|
33
|
-
puts "These launch configurations will be deleted."
|
34
|
-
puts "["
|
35
|
-
delete_list.each do |l|
|
36
|
-
puts " #{l.launch_configuration_name},"
|
37
|
-
end
|
38
|
-
puts "]"
|
39
|
-
end
|
40
|
-
|
41
|
-
delete_list = ask_delete_target
|
42
|
-
exit if delete_list.size == 0
|
43
|
-
|
44
|
-
list_delete_target(delete_list)
|
45
|
-
|
46
|
-
while true do
|
47
|
-
puts "Are you sure? (yes or no)"
|
48
|
-
final_answer = gets.strip
|
49
|
-
if final_answer == "yes"
|
50
|
-
delete_list.each do |l|
|
51
|
-
client.delete_launch_configuration(launch_configuration_name: l.launch_configuration_name)
|
52
|
-
end
|
53
|
-
puts "LaunchConfiguration have been deleted."
|
54
|
-
break
|
55
|
-
elsif final_answer == "no"
|
56
|
-
puts "Ok, canceled."
|
57
|
-
break
|
58
|
-
else
|
59
|
-
puts "Sorry, I don't understand your answer."
|
60
|
-
end
|
61
|
-
end
|