awful 0.0.5 → 0.0.6
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/lib/awful.rb +16 -3
- data/lib/awful/auto_scaling.rb +7 -6
- data/lib/awful/version.rb +1 -1
- 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: a489c3905456530f6bb1c8488efda13ad8855934
|
4
|
+
data.tar.gz: 9955d6190e62661d9bef504d13f915f43a8567a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19022988314be3f944afa42e4ed2e1e79a62d78301496dbe69be8534b45a182aba777053f72cb857f49ccc41e421dd4dc366e8ed16551a802bdd9889863571a5
|
7
|
+
data.tar.gz: 6235726073e5515af5a66b19b41d34048aea162adb11923d2659c4f7ded1330aea43bb32c5ed3690d3fe9ecf72d5e0e92f0574e6c408813bdf394562d1cd44ba
|
data/lib/awful.rb
CHANGED
@@ -3,6 +3,7 @@ require "awful/version"
|
|
3
3
|
require 'aws-sdk'
|
4
4
|
require 'thor'
|
5
5
|
require 'yaml'
|
6
|
+
require 'erb'
|
6
7
|
|
7
8
|
module Awful
|
8
9
|
|
@@ -42,9 +43,10 @@ module Awful
|
|
42
43
|
end
|
43
44
|
end
|
44
45
|
|
45
|
-
def load_cfg(options = {})
|
46
|
-
|
47
|
-
cfg.
|
46
|
+
def load_cfg(options = {}, file = nil)
|
47
|
+
src = (file and File.read(file)) || ((not $stdin.tty?) and $stdin.read)
|
48
|
+
cfg = src ? YAML.load(::ERB.new(src).result(binding)) : {}
|
49
|
+
symbolize_keys(cfg).merge(symbolize_keys(options.reject{ |_,v| v.nil? }))
|
48
50
|
end
|
49
51
|
|
50
52
|
def only_keys_matching(hash, keylist)
|
@@ -88,4 +90,15 @@ module Awful
|
|
88
90
|
end
|
89
91
|
end
|
90
92
|
|
93
|
+
## return id for security group by name
|
94
|
+
def find_sg(name)
|
95
|
+
if name.match(/^sg-[\d[a-f]]{8}$/)
|
96
|
+
name
|
97
|
+
else
|
98
|
+
ec2.describe_security_groups.map(&:security_groups).flatten.find do |sg|
|
99
|
+
tag_name(sg) == name
|
100
|
+
end.group_id
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
91
104
|
end
|
data/lib/awful/auto_scaling.rb
CHANGED
@@ -75,9 +75,9 @@ module Awful
|
|
75
75
|
puts YAML.dump(stringify_keys(asg))
|
76
76
|
end
|
77
77
|
|
78
|
-
desc 'create NAME', 'create a new auto-scaling group'
|
79
|
-
def create(name)
|
80
|
-
opt = load_cfg
|
78
|
+
desc 'create NAME [FILE]', 'create a new auto-scaling group'
|
79
|
+
def create(name, file = nil)
|
80
|
+
opt = load_cfg(options, file)
|
81
81
|
whitelist = %i[auto_scaling_group_name launch_configuration_name instance_id min_size max_size desired_capacity default_cooldown availability_zones
|
82
82
|
load_balancer_names health_check_type health_check_grace_period placement_group vpc_zone_identifier termination_policies tags ]
|
83
83
|
|
@@ -91,13 +91,14 @@ module Awful
|
|
91
91
|
autoscaling.create_auto_scaling_group(opt)
|
92
92
|
end
|
93
93
|
|
94
|
-
desc 'update NAME', 'update existing auto-scaling group'
|
94
|
+
desc 'update NAME [FILE]', 'update existing auto-scaling group'
|
95
95
|
method_option :desired_capacity, aliases: '-d', default: nil, desc: 'Set desired capacity'
|
96
96
|
method_option :min_size, aliases: '-m', default: nil, desc: 'Set minimum capacity'
|
97
97
|
method_option :max_size, aliases: '-M', default: nil, desc: 'Set maximum capacity'
|
98
98
|
method_option :launch_configuration_name, aliases: '-l', default: nil, desc: 'Launch config name'
|
99
|
-
def update(name)
|
100
|
-
opt = load_cfg(options)
|
99
|
+
def update(name, file = nil)
|
100
|
+
opt = load_cfg(options, file)
|
101
|
+
|
101
102
|
whitelist = %i[auto_scaling_group_name launch_configuration_name min_size max_size desired_capacity default_cooldown availability_zones
|
102
103
|
health_check_type health_check_grace_period placement_group vpc_zone_identifier termination_policies ]
|
103
104
|
|
data/lib/awful/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: awful
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ric Lister
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|