ey_cloud_awareness 0.1.9 → 0.1.11

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.9
1
+ 0.1.11
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ey_cloud_awareness}
8
- s.version = "0.1.9"
8
+ s.version = "0.1.11"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Seamus Abshere"]
12
- s.date = %q{2009-11-17}
12
+ s.date = %q{2010-02-11}
13
13
  s.description = %q{Make your EngineYard cloud instances aware of each other.}
14
14
  s.email = %q{seamus@abshere.net}
15
15
  s.extra_rdoc_files = [
@@ -57,19 +57,19 @@ class EngineYardCloudInstance
57
57
  end
58
58
 
59
59
  def app_master
60
- find_all_by_instance_roles(:app_master).first
60
+ find_all_by_instance_roles(:app_master).first || find_all_by_instance_roles(:solo).first
61
61
  end
62
62
 
63
63
  def db_master
64
- find_all_by_instance_roles(:db_master).first
64
+ find_all_by_instance_roles(:db_master).first || find_all_by_instance_roles(:solo).first
65
65
  end
66
66
 
67
67
  def app
68
- find_all_by_instance_roles :app, :app_master
68
+ find_all_by_instance_roles :app, :app_master, :solo
69
69
  end
70
70
 
71
71
  def db
72
- find_all_by_instance_roles :db_master, :db_slave
72
+ find_all_by_instance_roles :db_master, :db_slave, :solo
73
73
  end
74
74
 
75
75
  def utility
@@ -118,7 +118,9 @@ class EngineYardCloudInstance
118
118
  hash[instance_description[:aws_instance_id]] ||= Hash.new
119
119
  current = hash[instance_description[:aws_instance_id]]
120
120
  # using current as a pointer
121
- if dna[:db_host] == instance_description[:dns_name] or dna[:db_host] == instance_description[:private_dns_name]
121
+ if dna[:instance_role] == 'solo'
122
+ current[:instance_role] = 'solo'
123
+ elsif dna[:db_host] == instance_description[:dns_name] or dna[:db_host] == instance_description[:private_dns_name]
122
124
  current[:instance_role] = 'db_master'
123
125
  elsif Array.wrap(dna[:db_slaves]).include? instance_description[:private_dns_name]
124
126
  current[:instance_role] = 'db_slave'
@@ -75,7 +75,8 @@ end
75
75
  namespace :eyc do
76
76
  task :ssh, :roles => :app_master do
77
77
  replacement = []
78
- eyc_proxy.with_roles.each_with_index do |instance, index|
78
+ counter = 0
79
+ eyc_proxy.with_roles.each do |instance|
79
80
  case instance.instance_role
80
81
  when 'db_master'
81
82
  explanation = ''
@@ -83,9 +84,13 @@ namespace :eyc do
83
84
  when 'app_master'
84
85
  explanation = ''
85
86
  shorthand = 'app_master'
87
+ when 'solo'
88
+ explanation = ''
89
+ shorthand = 'solo'
86
90
  else
87
- explanation = " (#{index})"
88
- shorthand = "#{instance.instance_role}#{index}"
91
+ explanation = " (#{counter})"
92
+ shorthand = "#{instance.instance_role}#{counter}"
93
+ counter += 1
89
94
  end
90
95
  replacement << %{
91
96
  # #{instance.instance_role}#{explanation}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ey_cloud_awareness
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seamus Abshere
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-17 00:00:00 -05:00
12
+ date: 2010-02-11 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency