capify-ec2 1.2.9 → 1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/capify-ec2.rb +10 -4
- data/lib/capify-ec2/capistrano.rb +9 -3
- data/lib/capify-ec2/version.rb +2 -1
- data/readme.md +12 -1
- metadata +57 -73
data/lib/capify-ec2.rb
CHANGED
@@ -15,6 +15,12 @@ class CapifyEc2
|
|
15
15
|
@ec2_config = ec2_config
|
16
16
|
when String
|
17
17
|
@ec2_config = YAML.load_file ec2_config
|
18
|
+
|
19
|
+
# Maintain backward compatibility with previous config format
|
20
|
+
@ec2_config[:project_tags] ||= []
|
21
|
+
# User can change the Roles tag string
|
22
|
+
@ec2_config[:aws_roles_tag] ||= "Roles"
|
23
|
+
@ec2_config[:project_tags] << @ec2_config[:project_tag] if @ec2_config[:project_tag]
|
18
24
|
else
|
19
25
|
raise ArgumentError, "Invalid ec2_config: #{ec2_config.inspect}"
|
20
26
|
end
|
@@ -39,7 +45,7 @@ class CapifyEc2
|
|
39
45
|
desired_instances.each_with_index do |instance, i|
|
40
46
|
puts sprintf "%02d: %-40s %-20s %-20s %-62s %-20s (%s) (%s)",
|
41
47
|
i, (instance.name || "").green, instance.id.red, instance.flavor_id.cyan,
|
42
|
-
instance.contact_point.blue, instance.availability_zone.magenta, (instance.tags[
|
48
|
+
instance.contact_point.blue, instance.availability_zone.magenta, (instance.tags[@ec2_config[:aws_roles_tag]] || "").yellow,
|
43
49
|
(instance.tags["Options"] || "").yellow
|
44
50
|
end
|
45
51
|
end
|
@@ -49,15 +55,15 @@ class CapifyEc2
|
|
49
55
|
end
|
50
56
|
|
51
57
|
def project_instances
|
52
|
-
@instances.select {|instance| instance.tags["Project"]
|
58
|
+
@instances.select {|instance| @ec2_config[:project_tags].include?(instance.tags["Project"])}
|
53
59
|
end
|
54
60
|
|
55
61
|
def desired_instances(region = nil)
|
56
|
-
@ec2_config[:
|
62
|
+
@ec2_config[:project_tags].empty? ? @instances : project_instances
|
57
63
|
end
|
58
64
|
|
59
65
|
def get_instances_by_role(role)
|
60
|
-
desired_instances.select {|instance| instance.tags[
|
66
|
+
desired_instances.select {|instance| instance.tags[@ec2_config[:aws_roles_tag]].split(%r{,\s*}).include?(role.to_s) rescue false}
|
61
67
|
end
|
62
68
|
|
63
69
|
def get_instances_by_region(roles, region)
|
@@ -61,7 +61,14 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
61
61
|
task named_instance.name.to_sym do
|
62
62
|
remove_default_roles
|
63
63
|
server_address = named_instance.contact_point
|
64
|
-
|
64
|
+
|
65
|
+
if named_instance.respond_to?(:roles)
|
66
|
+
roles = named_instance.roles
|
67
|
+
else
|
68
|
+
roles = [named_instance.tags["Roles"]].flatten
|
69
|
+
end
|
70
|
+
|
71
|
+
roles.each do |role|
|
65
72
|
define_role({:name => role, :options => {:on_no_matching_servers => :continue}}, named_instance)
|
66
73
|
end
|
67
74
|
end unless named_instance.nil?
|
@@ -142,5 +149,4 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
142
149
|
roles.reject! { true }
|
143
150
|
end
|
144
151
|
|
145
|
-
|
146
|
-
end
|
152
|
+
end
|
data/lib/capify-ec2/version.rb
CHANGED
data/readme.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
Capify Ec2 is no longer being maintained. It has been superseded by capify-cloud, which adds Brightbox integration.
|
2
|
+
You may continue to use this as long as you like, but active development and gems will now be found under the capify-cloud moniker.
|
3
|
+
https://github.com/forward/capify-cloud
|
4
|
+
|
5
|
+
|
1
6
|
Capify Ec2
|
2
7
|
====================================================
|
3
8
|
|
@@ -175,7 +180,13 @@ health.
|
|
175
180
|
|
176
181
|
The :project_tag parameter is optional. It will limit any commands to
|
177
182
|
running against those instances with a "Project" tag set to the value
|
178
|
-
"YOUR APP NAME".
|
183
|
+
"YOUR APP NAME". It is also possible to apply commands to multiple projects using the :project_tags parameter, like so:
|
184
|
+
|
185
|
+
```ruby
|
186
|
+
:project_tags:
|
187
|
+
- "YOUR APP NAME"
|
188
|
+
- "YOUR OTHER APP NAME"
|
189
|
+
```
|
179
190
|
|
180
191
|
## Development
|
181
192
|
|
metadata
CHANGED
@@ -1,79 +1,73 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: capify-ec2
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '1.3'
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 2
|
9
|
-
- 9
|
10
|
-
version: 1.2.9
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Noah Cantor
|
14
9
|
- Siddharth Dawara
|
15
10
|
autorequire:
|
16
11
|
bindir: bin
|
17
12
|
cert_chain: []
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
- !ruby/object:Gem::Dependency
|
13
|
+
date: 2012-10-02 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
22
16
|
name: fog
|
23
|
-
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
25
18
|
none: false
|
26
|
-
requirements:
|
27
|
-
- -
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
hash: 25
|
30
|
-
segments:
|
31
|
-
- 1
|
32
|
-
- 3
|
33
|
-
- 1
|
19
|
+
requirements:
|
20
|
+
- - '='
|
21
|
+
- !ruby/object:Gem::Version
|
34
22
|
version: 1.3.1
|
35
23
|
type: :runtime
|
36
|
-
version_requirements: *id001
|
37
|
-
- !ruby/object:Gem::Dependency
|
38
|
-
name: colored
|
39
24
|
prerelease: false
|
40
|
-
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - '='
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: 1.3.1
|
31
|
+
- !ruby/object:Gem::Dependency
|
32
|
+
name: colored
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
41
34
|
none: false
|
42
|
-
requirements:
|
43
|
-
- -
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
|
46
|
-
segments:
|
47
|
-
- 1
|
48
|
-
- 2
|
49
|
-
version: "1.2"
|
35
|
+
requirements:
|
36
|
+
- - '='
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '1.2'
|
50
39
|
type: :runtime
|
51
|
-
version_requirements: *id002
|
52
|
-
- !ruby/object:Gem::Dependency
|
53
|
-
name: capistrano
|
54
40
|
prerelease: false
|
55
|
-
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - '='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '1.2'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: capistrano
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
56
50
|
none: false
|
57
|
-
requirements:
|
58
|
-
- -
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
|
61
|
-
segments:
|
62
|
-
- 0
|
63
|
-
version: "0"
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
64
55
|
type: :runtime
|
65
|
-
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ! '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
66
63
|
description: Grabs roles from ec2's tags and autogenerates capistrano tasks
|
67
|
-
email:
|
64
|
+
email:
|
68
65
|
- noah.cantor@forward.co.uk
|
69
66
|
- siddharth.dawara@forward.co.uk
|
70
67
|
executables: []
|
71
|
-
|
72
68
|
extensions: []
|
73
|
-
|
74
69
|
extra_rdoc_files: []
|
75
|
-
|
76
|
-
files:
|
70
|
+
files:
|
77
71
|
- .gitignore
|
78
72
|
- Changelog.md
|
79
73
|
- Gemfile
|
@@ -87,36 +81,26 @@ files:
|
|
87
81
|
- readme.md
|
88
82
|
homepage: http://github.com/forward/capify-ec2
|
89
83
|
licenses: []
|
90
|
-
|
91
84
|
post_install_message:
|
92
85
|
rdoc_options: []
|
93
|
-
|
94
|
-
require_paths:
|
86
|
+
require_paths:
|
95
87
|
- lib
|
96
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
88
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
97
89
|
none: false
|
98
|
-
requirements:
|
99
|
-
- -
|
100
|
-
- !ruby/object:Gem::Version
|
101
|
-
|
102
|
-
|
103
|
-
- 0
|
104
|
-
version: "0"
|
105
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
95
|
none: false
|
107
|
-
requirements:
|
108
|
-
- -
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
|
111
|
-
segments:
|
112
|
-
- 0
|
113
|
-
version: "0"
|
96
|
+
requirements:
|
97
|
+
- - ! '>='
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
114
100
|
requirements: []
|
115
|
-
|
116
101
|
rubyforge_project: capify-ec2
|
117
102
|
rubygems_version: 1.8.24
|
118
103
|
signing_key:
|
119
104
|
specification_version: 3
|
120
105
|
summary: Grabs roles from ec2's tags and autogenerates capistrano tasks
|
121
106
|
test_files: []
|
122
|
-
|