engineyard-metadata 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/engineyard-metadata.gemspec +2 -2
- data/lib/engineyard-metadata/chef_dna.rb +32 -6
- data/lib/engineyard-metadata/metadata.rb +4 -0
- data/spec/metadata_spec.rb +17 -1
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.4
|
data/engineyard-metadata.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{engineyard-metadata}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.4"
|
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{2010-10-
|
12
|
+
s.date = %q{2010-10-11}
|
13
13
|
s.description = %q{Pulls metadata from EC2 and EngineYard so that your EngineYard AppCloud (Amazon EC2) instances know about each other.}
|
14
14
|
s.email = %q{seamus@abshere.net}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -65,6 +65,11 @@ module EY
|
|
65
65
|
def app_servers
|
66
66
|
data['engineyard']['environment']['instances'].select { |i| %w{ app_master app solo }.include? i['role'] }.map { |i| i['public_hostname'] }.sort
|
67
67
|
end
|
68
|
+
|
69
|
+
# The public hostnames of all the app slaves.
|
70
|
+
def app_slaves
|
71
|
+
data['engineyard']['environment']['instances'].select { |i| %w{ app }.include? i['role'] }.map { |i| i['public_hostname'] }.sort
|
72
|
+
end
|
68
73
|
|
69
74
|
# The public hostnames of all the db servers.
|
70
75
|
#
|
@@ -73,6 +78,11 @@ module EY
|
|
73
78
|
data['engineyard']['environment']['instances'].select { |i| %w{ db_master db_slave solo }.include? i['role'] }.map { |i| i['public_hostname'] }.sort
|
74
79
|
end
|
75
80
|
|
81
|
+
# The public hostnames of all the db slaves.
|
82
|
+
def db_slaves
|
83
|
+
data['engineyard']['environment']['instances'].select { |i| %w{ db_slave }.include? i['role'] }.map { |i| i['public_hostname'] }.sort
|
84
|
+
end
|
85
|
+
|
76
86
|
# The public hostnames of all the utility servers.
|
77
87
|
#
|
78
88
|
# If you're on a solo app, it counts the solo as a utility.
|
@@ -82,16 +92,27 @@ module EY
|
|
82
92
|
|
83
93
|
# The public hostname of the app_master.
|
84
94
|
def app_master
|
85
|
-
|
86
|
-
|
87
|
-
|
95
|
+
if x = data['engineyard']['environment']['instances'].detect { |i| i['role'] == 'app_master' }
|
96
|
+
x['public_hostname']
|
97
|
+
else
|
98
|
+
solo
|
99
|
+
end
|
88
100
|
end
|
89
101
|
|
90
102
|
# The public hostname of the db_master,
|
91
103
|
def db_master
|
92
|
-
|
93
|
-
|
94
|
-
|
104
|
+
if x = data['engineyard']['environment']['instances'].detect { |i| i['role'] == 'db_master' }
|
105
|
+
x['public_hostname']
|
106
|
+
else
|
107
|
+
solo
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
# The public hostname of the solo.
|
112
|
+
def solo
|
113
|
+
if x = data['engineyard']['environment']['instances'].detect { |i| i['role'] == 'solo' }
|
114
|
+
x['public_hostname']
|
115
|
+
end
|
95
116
|
end
|
96
117
|
|
97
118
|
# The shell command for mysql, including username, password, hostname and database
|
@@ -103,6 +124,11 @@ module EY
|
|
103
124
|
def mysqldump_command
|
104
125
|
"#{MYSQLDUMP_BIN} -h #{database_host} -u #{database_username} -p#{database_password} #{database_name}"
|
105
126
|
end
|
127
|
+
|
128
|
+
# The name of the EngineYard AppCloud environment.
|
129
|
+
def environment_name
|
130
|
+
data['environment']['name']
|
131
|
+
end
|
106
132
|
end
|
107
133
|
end
|
108
134
|
end
|
data/spec/metadata_spec.rb
CHANGED
@@ -55,7 +55,7 @@ describe EY::Metadata do
|
|
55
55
|
EY::Metadata.db_servers.should == [ 'db_master.compute-1.amazonaws.com', 'db_slave_1.compute-1.amazonaws.com' ]
|
56
56
|
end
|
57
57
|
|
58
|
-
it 'gets the
|
58
|
+
it 'gets the utilities hostnames' do
|
59
59
|
EY::Metadata.utilities.should == [ 'util_1.compute-1.amazonaws.com' ]
|
60
60
|
end
|
61
61
|
|
@@ -74,4 +74,20 @@ describe EY::Metadata do
|
|
74
74
|
it 'gets the mysqldump command' do
|
75
75
|
EY::Metadata.mysqldump_command.should == '/usr/bin/mysqldump -h external_db_master.compute-1.amazonaws.com -u USERS-0-USERNAME -pUSERS-0-PASSWORD APPS-0-DATABASE_NAME'
|
76
76
|
end
|
77
|
+
|
78
|
+
it 'gets the db slave hostnames' do
|
79
|
+
EY::Metadata.db_slaves.should == [ 'db_slave_1.compute-1.amazonaws.com' ]
|
80
|
+
end
|
81
|
+
|
82
|
+
it 'gets the app slave hostnames' do
|
83
|
+
EY::Metadata.app_slaves.should == [ 'app_1.compute-1.amazonaws.com' ]
|
84
|
+
end
|
85
|
+
|
86
|
+
it 'gets the solo hostname' do
|
87
|
+
EY::Metadata.solo.should == nil
|
88
|
+
end
|
89
|
+
|
90
|
+
it 'gets the environment name' do
|
91
|
+
EY::Metadata.environment_name.should == 'APP-NAME_production'
|
92
|
+
end
|
77
93
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: engineyard-metadata
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Seamus Abshere
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-10-
|
18
|
+
date: 2010-10-11 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|