capistrano-rightscale 0.1 → 0.2.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.
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ Manifest
2
+ Capfile
3
+ pkg/
4
+ *.gemspec
5
+ tmp/*
data/README.markdown CHANGED
@@ -14,7 +14,7 @@ At present these mappings require several api calls, which are slow.
14
14
  Installation
15
15
  ============
16
16
 
17
- `capistrano-ec2group` is provided as a Ruby gem, with the following dependencies:
17
+ `capistrano-rightscale` is provided as a Ruby gem, with the following dependencies:
18
18
 
19
19
  * Capistrano >= 2.1.0
20
20
  * Rightscale API
data/Rakefile CHANGED
@@ -1,12 +1,18 @@
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"]
1
+ begin
2
+ require 'jeweler'
3
+ Jeweler::Tasks.new do |gemspec|
4
+ gemspec.name = "capistrano-rightscale"
5
+ gemspec.summary = "An extension for capistrano for integrating roles with RightScale server tags"
6
+ gemspec.description = "An extension for capistrano for integrating roles with RightScale server tags"
7
+ gemspec.email = "lachlan@ljd.cc"
8
+ gemspec.homepage = "http://github.com/99designs/capistrano-rightscale"
9
+ gemspec.authors = ["Lachlan Donald"]
10
+ gemspec.add_dependency('capistrano', '>= 2.1.0')
11
+ gemspec.add_dependency('rightscale-api')
12
+ end
13
+ Jeweler::GemcutterTasks.new
14
+ rescue LoadError
15
+ puts "Jeweler, or one of its dependencies, is not available. Install it with: gem install jeweler"
12
16
  end
17
+
18
+
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.2.0
@@ -9,23 +9,29 @@ module Capistrano
9
9
  # tag "x99:role=app", :app, :deployment => 45678
10
10
  def tag(which, *args)
11
11
  @rightscale ||= RightScale::Client.new(fetch(:rightscale_account), fetch(:rightscale_username), fetch(:rightscale_password))
12
+ @deployments ||= @rightscale.deployments
13
+ @servers ||= @rightscale.servers
12
14
 
13
- base_url = "https://my.rightscale.com/api/acct/%d" % fetch(:rightscale_account)
14
- deployment_url = base_url + "/deployments/%d" % args[1][:deployment]
15
+ logger.info "querying rightscale for deployment %s" % args[1][:deployment]
16
+ deployment = @deployments.index.find { |d| d['href'] == rightscale_url("/deployments/%d" % args[1][:deployment]) }
15
17
 
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']
18
+ deployment['servers'].each do |server|
19
+ if server['state'] == 'operational' && tags_for_server(server).include?(which)
20
+ settings = @servers.settings(server['href'])
21
+ logger.info "found server %s (%s) with tag %s" % [ settings['dns_name'], server['nickname'], which ]
26
22
  server(settings['dns_name'], *args)
27
23
  end
28
- }
24
+ end
25
+ end
26
+
27
+ def tags_for_server(server)
28
+ instance_id = server["current_instance_href"].split('/').last
29
+ tags = @rightscale.get(rightscale_url("/tags/search.js?resource_href=/ec2_instances/%d" % instance_id))
30
+ tags.collect { |x| x["name"] }
31
+ end
32
+
33
+ def rightscale_url(path)
34
+ "https://my.rightscale.com/api/acct/%d%s" % [ fetch(:rightscale_account), path ]
29
35
  end
30
36
  end
31
37
 
metadata CHANGED
@@ -1,38 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-rightscale
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 1
9
- version: "0.1"
8
+ - 2
9
+ - 0
10
+ version: 0.2.0
10
11
  platform: ruby
11
12
  authors:
12
13
  - Lachlan Donald
13
14
  autorequire:
14
15
  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-----
16
+ cert_chain: []
36
17
 
37
18
  date: 2010-10-13 00:00:00 +11:00
38
19
  default_executable:
@@ -75,26 +56,20 @@ extensions: []
75
56
 
76
57
  extra_rdoc_files:
77
58
  - README.markdown
78
- - lib/capistrano/rightscale.rb
79
59
  files:
60
+ - .gitignore
80
61
  - MIT-LICENSE
81
62
  - README.markdown
82
63
  - Rakefile
64
+ - VERSION
83
65
  - lib/capistrano/rightscale.rb
84
- - Manifest
85
- - capistrano-rightscale.gemspec
86
66
  has_rdoc: true
87
67
  homepage: http://github.com/99designs/capistrano-rightscale
88
68
  licenses: []
89
69
 
90
70
  post_install_message:
91
71
  rdoc_options:
92
- - --line-numbers
93
- - --inline-source
94
- - --title
95
- - Capistrano-rightscale
96
- - --main
97
- - README.markdown
72
+ - --charset=UTF-8
98
73
  require_paths:
99
74
  - lib
100
75
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -111,14 +86,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
111
86
  requirements:
112
87
  - - ">="
113
88
  - !ruby/object:Gem::Version
114
- hash: 11
89
+ hash: 3
115
90
  segments:
116
- - 1
117
- - 2
118
- version: "1.2"
91
+ - 0
92
+ version: "0"
119
93
  requirements: []
120
94
 
121
- rubyforge_project: capistrano-rightscale
95
+ rubyforge_project:
122
96
  rubygems_version: 1.3.7
123
97
  signing_key:
124
98
  specification_version: 3
data/Manifest DELETED
@@ -1,5 +0,0 @@
1
- MIT-LICENSE
2
- README.markdown
3
- Rakefile
4
- lib/capistrano/rightscale.rb
5
- Manifest
@@ -1,38 +0,0 @@
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
data.tar.gz.sig DELETED
Binary file
metadata.gz.sig DELETED
Binary file