engineyard-cloud-client 1.0.10 → 1.0.11
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/ChangeLog.md +7 -2
- data/lib/engineyard-cloud-client/models/deployment.rb +16 -9
- data/lib/engineyard-cloud-client/models/instance.rb +1 -1
- data/lib/engineyard-cloud-client/test/fake_awsm/models/instance.rb +7 -6
- data/lib/engineyard-cloud-client/test/fake_awsm/views/instances.rabl +1 -1
- data/lib/engineyard-cloud-client/version.rb +1 -1
- data/spec/engineyard-cloud-client/api_spec.rb +24 -0
- data/spec/engineyard-cloud-client/integration/deployment_spec.rb +4 -4
- data/spec/engineyard-cloud-client/models/app_spec.rb +0 -6
- data/spec/engineyard-cloud-client/models/environment_spec.rb +0 -6
- metadata +4 -4
data/ChangeLog.md
CHANGED
|
@@ -4,13 +4,18 @@
|
|
|
4
4
|
|
|
5
5
|
*
|
|
6
6
|
|
|
7
|
+
## v1.0.11 (2013-03-07)
|
|
8
|
+
|
|
9
|
+
* Supports Instance#availability\_zone in API response.
|
|
10
|
+
* Renames Deployment#cancel to Deployment#timeout, though still support using #cancel.
|
|
11
|
+
|
|
7
12
|
## v1.0.10 (2013-02-20)
|
|
8
13
|
|
|
9
|
-
*
|
|
14
|
+
* Provide a test scenario for stuck deployments
|
|
10
15
|
|
|
11
16
|
## v1.0.9 (2013-02-20)
|
|
12
17
|
|
|
13
|
-
*
|
|
18
|
+
* Add the ability to cancel stuck deployments
|
|
14
19
|
|
|
15
20
|
## v1.0.8 (2013-02-14)
|
|
16
21
|
|
|
@@ -51,12 +51,20 @@ module EY
|
|
|
51
51
|
alias deployed_by user_name
|
|
52
52
|
alias deployed_by= user_name=
|
|
53
53
|
|
|
54
|
-
def created_at
|
|
55
|
-
|
|
54
|
+
def created_at=(cat)
|
|
55
|
+
if String === cat
|
|
56
|
+
super Time.parse(cat)
|
|
57
|
+
else
|
|
58
|
+
super
|
|
59
|
+
end
|
|
56
60
|
end
|
|
57
61
|
|
|
58
|
-
def finished_at
|
|
59
|
-
|
|
62
|
+
def finished_at=(fat)
|
|
63
|
+
if String === fat
|
|
64
|
+
super Time.parse(fat)
|
|
65
|
+
else
|
|
66
|
+
super
|
|
67
|
+
end
|
|
60
68
|
end
|
|
61
69
|
|
|
62
70
|
def config
|
|
@@ -110,25 +118,24 @@ module EY
|
|
|
110
118
|
put_to_api({:successful => successful, :output => output.read})
|
|
111
119
|
end
|
|
112
120
|
|
|
113
|
-
def
|
|
121
|
+
def timeout
|
|
114
122
|
if finished?
|
|
115
123
|
raise EY::CloudClient::Error, "Previous deployment is already finished. Aborting."
|
|
116
124
|
else
|
|
117
125
|
current_user_name = api.current_user.name
|
|
118
126
|
self.successful = false
|
|
119
|
-
err << "!> Marked as
|
|
127
|
+
err << "!> Marked as timed out by #{current_user_name}"
|
|
120
128
|
finished
|
|
121
129
|
end
|
|
122
130
|
end
|
|
131
|
+
alias cancel timeout
|
|
123
132
|
|
|
124
133
|
def finished?
|
|
125
134
|
!finished_at.nil?
|
|
126
135
|
end
|
|
127
136
|
|
|
128
137
|
def update_with_response(response)
|
|
129
|
-
response['deployment']
|
|
130
|
-
send("#{key}=", val) if respond_to?("#{key}=")
|
|
131
|
-
end
|
|
138
|
+
self.attributes = response['deployment']
|
|
132
139
|
self
|
|
133
140
|
end
|
|
134
141
|
|
|
@@ -2,7 +2,7 @@ require 'engineyard-cloud-client/models/api_struct'
|
|
|
2
2
|
|
|
3
3
|
module EY
|
|
4
4
|
class CloudClient
|
|
5
|
-
class Instance < ApiStruct.new(:id, :role, :name, :status, :amazon_id, :public_hostname, :environment, :bridge)
|
|
5
|
+
class Instance < ApiStruct.new(:id, :role, :name, :status, :amazon_id, :public_hostname, :environment, :bridge, :availability_zone)
|
|
6
6
|
alias hostname public_hostname
|
|
7
7
|
alias bridge? bridge
|
|
8
8
|
|
|
@@ -3,12 +3,13 @@ require 'dm-core'
|
|
|
3
3
|
class Instance
|
|
4
4
|
include DataMapper::Resource
|
|
5
5
|
|
|
6
|
-
property :id,
|
|
7
|
-
property :name,
|
|
8
|
-
property :role,
|
|
9
|
-
property :status,
|
|
10
|
-
property :amazon_id,
|
|
11
|
-
property :public_hostname,
|
|
6
|
+
property :id, Serial
|
|
7
|
+
property :name, String
|
|
8
|
+
property :role, String
|
|
9
|
+
property :status, String
|
|
10
|
+
property :amazon_id, String
|
|
11
|
+
property :public_hostname, String
|
|
12
|
+
property :availability_zone, String, :default => 'us-east-1b'
|
|
12
13
|
|
|
13
14
|
belongs_to :environment
|
|
14
15
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
collection @instances, :root => :instances, :object_root => false
|
|
2
|
-
attributes :id, :status, :amazon_id, :role, :bridge, :name, :public_hostname
|
|
2
|
+
attributes :id, :status, :amazon_id, :role, :bridge, :name, :public_hostname, :availability_zone
|
|
@@ -38,4 +38,28 @@ describe EY::CloudClient do
|
|
|
38
38
|
EY::CloudClient.new.authenticate!("a@b.com", "foo")
|
|
39
39
|
}.should raise_error(EY::CloudClient::RequestFailed, /API is temporarily unavailable/)
|
|
40
40
|
end
|
|
41
|
+
|
|
42
|
+
it "raises RequestFailed with a friendly error when the response contains a message in json" do
|
|
43
|
+
FakeWeb.register_uri(:post, "https://cloud.engineyard.com/api/v2/authenticate", :status => 409, :content_type => 'application/json', :body => %|{"message":"Important information regarding your failure"}|)
|
|
44
|
+
|
|
45
|
+
lambda {
|
|
46
|
+
EY::CloudClient.new.authenticate!("a@b.com", "foo")
|
|
47
|
+
}.should raise_error(EY::CloudClient::RequestFailed, /Error: Important information regarding your failure/)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
it "raises RequestFailed with a semi-useful error message when the body is empty" do
|
|
51
|
+
FakeWeb.register_uri(:post, "https://cloud.engineyard.com/api/v2/authenticate", :status => 409, :content_type => 'text/plain', :body => "")
|
|
52
|
+
|
|
53
|
+
lambda {
|
|
54
|
+
EY::CloudClient.new.authenticate!("a@b.com", "foo")
|
|
55
|
+
}.should raise_error(EY::CloudClient::RequestFailed, /Error: 409 Conflict/)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
it "raises RequestFailed with the response body when the content type is not json" do
|
|
59
|
+
FakeWeb.register_uri(:post, "https://cloud.engineyard.com/api/v2/authenticate", :status => 409, :content_type => 'text/plain', :body => "What a useful error message!")
|
|
60
|
+
|
|
61
|
+
lambda {
|
|
62
|
+
EY::CloudClient.new.authenticate!("a@b.com", "foo")
|
|
63
|
+
}.should raise_error(EY::CloudClient::RequestFailed, /Error: 409 Conflict What a useful error message!/)
|
|
64
|
+
end
|
|
41
65
|
end
|
|
@@ -111,7 +111,7 @@ describe EY::CloudClient::AppEnvironment do
|
|
|
111
111
|
end
|
|
112
112
|
end
|
|
113
113
|
|
|
114
|
-
describe "canceling" do
|
|
114
|
+
describe "timing out (canceling)" do
|
|
115
115
|
before do
|
|
116
116
|
@api = scenario_cloud_client "Stuck Deployment"
|
|
117
117
|
result = EY::CloudClient::AppEnvironment.resolve(@api, 'app_name' => 'rails232app', 'environment_name' => 'giblets', 'account_name' => 'main')
|
|
@@ -122,11 +122,11 @@ describe EY::CloudClient::AppEnvironment do
|
|
|
122
122
|
it "marks the deployment finish and unsuccessful with a message" do
|
|
123
123
|
deployment = EY::CloudClient::Deployment.last(@api, @app_env)
|
|
124
124
|
deployment.should_not be_finished
|
|
125
|
-
deployment.
|
|
125
|
+
deployment.timeout
|
|
126
126
|
deployment.should be_finished
|
|
127
127
|
deployment.should_not be_successful
|
|
128
128
|
deployment.output.rewind
|
|
129
|
-
deployment.output.read.should =~ /Marked as
|
|
129
|
+
deployment.output.read.should =~ /Marked as timed out by Stuck Deployment/
|
|
130
130
|
|
|
131
131
|
EY::CloudClient::Deployment.last(@api, @app_env).should be_finished
|
|
132
132
|
end
|
|
@@ -137,7 +137,7 @@ describe EY::CloudClient::AppEnvironment do
|
|
|
137
137
|
deployment.successful = true
|
|
138
138
|
deployment.finished
|
|
139
139
|
deployment.should be_finished
|
|
140
|
-
expect { deployment.
|
|
140
|
+
expect { deployment.timeout }.to raise_error(EY::CloudClient::Error, "Previous deployment is already finished. Aborting.")
|
|
141
141
|
end
|
|
142
142
|
end
|
|
143
143
|
end
|
|
@@ -162,12 +162,6 @@ describe EY::CloudClient::Environment do
|
|
|
162
162
|
end
|
|
163
163
|
end
|
|
164
164
|
|
|
165
|
-
describe "#destroy" do
|
|
166
|
-
it "hits the destroy action in the API" do
|
|
167
|
-
pending
|
|
168
|
-
end
|
|
169
|
-
end
|
|
170
|
-
|
|
171
165
|
describe "#rebuild" do
|
|
172
166
|
it "hits the rebuild action in the API" do
|
|
173
167
|
env = EY::CloudClient::Environment.from_hash(cloud_client, { "id" => 46534 })
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: engineyard-cloud-client
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.11
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2013-
|
|
12
|
+
date: 2013-03-07 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: rest-client
|
|
@@ -354,7 +354,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
354
354
|
version: '0'
|
|
355
355
|
segments:
|
|
356
356
|
- 0
|
|
357
|
-
hash: -
|
|
357
|
+
hash: -1264950529868210162
|
|
358
358
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
359
359
|
none: false
|
|
360
360
|
requirements:
|
|
@@ -363,7 +363,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
363
363
|
version: '0'
|
|
364
364
|
segments:
|
|
365
365
|
- 0
|
|
366
|
-
hash: -
|
|
366
|
+
hash: -1264950529868210162
|
|
367
367
|
requirements: []
|
|
368
368
|
rubyforge_project:
|
|
369
369
|
rubygems_version: 1.8.24
|