engineyard 0.9.0 → 0.10.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/lib/engineyard/cli.rb +34 -9
- data/lib/engineyard/cli/web.rb +2 -2
- data/lib/engineyard/collection/apps.rb +1 -1
- data/lib/engineyard/collection/environments.rb +1 -1
- data/lib/engineyard/error.rb +17 -5
- data/lib/engineyard/model/environment.rb +5 -5
- data/lib/engineyard/model/instance.rb +17 -17
- data/lib/engineyard/thor.rb +2 -2
- data/lib/engineyard/version.rb +1 -1
- data/spec/engineyard/cli_spec.rb +1 -1
- data/spec/engineyard/collection/{apps.rb → apps_spec.rb} +0 -0
- data/spec/engineyard/collection/{environments.rb → environments_spec.rb} +0 -0
- data/spec/engineyard/model/environment_spec.rb +2 -2
- data/spec/ey/deploy_spec.rb +10 -10
- data/spec/ey/rollback_spec.rb +3 -3
- data/spec/ey/ssh_spec.rb +83 -7
- data/spec/ey/web/disable_spec.rb +2 -2
- data/spec/ey/web/enable_spec.rb +2 -2
- data/spec/support/fake_awsm.ru +38 -0
- data/spec/support/shared_behavior.rb +7 -7
- metadata +5 -5
data/lib/engineyard/cli.rb
CHANGED
@@ -59,7 +59,7 @@ module EY
|
|
59
59
|
|
60
60
|
EY.ui.info "Connecting to the server..."
|
61
61
|
|
62
|
-
|
62
|
+
loudly_check_eydeploy(environment)
|
63
63
|
|
64
64
|
EY.ui.info "Beginning deploy for '#{app.name}' in '#{environment.name}' on server..."
|
65
65
|
|
@@ -132,7 +132,7 @@ module EY
|
|
132
132
|
app = fetch_app(options[:app])
|
133
133
|
env = fetch_environment(options[:environment], app)
|
134
134
|
|
135
|
-
|
135
|
+
loudly_check_eydeploy(env)
|
136
136
|
|
137
137
|
EY.ui.info("Rolling back '#{app.name}' in '#{env.name}'")
|
138
138
|
if env.rollback(app, options[:verbose])
|
@@ -142,20 +142,45 @@ module EY
|
|
142
142
|
end
|
143
143
|
end
|
144
144
|
|
145
|
-
desc "ssh [--environment ENVIRONMENT]", "Open an ssh session."
|
145
|
+
desc "ssh [COMMAND] [--all] [--environment ENVIRONMENT]", "Open an ssh session, or run a command."
|
146
146
|
long_desc <<-DESC
|
147
|
-
If
|
148
|
-
|
147
|
+
If a command is supplied, it will be run, otherwise a session will be
|
148
|
+
opened. The application master is used for environments with clusters.
|
149
|
+
Option --all requires a command to be supplied and runs it on all servers.
|
150
|
+
|
151
|
+
Note: this command is a bit picky about its ordering. To run a command with arguments on
|
152
|
+
all servers, like "rm -f /some/file", you need to order it like so:
|
153
|
+
|
154
|
+
$ #{banner_base} ssh "rm -f /some/file" -e my-environment --all
|
149
155
|
DESC
|
150
156
|
method_option :environment, :type => :string, :aliases => %w(-e),
|
151
157
|
:desc => "Environment to ssh into"
|
152
|
-
|
158
|
+
method_option :all, :type => :boolean, :aliases => %(-a),
|
159
|
+
:desc => "Run command on all servers"
|
160
|
+
|
161
|
+
def ssh(cmd=nil)
|
153
162
|
env = fetch_environment(options[:environment])
|
154
163
|
|
155
|
-
if
|
156
|
-
|
164
|
+
if options[:all]
|
165
|
+
raise NoCommandError.new unless cmd
|
166
|
+
|
167
|
+
hosts = env.instances.map do |instance|
|
168
|
+
instance.public_hostname
|
169
|
+
end
|
170
|
+
|
171
|
+
if hosts.empty?
|
172
|
+
raise NoInstancesError.new(env.name)
|
173
|
+
else
|
174
|
+
hosts.each do |host|
|
175
|
+
system "ssh #{env.username}@#{host} #{cmd}"
|
176
|
+
end
|
177
|
+
end
|
157
178
|
else
|
158
|
-
|
179
|
+
if env.app_master
|
180
|
+
system "ssh #{env.username}@#{env.app_master.public_hostname} #{cmd}"
|
181
|
+
else
|
182
|
+
raise NoAppMasterError.new(env.name)
|
183
|
+
end
|
159
184
|
end
|
160
185
|
end
|
161
186
|
|
data/lib/engineyard/cli/web.rb
CHANGED
@@ -12,7 +12,7 @@ module EY
|
|
12
12
|
def enable
|
13
13
|
app = fetch_app(options[:app])
|
14
14
|
environment = fetch_environment(options[:environment], app)
|
15
|
-
|
15
|
+
loudly_check_eydeploy(environment)
|
16
16
|
EY.ui.info "Taking down maintenance page for '#{app.name}' in '#{environment.name}'"
|
17
17
|
environment.take_down_maintenance_page(app, options[:verbose])
|
18
18
|
end
|
@@ -39,7 +39,7 @@ module EY
|
|
39
39
|
def disable
|
40
40
|
app = fetch_app(options[:app])
|
41
41
|
environment = fetch_environment(options[:environment], app)
|
42
|
-
|
42
|
+
loudly_check_eydeploy(environment)
|
43
43
|
EY.ui.info "Putting up maintenance page for '#{app.name}' in '#{environment.name}'"
|
44
44
|
environment.put_up_maintenance_page(app, options[:verbose])
|
45
45
|
end
|
data/lib/engineyard/error.rb
CHANGED
@@ -7,6 +7,12 @@ module EY
|
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
10
|
+
class NoCommandError < EY::Error
|
11
|
+
def initialize
|
12
|
+
super "Must specify a command to run via ssh"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
10
16
|
class NoRemotesError < EY::Error
|
11
17
|
def initialize(path)
|
12
18
|
super "fatal: No git remotes found in #{path}"
|
@@ -29,19 +35,25 @@ module EY
|
|
29
35
|
end
|
30
36
|
end
|
31
37
|
|
32
|
-
class
|
38
|
+
class AmbiguousAppNameError < EY::Error
|
33
39
|
def initialize(name, matches)
|
34
40
|
super ambiguous("app", name, matches)
|
35
41
|
end
|
36
42
|
end
|
37
43
|
|
38
|
-
class
|
44
|
+
class NoAppMasterError < EY::Error
|
39
45
|
def initialize(env_name)
|
40
46
|
super "The environment '#{env_name}' does not have a master instance."
|
41
47
|
end
|
42
48
|
end
|
43
49
|
|
44
|
-
class
|
50
|
+
class NoInstancesError < EY::Error
|
51
|
+
def initialize(env_name)
|
52
|
+
super "The environment '#{env_name}' does not have any instances."
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
class BadAppMasterStatusError < EY::Error
|
45
57
|
def initialize(master_status)
|
46
58
|
super "Application master's status is not \"running\" (green); it is \"#{master_status}\"."
|
47
59
|
end
|
@@ -50,7 +62,7 @@ module EY
|
|
50
62
|
class EnvironmentError < EY::Error
|
51
63
|
end
|
52
64
|
|
53
|
-
class
|
65
|
+
class AmbiguousEnvironmentNameError < EY::EnvironmentError
|
54
66
|
def initialize(name, matches)
|
55
67
|
super ambiguous("environment", name, matches)
|
56
68
|
end
|
@@ -75,7 +87,7 @@ module EY
|
|
75
87
|
end
|
76
88
|
end
|
77
89
|
|
78
|
-
class
|
90
|
+
class BranchMismatchError < EY::Error
|
79
91
|
def initialize(default_branch, branch)
|
80
92
|
super %|Your deploy branch is set to "#{default_branch}".\n| +
|
81
93
|
%|If you want to deploy branch "#{branch}", use --ignore-default_branch.|
|
@@ -24,15 +24,15 @@ module EY
|
|
24
24
|
def app_master!
|
25
25
|
master = app_master
|
26
26
|
if master.nil?
|
27
|
-
raise
|
27
|
+
raise NoAppMasterError.new(name)
|
28
28
|
elsif !ignore_bad_master && master.status != "running"
|
29
|
-
raise
|
29
|
+
raise BadAppMasterStatusError.new(master.status)
|
30
30
|
end
|
31
31
|
master
|
32
32
|
end
|
33
33
|
|
34
|
-
def
|
35
|
-
app_master!.
|
34
|
+
def ensure_eydeploy_present(&blk)
|
35
|
+
app_master!.ensure_eydeploy_present(&blk)
|
36
36
|
end
|
37
37
|
|
38
38
|
def deploy(app, ref, migration_command=nil, verbose=false)
|
@@ -101,7 +101,7 @@ module EY
|
|
101
101
|
|
102
102
|
def resolve_branch(branch, allow_non_default_branch=false)
|
103
103
|
if !allow_non_default_branch && branch && default_branch && (branch != default_branch)
|
104
|
-
raise
|
104
|
+
raise BranchMismatchError.new(default_branch, branch)
|
105
105
|
end
|
106
106
|
branch || default_branch
|
107
107
|
end
|
@@ -3,11 +3,11 @@ require 'escape'
|
|
3
3
|
module EY
|
4
4
|
module Model
|
5
5
|
class Instance < ApiStruct.new(:id, :role, :name, :status, :amazon_id, :public_hostname, :environment)
|
6
|
-
|
6
|
+
EYDEPLOY_VERSION = ENV["EY_DEPLOY_VERSION"] || "0.9.1"
|
7
7
|
EXIT_STATUS = Hash.new { |h,k| raise EY::Error, "ey-deploy version checker exited with unknown status code #{k}" }
|
8
8
|
EXIT_STATUS.merge!({
|
9
9
|
255 => :ssh_failed,
|
10
|
-
1 => :
|
10
|
+
1 => :eydeploy_missing,
|
11
11
|
0 => :ok,
|
12
12
|
})
|
13
13
|
|
@@ -30,7 +30,7 @@ module EY
|
|
30
30
|
deploy_args << "--migrate" << migration_command
|
31
31
|
end
|
32
32
|
|
33
|
-
|
33
|
+
invoke_ey_deploy(deploy_args, verbose)
|
34
34
|
end
|
35
35
|
|
36
36
|
def rollback(app, extra_configuration=nil, verbose=false)
|
@@ -43,16 +43,16 @@ module EY
|
|
43
43
|
deploy_args << '--config' << extra_configuration.to_json
|
44
44
|
end
|
45
45
|
|
46
|
-
|
46
|
+
invoke_ey_deploy(deploy_args, verbose)
|
47
47
|
end
|
48
48
|
|
49
49
|
|
50
50
|
def put_up_maintenance_page(app, verbose=false)
|
51
|
-
|
51
|
+
invoke_ey_deploy(['enable_maintenance_page', '--app', app.name], verbose)
|
52
52
|
end
|
53
53
|
|
54
54
|
def take_down_maintenance_page(app, verbose=false)
|
55
|
-
|
55
|
+
invoke_ey_deploy(['disable_maintenance_page', '--app', app.name], verbose)
|
56
56
|
end
|
57
57
|
|
58
58
|
|
@@ -60,27 +60,27 @@ module EY
|
|
60
60
|
!["db_master", "db_slave"].include?(role.to_s)
|
61
61
|
end
|
62
62
|
|
63
|
-
def
|
64
|
-
case ey_deploy_check
|
63
|
+
def ensure_eydeploy_present
|
64
|
+
case eydeploy_status = ey_deploy_check
|
65
65
|
when :ssh_failed
|
66
66
|
raise EnvironmentError, "SSH connection to #{hostname} failed"
|
67
|
-
when :
|
67
|
+
when :eydeploy_missing
|
68
68
|
yield :installing if block_given?
|
69
69
|
install_ey_deploy
|
70
70
|
when :ok
|
71
71
|
# no action needed
|
72
72
|
else
|
73
|
-
raise EY::Error, "Internal error: Unexpected status from Instance#ey_deploy_check; got #{
|
73
|
+
raise EY::Error, "Internal error: Unexpected status from Instance#ey_deploy_check; got #{eydeploy_status.inspect}"
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
77
77
|
def ey_deploy_check
|
78
|
-
|
78
|
+
escaped_eydeploy_version = EYDEPLOY_VERSION.gsub(/\./, '\.')
|
79
79
|
|
80
80
|
if ENV["NO_SSH"]
|
81
81
|
:ok
|
82
82
|
else
|
83
|
-
ssh "#{gem_path} list ey-deploy | grep \"ey-deploy \" | egrep -q '#{
|
83
|
+
ssh "#{gem_path} list ey-deploy | grep \"ey-deploy \" | egrep -q '#{escaped_eydeploy_version}[,)]'", false
|
84
84
|
EXIT_STATUS[$?.exitstatus]
|
85
85
|
end
|
86
86
|
end
|
@@ -94,7 +94,7 @@ module EY
|
|
94
94
|
#
|
95
95
|
# rubygems help suggests that --remote will disable this
|
96
96
|
# behavior, but it doesn't.
|
97
|
-
"cd `mktemp -d` && #{gem_path} install ey-deploy --no-rdoc --no-ri -v #{
|
97
|
+
"cd `mktemp -d` && #{gem_path} install ey-deploy --no-rdoc --no-ri -v #{EYDEPLOY_VERSION}"]))
|
98
98
|
end
|
99
99
|
|
100
100
|
private
|
@@ -112,8 +112,8 @@ module EY
|
|
112
112
|
end
|
113
113
|
end
|
114
114
|
|
115
|
-
def
|
116
|
-
start = [
|
115
|
+
def invoke_ey_deploy(deploy_args, verbose=false)
|
116
|
+
start = [eydeploy_path, "_#{EYDEPLOY_VERSION}_", 'deploy']
|
117
117
|
instance_args = environment.instances.find_all do |inst|
|
118
118
|
inst.has_app_code?
|
119
119
|
end.inject(['--instances']) do |command, inst|
|
@@ -132,8 +132,8 @@ module EY
|
|
132
132
|
ssh cmd
|
133
133
|
end
|
134
134
|
|
135
|
-
def
|
136
|
-
"/usr/local/ey_resin/ruby/bin/
|
135
|
+
def eydeploy_path
|
136
|
+
"/usr/local/ey_resin/ruby/bin/ey-deploy"
|
137
137
|
end
|
138
138
|
|
139
139
|
def gem_path
|
data/lib/engineyard/thor.rb
CHANGED
@@ -77,8 +77,8 @@ module EY
|
|
77
77
|
@repo ||= EY::Repo.new
|
78
78
|
end
|
79
79
|
|
80
|
-
def
|
81
|
-
environment.
|
80
|
+
def loudly_check_eydeploy(environment)
|
81
|
+
environment.ensure_eydeploy_present do |action|
|
82
82
|
case action
|
83
83
|
when :installing
|
84
84
|
EY.ui.warn "Instance does not have server-side component installed"
|
data/lib/engineyard/version.rb
CHANGED
data/spec/engineyard/cli_spec.rb
CHANGED
File without changes
|
File without changes
|
@@ -112,7 +112,7 @@ describe "EY::Model::Environment#app_master!" do
|
|
112
112
|
env = make_env_with_master("status" => "error")
|
113
113
|
lambda {
|
114
114
|
env.app_master!
|
115
|
-
}.should raise_error(EY::
|
115
|
+
}.should raise_error(EY::BadAppMasterStatusError)
|
116
116
|
end
|
117
117
|
|
118
118
|
it "returns the app master if told to ignore the app master being in a non-running state" do
|
@@ -126,7 +126,7 @@ describe "EY::Model::Environment#app_master!" do
|
|
126
126
|
env = make_env_with_master(nil)
|
127
127
|
lambda {
|
128
128
|
env.app_master!
|
129
|
-
}.should raise_error(EY::
|
129
|
+
}.should raise_error(EY::NoAppMasterError)
|
130
130
|
end
|
131
131
|
end
|
132
132
|
|
data/spec/ey/deploy_spec.rb
CHANGED
@@ -37,13 +37,13 @@ describe "ey deploy" do
|
|
37
37
|
|
38
38
|
def verify_ran(scenario)
|
39
39
|
@out.should match(/Beginning deploy for.*#{scenario[:application]}.*#{scenario[:environment]}/)
|
40
|
-
@ssh_commands.should have_command_like(/
|
40
|
+
@ssh_commands.should have_command_like(/ey-deploy.*deploy.*--app #{scenario[:application]}/)
|
41
41
|
end
|
42
42
|
|
43
43
|
# common behavior
|
44
44
|
it_should_behave_like "it takes an environment name"
|
45
45
|
it_should_behave_like "it takes an app name"
|
46
|
-
it_should_behave_like "it invokes
|
46
|
+
it_should_behave_like "it invokes ey-deploy"
|
47
47
|
end
|
48
48
|
|
49
49
|
describe "ey deploy" do
|
@@ -81,20 +81,20 @@ describe "ey deploy" do
|
|
81
81
|
api_scenario "one app, one environment"
|
82
82
|
end
|
83
83
|
|
84
|
-
it "finds
|
84
|
+
it "finds ey-deploy despite its being buried in the filesystem" do
|
85
85
|
ey "deploy"
|
86
|
-
@ssh_commands.last.should =~ %r{/usr/local/ey_resin/ruby/bin/
|
86
|
+
@ssh_commands.last.should =~ %r{/usr/local/ey_resin/ruby/bin/ey-deploy}
|
87
87
|
end
|
88
88
|
|
89
89
|
it "defaults to 'rake db:migrate'" do
|
90
90
|
ey "deploy"
|
91
|
-
@ssh_commands.last.should =~ /
|
91
|
+
@ssh_commands.last.should =~ /ey-deploy.*deploy/
|
92
92
|
@ssh_commands.last.should =~ /--migrate 'rake db:migrate'/
|
93
93
|
end
|
94
94
|
|
95
95
|
it "can be disabled with --no-migrate" do
|
96
96
|
ey "deploy --no-migrate"
|
97
|
-
@ssh_commands.last.should =~ /
|
97
|
+
@ssh_commands.last.should =~ /ey-deploy.*deploy/
|
98
98
|
@ssh_commands.last.should_not =~ /--migrate/
|
99
99
|
end
|
100
100
|
end
|
@@ -155,7 +155,7 @@ describe "ey deploy" do
|
|
155
155
|
File.unlink("ey.yml")
|
156
156
|
end
|
157
157
|
|
158
|
-
it "gets passed along to
|
158
|
+
it "gets passed along to ey-deploy" do
|
159
159
|
ey "deploy"
|
160
160
|
@ssh_commands.last.should =~ /--config '\{\"bert\":\"ernie\"\}'/
|
161
161
|
end
|
@@ -232,14 +232,14 @@ describe "ey deploy" do
|
|
232
232
|
before(:all) do
|
233
233
|
api_scenario "one app, one environment", "user@git.host:path/to/repo.git"
|
234
234
|
ey "deploy"
|
235
|
-
@deploy_command = @ssh_commands.find {|c| c =~ /
|
235
|
+
@deploy_command = @ssh_commands.find {|c| c =~ /ey-deploy.*deploy/ }
|
236
236
|
end
|
237
237
|
|
238
|
-
it "passes along the repository URL to
|
238
|
+
it "passes along the repository URL to ey-deploy" do
|
239
239
|
@deploy_command.should =~ /--repo user@git.host:path\/to\/repo.git/
|
240
240
|
end
|
241
241
|
|
242
|
-
it "passes along the web server stack to
|
242
|
+
it "passes along the web server stack to ey-deploy" do
|
243
243
|
@deploy_command.should =~ /--stack nginx_mongrel/
|
244
244
|
end
|
245
245
|
end
|
data/spec/ey/rollback_spec.rb
CHANGED
@@ -14,14 +14,14 @@ describe "ey rollback" do
|
|
14
14
|
def verify_ran(scenario)
|
15
15
|
@out.should match(/Rolling back.*#{scenario[:application]}.*#{scenario[:environment]}/)
|
16
16
|
@err.should be_empty
|
17
|
-
@ssh_commands.last.should match(/
|
17
|
+
@ssh_commands.last.should match(/ey-deploy.*deploy rollback.*--app #{scenario[:application]}/)
|
18
18
|
end
|
19
19
|
|
20
20
|
it_should_behave_like "it takes an environment name"
|
21
21
|
it_should_behave_like "it takes an app name"
|
22
|
-
it_should_behave_like "it invokes
|
22
|
+
it_should_behave_like "it invokes ey-deploy"
|
23
23
|
|
24
|
-
it "passes along the web server stack to
|
24
|
+
it "passes along the web server stack to ey-deploy" do
|
25
25
|
api_scenario "one app, one environment"
|
26
26
|
ey "rollback"
|
27
27
|
@ssh_commands.last.should =~ /--stack nginx_mongrel/
|
data/spec/ey/ssh_spec.rb
CHANGED
@@ -2,8 +2,17 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
print_my_args_ssh = "#!/bin/sh\necho ssh $*"
|
4
4
|
|
5
|
-
|
5
|
+
shared_examples_for "running ey ssh" do
|
6
6
|
given "integration"
|
7
|
+
include Spec::Helpers::SharedIntegrationTestUtils
|
8
|
+
|
9
|
+
def extra_ey_options
|
10
|
+
{:prepend_to_path => {'ssh' => "#!/bin/sh\necho ssh $*"}}
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "ey ssh" do
|
15
|
+
it_should_behave_like "running ey ssh"
|
7
16
|
|
8
17
|
before(:all) do
|
9
18
|
api_scenario "one app, many environments"
|
@@ -16,12 +25,8 @@ describe "ey ssh" do
|
|
16
25
|
|
17
26
|
end
|
18
27
|
|
19
|
-
describe "ey ssh" do
|
20
|
-
|
21
|
-
|
22
|
-
def extra_ey_options
|
23
|
-
{:prepend_to_path => {'ssh' => "#!/bin/sh\necho ssh $*"}}
|
24
|
-
end
|
28
|
+
describe "ey ssh without a command" do
|
29
|
+
it_should_behave_like "running ey ssh"
|
25
30
|
|
26
31
|
def command_to_run(opts)
|
27
32
|
cmd = "ssh"
|
@@ -36,3 +41,74 @@ describe "ey ssh" do
|
|
36
41
|
|
37
42
|
it_should_behave_like "it takes an environment name"
|
38
43
|
end
|
44
|
+
|
45
|
+
describe "ey ssh with a command" do
|
46
|
+
it_should_behave_like "running ey ssh"
|
47
|
+
|
48
|
+
def command_to_run(opts)
|
49
|
+
cmd = "ssh ls"
|
50
|
+
cmd << " --environment #{opts[:env]}" if opts[:env]
|
51
|
+
cmd
|
52
|
+
end
|
53
|
+
|
54
|
+
def verify_ran(scenario)
|
55
|
+
ssh_target = scenario[:ssh_username] + '@' + scenario[:master_hostname]
|
56
|
+
@raw_ssh_commands.should == ["ssh #{ssh_target} ls"]
|
57
|
+
end
|
58
|
+
|
59
|
+
it_should_behave_like "it takes an environment name"
|
60
|
+
end
|
61
|
+
|
62
|
+
|
63
|
+
describe "ey ssh --all with a command" do
|
64
|
+
it_should_behave_like "running ey ssh"
|
65
|
+
|
66
|
+
def command_to_run(opts)
|
67
|
+
cmd = "ssh ls"
|
68
|
+
cmd << " --all"
|
69
|
+
cmd << " --environment #{opts[:env]}" if opts[:env]
|
70
|
+
cmd
|
71
|
+
end
|
72
|
+
|
73
|
+
it "runs the command on all servers" do
|
74
|
+
api_scenario "one app, one environment"
|
75
|
+
run_ey(:env => 'giblets', :verbose => true)
|
76
|
+
@raw_ssh_commands.count do |command|
|
77
|
+
command =~ /^ssh turkey@.+ ls$/
|
78
|
+
end.should == 4
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
describe "ey ssh --all without a command" do
|
83
|
+
it_should_behave_like "running ey ssh"
|
84
|
+
|
85
|
+
def command_to_run(opts)
|
86
|
+
cmd = "ssh"
|
87
|
+
cmd << " --all"
|
88
|
+
cmd << " --environment #{opts[:env]}" if opts[:env]
|
89
|
+
cmd
|
90
|
+
end
|
91
|
+
|
92
|
+
it "raises an error" do
|
93
|
+
api_scenario "one app, one environment"
|
94
|
+
run_ey({:env => 'giblets', :verbose => true}, :expect_failure => true)
|
95
|
+
@err.grep(/NoCommandError/)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
describe "ey ssh --all without servers" do
|
100
|
+
it_should_behave_like "running ey ssh"
|
101
|
+
|
102
|
+
def command_to_run(opts)
|
103
|
+
cmd = "ssh ls"
|
104
|
+
cmd << " --all"
|
105
|
+
cmd << " --environment #{opts[:env]}" if opts[:env]
|
106
|
+
cmd
|
107
|
+
end
|
108
|
+
|
109
|
+
it "raises an error" do
|
110
|
+
api_scenario "one app, one environment, no instances"
|
111
|
+
run_ey({:env => 'giblets', :verbose => true}, :expect_failure => true)
|
112
|
+
@err.grep(/NoInstancesError/)
|
113
|
+
end
|
114
|
+
end
|
data/spec/ey/web/disable_spec.rb
CHANGED
@@ -12,10 +12,10 @@ describe "ey web disable" do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def verify_ran(scenario)
|
15
|
-
@ssh_commands.should have_command_like(/
|
15
|
+
@ssh_commands.should have_command_like(/ey-deploy.*deploy enable_maintenance_page.*--app #{scenario[:application]}/)
|
16
16
|
end
|
17
17
|
|
18
18
|
it_should_behave_like "it takes an environment name"
|
19
19
|
it_should_behave_like "it takes an app name"
|
20
|
-
it_should_behave_like "it invokes
|
20
|
+
it_should_behave_like "it invokes ey-deploy"
|
21
21
|
end
|
data/spec/ey/web/enable_spec.rb
CHANGED
@@ -12,10 +12,10 @@ describe "ey web enable" do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def verify_ran(scenario)
|
15
|
-
@ssh_commands.should have_command_like(/
|
15
|
+
@ssh_commands.should have_command_like(/ey-deploy.*deploy disable_maintenance_page.*--app #{scenario[:application]}/)
|
16
16
|
end
|
17
17
|
|
18
18
|
it_should_behave_like "it takes an environment name"
|
19
19
|
it_should_behave_like "it takes an app name"
|
20
|
-
it_should_behave_like "it invokes
|
20
|
+
it_should_behave_like "it invokes ey-deploy"
|
21
21
|
end
|
data/spec/support/fake_awsm.ru
CHANGED
@@ -30,6 +30,8 @@ class FakeAwsm < Sinatra::Base
|
|
30
30
|
Scenario::TwoApps
|
31
31
|
when "one app, one environment"
|
32
32
|
Scenario::LinkedApp
|
33
|
+
when "one app, one environment, no instances"
|
34
|
+
Scenario::LinkedAppNotRunning
|
33
35
|
when "one app, one environment, app master red"
|
34
36
|
Scenario::LinkedAppRedMaster
|
35
37
|
when "one app, many environments"
|
@@ -239,6 +241,42 @@ private
|
|
239
241
|
end
|
240
242
|
end # LinkedApp
|
241
243
|
|
244
|
+
class LinkedAppNotRunning < Empty
|
245
|
+
def apps
|
246
|
+
[{"name" => "rails232app",
|
247
|
+
"environments" => [{"ssh_username" => "turkey",
|
248
|
+
"instances" => [],
|
249
|
+
"name" => "giblets",
|
250
|
+
"apps" => [{"name" => "rails232app",
|
251
|
+
"repository_uri" => git_remote}],
|
252
|
+
"instances_count" => 0,
|
253
|
+
"stack_name" => "nginx_mongrel",
|
254
|
+
"id" => 200,
|
255
|
+
"framework_env" => "production",
|
256
|
+
"app_master" => {}}],
|
257
|
+
"repository_uri" => git_remote}]
|
258
|
+
end
|
259
|
+
|
260
|
+
def environments
|
261
|
+
[{
|
262
|
+
"ssh_username" => "turkey",
|
263
|
+
"instances" => [],
|
264
|
+
"name" => "giblets",
|
265
|
+
"apps" => [{
|
266
|
+
"name" => "rails232app",
|
267
|
+
"repository_uri" => git_remote}],
|
268
|
+
"instances_count" => 0,
|
269
|
+
"stack_name" => "nginx_mongrel",
|
270
|
+
"id" => 200,
|
271
|
+
"framework_env" => "production",
|
272
|
+
"app_master" => {}}]
|
273
|
+
end
|
274
|
+
|
275
|
+
def logs(env_id)
|
276
|
+
[]
|
277
|
+
end
|
278
|
+
end # LinkedAppNotRunning
|
279
|
+
|
242
280
|
class LinkedAppRedMaster < LinkedApp
|
243
281
|
def apps
|
244
282
|
apps = super
|
@@ -110,7 +110,7 @@ shared_examples_for "it takes an app name" do
|
|
110
110
|
|
111
111
|
end
|
112
112
|
|
113
|
-
shared_examples_for "it invokes
|
113
|
+
shared_examples_for "it invokes ey-deploy" do
|
114
114
|
include Spec::Helpers::SharedIntegrationTestUtils
|
115
115
|
|
116
116
|
context "with arguments" do
|
@@ -119,11 +119,11 @@ shared_examples_for "it invokes eysd" do
|
|
119
119
|
run_ey({:env => 'giblets', :verbose => true})
|
120
120
|
end
|
121
121
|
|
122
|
-
it "passes --verbose to
|
123
|
-
@ssh_commands.should have_command_like(/
|
122
|
+
it "passes --verbose to ey-deploy" do
|
123
|
+
@ssh_commands.should have_command_like(/ey-deploy.*deploy.*--verbose/)
|
124
124
|
end
|
125
125
|
|
126
|
-
it "passes along instance information to
|
126
|
+
it "passes along instance information to ey-deploy" do
|
127
127
|
instance_args = [
|
128
128
|
Regexp.quote("ec2-174-129-198-124.compute-1.amazonaws.com,app_master"),
|
129
129
|
Regexp.quote("ec2-72-44-46-66.compute-1.amazonaws.com,app"),
|
@@ -151,7 +151,7 @@ shared_examples_for "it invokes eysd" do
|
|
151
151
|
end
|
152
152
|
|
153
153
|
|
154
|
-
context "
|
154
|
+
context "ey-deploy installation" do
|
155
155
|
before(:all) do
|
156
156
|
api_scenario "one app, one environment"
|
157
157
|
end
|
@@ -187,8 +187,8 @@ shared_examples_for "it invokes eysd" do
|
|
187
187
|
it "does not try to install ey-deploy if it's already there" do
|
188
188
|
run_ey({:env => 'giblets'}, {:prepend_to_path => {'ssh' => exiting_ssh(0)}})
|
189
189
|
@ssh_commands.should_not have_command_like(/gem install ey-deploy/)
|
190
|
-
ver = Regexp.quote(EY::Model::Instance::
|
191
|
-
@ssh_commands.should have_command_like(/
|
190
|
+
ver = Regexp.quote(EY::Model::Instance::EYDEPLOY_VERSION)
|
191
|
+
@ssh_commands.should have_command_like(/ey-deploy _#{ver}_ deploy/)
|
192
192
|
end
|
193
193
|
end
|
194
194
|
end
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
7
|
+
- 10
|
8
8
|
- 0
|
9
|
-
version: 0.
|
9
|
+
version: 0.10.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- EY Cloud Team
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-07-
|
17
|
+
date: 2010-07-13 00:00:00 -07:00
|
18
18
|
default_executable: ey
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -194,8 +194,8 @@ test_files:
|
|
194
194
|
- spec/engineyard/api_spec.rb
|
195
195
|
- spec/engineyard/cli/api_spec.rb
|
196
196
|
- spec/engineyard/cli_spec.rb
|
197
|
-
- spec/engineyard/collection/
|
198
|
-
- spec/engineyard/collection/
|
197
|
+
- spec/engineyard/collection/apps_spec.rb
|
198
|
+
- spec/engineyard/collection/environments_spec.rb
|
199
199
|
- spec/engineyard/config_spec.rb
|
200
200
|
- spec/engineyard/model/api_struct_spec.rb
|
201
201
|
- spec/engineyard/model/environment_spec.rb
|