capistrano-rightscale 0.1

Sign up to get free protection for your applications and to get access to all the features.
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 Lachlan Donald
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Manifest ADDED
@@ -0,0 +1,5 @@
1
+ MIT-LICENSE
2
+ README.markdown
3
+ Rakefile
4
+ lib/capistrano/rightscale.rb
5
+ Manifest
data/README.markdown ADDED
@@ -0,0 +1,45 @@
1
+ capistrano-rightscale
2
+ =================================================
3
+
4
+ Capistrano plugin for associating Rightscale tags with roles.
5
+
6
+ Introduction
7
+ ============
8
+
9
+ [RightScale](http://www.rightscale.com) provides a service for managing deployments of servers in various clouds. Servers can be tagged with
10
+ machine tags. This plugin allows for specific tags in specific deployments to be mapped to Capistrano roles.
11
+
12
+ At present these mappings require several api calls, which are slow.
13
+
14
+ Installation
15
+ ============
16
+
17
+ `capistrano-ec2group` is provided as a Ruby gem, with the following dependencies:
18
+
19
+ * Capistrano >= 2.1.0
20
+ * Rightscale API
21
+
22
+ Usage
23
+ =====
24
+
25
+ In order to use the `capistrano-rightscale` plugin, you must require it in your Capfile:
26
+
27
+ require 'capistrano-rightscale'
28
+
29
+ Then you must specify your Rightscale API credentials:
30
+
31
+ set :rightscale_username, '???'
32
+ set :rightscale_password, '???'
33
+ set :rightscale_account, 12345
34
+
35
+ In order to define your roles, you defined the equivelent machine tags and deployment mappings:
36
+
37
+ tag :webserver, "x99:role=app", :deployment => 45678
38
+
39
+ Credits
40
+ =======
41
+ * capistrano-ec2group: [Logan Raarup](http://github.com/logandk)
42
+ * capistrano: [Jamis Buck](http://github.com/jamis/capistrano)
43
+
44
+
45
+ Copyright (c) 2010 Lachlan Donald, released under the MIT license
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'echoe'
4
+
5
+ Echoe.new('capistrano-rightscale', '0.1') do |p|
6
+ p.description = "An extension for capistrano for integrating roles with RightScale server tags"
7
+ p.url = "http://github.com/99designs/capistrano-rightscale"
8
+ p.author = "Lachlan Donald"
9
+ p.email = "lachlan@ljd.cc"
10
+ p.development_dependencies = []
11
+ p.runtime_dependencies = ["capistrano >=2.1.0", "rightscale-api"]
12
+ end
@@ -0,0 +1,38 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{capistrano-rightscale}
5
+ s.version = "0.1"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Lachlan Donald"]
9
+ s.cert_chain = ["/home/lachlan/certs/gem-public_cert.pem"]
10
+ s.date = %q{2010-10-13}
11
+ s.description = %q{An extension for capistrano for integrating roles with RightScale server tags}
12
+ s.email = %q{lachlan@ljd.cc}
13
+ s.extra_rdoc_files = ["README.markdown", "lib/capistrano/rightscale.rb"]
14
+ s.files = ["MIT-LICENSE", "README.markdown", "Rakefile", "lib/capistrano/rightscale.rb", "Manifest", "capistrano-rightscale.gemspec"]
15
+ s.homepage = %q{http://github.com/99designs/capistrano-rightscale}
16
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Capistrano-rightscale", "--main", "README.markdown"]
17
+ s.require_paths = ["lib"]
18
+ s.rubyforge_project = %q{capistrano-rightscale}
19
+ s.rubygems_version = %q{1.3.7}
20
+ s.signing_key = %q{/home/lachlan/certs/gem-private_key.pem}
21
+ s.summary = %q{An extension for capistrano for integrating roles with RightScale server tags}
22
+
23
+ if s.respond_to? :specification_version then
24
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
25
+ s.specification_version = 3
26
+
27
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
28
+ s.add_runtime_dependency(%q<capistrano>, [">= 2.1.0"])
29
+ s.add_runtime_dependency(%q<rightscale-api>, [">= 0"])
30
+ else
31
+ s.add_dependency(%q<capistrano>, [">= 2.1.0"])
32
+ s.add_dependency(%q<rightscale-api>, [">= 0"])
33
+ end
34
+ else
35
+ s.add_dependency(%q<capistrano>, [">= 2.1.0"])
36
+ s.add_dependency(%q<rightscale-api>, [">= 0"])
37
+ end
38
+ end
@@ -0,0 +1,34 @@
1
+ require 'rightscale-api'
2
+
3
+ module Capistrano
4
+ class Configuration
5
+ module Tags
6
+
7
+ # Associate a tag in a specific deployment with a role
8
+ # Examples:
9
+ # tag "x99:role=app", :app, :deployment => 45678
10
+ def tag(which, *args)
11
+ @rightscale ||= RightScale::Client.new(fetch(:rightscale_account), fetch(:rightscale_username), fetch(:rightscale_password))
12
+
13
+ base_url = "https://my.rightscale.com/api/acct/%d" % fetch(:rightscale_account)
14
+ deployment_url = base_url + "/deployments/%d" % args[1][:deployment]
15
+
16
+ # find servers with the right tag
17
+ tagged_servers = @rightscale.get(base_url + "/tags/search.js?resource_type=server&tags[]=%s" % which)
18
+ tagged_servers.each {|server|
19
+
20
+ if server['state'] == 'operational' && server['deployment_href'] == deployment_url
21
+ settings = @rightscale.servers.settings(server['href'])
22
+ pp settings['dns_name']
23
+ pp server['tags']
24
+ pp server['nickname']
25
+ pp server['deployment_href']
26
+ server(settings['dns_name'], *args)
27
+ end
28
+ }
29
+ end
30
+ end
31
+
32
+ include Tags
33
+ end
34
+ end
data.tar.gz.sig ADDED
Binary file
metadata ADDED
@@ -0,0 +1,127 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capistrano-rightscale
3
+ version: !ruby/object:Gem::Version
4
+ hash: 9
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ version: "0.1"
10
+ platform: ruby
11
+ authors:
12
+ - Lachlan Donald
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain:
16
+ - |
17
+ -----BEGIN CERTIFICATE-----
18
+ MIIDKjCCAhKgAwIBAgIBADANBgkqhkiG9w0BAQUFADA7MRAwDgYDVQQDDAdsYWNo
19
+ bGFuMRMwEQYKCZImiZPyLGQBGRYDbGpkMRIwEAYKCZImiZPyLGQBGRYCY2MwHhcN
20
+ MTAxMDEzMDIxNjE2WhcNMTExMDEzMDIxNjE2WjA7MRAwDgYDVQQDDAdsYWNobGFu
21
+ MRMwEQYKCZImiZPyLGQBGRYDbGpkMRIwEAYKCZImiZPyLGQBGRYCY2MwggEiMA0G
22
+ CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCkGWt+NIfbP2/foIOCUVMkqTZUl253
23
+ haPLEu1SosHPtzeRSP6Au6V9wciGUQA7l63oJX6hRsV7tJ2K6hVf5U7McF3Nwuto
24
+ peij70OA2o8LcCtmac4uptUHCHhSMw7KoaEH0IvNOaqrCbV7D0D0a1VyJknW/KS8
25
+ ogvgrlyqwwxHvisoW4qH2OPKNHNmqZ8mwlG8VESQo7JNChDwIAB226q6mUp9dYvO
26
+ pMpfcclkX4memRJBpDbbYkySIDTPvV7i1Om0o2v7H56yWk/a+L/Eclkm5UPbJo5v
27
+ qse2XxYTywl+VuQTatLdthSWRYxHjqldL5vkhkSIZeelE+BPgXPEOkL3AgMBAAGj
28
+ OTA3MAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQWBBRITW/yuerIqtxc
29
+ hhw57oibl49J0zANBgkqhkiG9w0BAQUFAAOCAQEANeRCrTO85EFoyDTbi6bcnQIv
30
+ 4mbq/nbxLURsx5x/wbKLvSdyEMN/+IgqafzqPZPmePekN+n3rcb6dP4pT2ro71zi
31
+ UIMO5hSkpBR3FpxCUf+W7U/p0qTHMTR1frnJ6FjEU7YiA931n0n68mturQxfbgP+
32
+ 5QqawtnB6O4pELxOkyeI7ZgkO1/w6wUKFBpyhvx8wqtWQx1QGsgMCwOUDRQhl2kE
33
+ ATJLxkT/9706Vy8/6i1s/JKXMpUC3L6+J3KGy5L6mC6EJ9xJdAHv35QcabfKgaMH
34
+ 5Dtt1ew5HAXFvbS7/eG+/M+bTAbYHSRD/dGR42fED5sK0/RPvfcqAYtM56Fplg==
35
+ -----END CERTIFICATE-----
36
+
37
+ date: 2010-10-13 00:00:00 +11:00
38
+ default_executable:
39
+ dependencies:
40
+ - !ruby/object:Gem::Dependency
41
+ name: capistrano
42
+ prerelease: false
43
+ requirement: &id001 !ruby/object:Gem::Requirement
44
+ none: false
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ hash: 11
49
+ segments:
50
+ - 2
51
+ - 1
52
+ - 0
53
+ version: 2.1.0
54
+ type: :runtime
55
+ version_requirements: *id001
56
+ - !ruby/object:Gem::Dependency
57
+ name: rightscale-api
58
+ prerelease: false
59
+ requirement: &id002 !ruby/object:Gem::Requirement
60
+ none: false
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ hash: 3
65
+ segments:
66
+ - 0
67
+ version: "0"
68
+ type: :runtime
69
+ version_requirements: *id002
70
+ description: An extension for capistrano for integrating roles with RightScale server tags
71
+ email: lachlan@ljd.cc
72
+ executables: []
73
+
74
+ extensions: []
75
+
76
+ extra_rdoc_files:
77
+ - README.markdown
78
+ - lib/capistrano/rightscale.rb
79
+ files:
80
+ - MIT-LICENSE
81
+ - README.markdown
82
+ - Rakefile
83
+ - lib/capistrano/rightscale.rb
84
+ - Manifest
85
+ - capistrano-rightscale.gemspec
86
+ has_rdoc: true
87
+ homepage: http://github.com/99designs/capistrano-rightscale
88
+ licenses: []
89
+
90
+ post_install_message:
91
+ rdoc_options:
92
+ - --line-numbers
93
+ - --inline-source
94
+ - --title
95
+ - Capistrano-rightscale
96
+ - --main
97
+ - README.markdown
98
+ require_paths:
99
+ - lib
100
+ required_ruby_version: !ruby/object:Gem::Requirement
101
+ none: false
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ hash: 3
106
+ segments:
107
+ - 0
108
+ version: "0"
109
+ required_rubygems_version: !ruby/object:Gem::Requirement
110
+ none: false
111
+ requirements:
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ hash: 11
115
+ segments:
116
+ - 1
117
+ - 2
118
+ version: "1.2"
119
+ requirements: []
120
+
121
+ rubyforge_project: capistrano-rightscale
122
+ rubygems_version: 1.3.7
123
+ signing_key:
124
+ specification_version: 3
125
+ summary: An extension for capistrano for integrating roles with RightScale server tags
126
+ test_files: []
127
+
metadata.gz.sig ADDED
Binary file