dpl 1.7.12.travis.762.4 → 1.7.12.travis.763.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +13 -1
- data/lib/dpl/provider.rb +31 -30
- data/lib/dpl/provider/exoscale.rb +26 -0
- data/spec/provider/exoscale_spec.rb +191 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
Mjk3OTgwNDg1YmFiNWFmOThkMWFhNmUzZTAwY2U3ZTFkNTA4MjRmYg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MjJlMzI2N2EyOTM4MjRmMzM1MGQxZWMxZjhkMDdkODJlMDlmNzg5ZQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZmMzMWQ3NTY3ZTUyYzkwZGI4NmRiZDdjMTVlY2YxYmVmM2NjYzA0ZWJlMDI2
|
10
|
+
MGJkYzE5NGViN2VlYjdkZjgyMWM1ZDI5YjY5ODliY2Y5ZWM5NmY4YTkwMjIy
|
11
|
+
ZDkxNzYzYWJjNzZkZTNmNmM2NzgwOGE4ZDI1OTg5ZGZlNmVkMjM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MjlhNjI5ZWJkMGE2OTA0M2MyNGZkNjdlZjk1ZDFlNjU4MTA1ZDIyNTJlZDJh
|
14
|
+
ZTgyMmI0ZjViOWM3Y2MxODQ3MmI5NTg4YzdhMmY4ZTgxNzA4N2Y1MTQ4NzY2
|
15
|
+
YjQxMjIwZWI4YTUyNTE3N2U5NjUwN2JlMTFhZjk4N2EyN2M2MzE=
|
data/README.md
CHANGED
@@ -34,6 +34,7 @@ Dpl supports the following providers:
|
|
34
34
|
* [Chef Supermarket](#chef-supermarket)
|
35
35
|
* [Lambda](#lambda)
|
36
36
|
* [TestFairy](#testfairy)
|
37
|
+
* [ExoScale](#exoscale)
|
37
38
|
|
38
39
|
## Installation:
|
39
40
|
|
@@ -458,7 +459,7 @@ For accounts using two factor authentication, you have to use an oauth token as
|
|
458
459
|
|
459
460
|
### Lambda:
|
460
461
|
|
461
|
-
#### Options:
|
462
|
+
#### Options:
|
462
463
|
|
463
464
|
* **function_name**: Required. The name of the Lambda being created / updated.
|
464
465
|
* **role**: Required. The ARN of the IAM role to assign to this Lambda function.
|
@@ -521,3 +522,14 @@ and your testers can start testing your app.
|
|
521
522
|
|
522
523
|
dpl --provider=testfairy --api-key=<api-key> --app-file="out/Sample.apk" --keystore-file="out/keystore" --storepass=<storepass> --alias=<alias>
|
523
524
|
|
525
|
+
### ExoScale:
|
526
|
+
|
527
|
+
#### Options:
|
528
|
+
|
529
|
+
* **email**: ExoScale email or Organization ID.
|
530
|
+
* **password**: ExoScale password.
|
531
|
+
* **deployment**: ExoScale Deployment. Follows the format "APP_NAME/DEP_NAME".
|
532
|
+
|
533
|
+
#### Examples:
|
534
|
+
|
535
|
+
dpl --provider=exoscale --email=<email> --password<password> --deployment=`APP_NAME/DEP_NAME`
|
data/lib/dpl/provider.rb
CHANGED
@@ -6,38 +6,39 @@ module DPL
|
|
6
6
|
class Provider
|
7
7
|
include FileUtils
|
8
8
|
|
9
|
-
autoload :Heroku,
|
10
|
-
autoload :Appfog,
|
11
|
-
autoload :EngineYard,
|
12
|
-
autoload :DotCloud,
|
13
|
-
autoload :Nodejitsu,
|
14
|
-
autoload :Openshift,
|
15
|
-
autoload :RubyGems,
|
16
|
-
autoload :NPM,
|
17
|
-
autoload :S3,
|
18
|
-
autoload :CloudControl,
|
19
|
-
autoload :CloudFoundry,
|
20
|
-
autoload :CodeDeploy,
|
21
|
-
autoload :Lambda,
|
22
|
-
autoload :PyPI,
|
23
|
-
autoload :Divshot,
|
24
|
-
autoload :CloudFiles,
|
25
|
-
autoload :OpsWorks,
|
26
|
-
autoload :Modulus,
|
27
|
-
autoload :Releases,
|
28
|
-
autoload :Cloud66,
|
29
|
-
autoload :Ninefold,
|
30
|
-
autoload :Hackage,
|
31
|
-
autoload :Deis,
|
32
|
-
autoload :GCS,
|
33
|
-
autoload :GAE,
|
34
|
-
autoload :BitBalloon,
|
35
|
-
autoload :Biicode,
|
9
|
+
autoload :Heroku, 'dpl/provider/heroku'
|
10
|
+
autoload :Appfog, 'dpl/provider/appfog'
|
11
|
+
autoload :EngineYard, 'dpl/provider/engine_yard'
|
12
|
+
autoload :DotCloud, 'dpl/provider/dot_cloud'
|
13
|
+
autoload :Nodejitsu, 'dpl/provider/nodejitsu'
|
14
|
+
autoload :Openshift, 'dpl/provider/openshift'
|
15
|
+
autoload :RubyGems, 'dpl/provider/rubygems'
|
16
|
+
autoload :NPM, 'dpl/provider/npm'
|
17
|
+
autoload :S3, 'dpl/provider/s3'
|
18
|
+
autoload :CloudControl, 'dpl/provider/cloudcontrol'
|
19
|
+
autoload :CloudFoundry, 'dpl/provider/cloud_foundry'
|
20
|
+
autoload :CodeDeploy, 'dpl/provider/code_deploy'
|
21
|
+
autoload :Lambda, 'dpl/provider/lambda'
|
22
|
+
autoload :PyPI, 'dpl/provider/pypi'
|
23
|
+
autoload :Divshot, 'dpl/provider/divshot'
|
24
|
+
autoload :CloudFiles, 'dpl/provider/cloud_files'
|
25
|
+
autoload :OpsWorks, 'dpl/provider/ops_works'
|
26
|
+
autoload :Modulus, 'dpl/provider/modulus'
|
27
|
+
autoload :Releases, 'dpl/provider/releases'
|
28
|
+
autoload :Cloud66, 'dpl/provider/cloud66'
|
29
|
+
autoload :Ninefold, 'dpl/provider/ninefold'
|
30
|
+
autoload :Hackage, 'dpl/provider/hackage'
|
31
|
+
autoload :Deis, 'dpl/provider/deis'
|
32
|
+
autoload :GCS, 'dpl/provider/gcs'
|
33
|
+
autoload :GAE, 'dpl/provider/gae'
|
34
|
+
autoload :BitBalloon, 'dpl/provider/bitballoon'
|
35
|
+
autoload :Biicode, 'dpl/provider/biicode'
|
36
36
|
autoload :ElasticBeanstalk, 'dpl/provider/elastic_beanstalk'
|
37
|
-
autoload :PuppetForge,
|
38
|
-
autoload :Packagecloud,
|
37
|
+
autoload :PuppetForge, 'dpl/provider/puppet_forge'
|
38
|
+
autoload :Packagecloud, 'dpl/provider/packagecloud'
|
39
39
|
autoload :ChefSupermarket, 'dpl/provider/chef_supermarket'
|
40
|
-
autoload :TestFairy,
|
40
|
+
autoload :TestFairy, 'dpl/provider/testfairy'
|
41
|
+
autoload :ExoScale, 'dpl/provider/exoscale'
|
41
42
|
|
42
43
|
|
43
44
|
def self.new(context, options)
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'net/http'
|
3
|
+
require 'net/https'
|
4
|
+
|
5
|
+
module DPL
|
6
|
+
class Provider
|
7
|
+
class ExoScale < CloudControl
|
8
|
+
def initialize(context, options)
|
9
|
+
super
|
10
|
+
@http = Net::HTTP.new('api.app.exo.io', 443)
|
11
|
+
@http.use_ssl = true
|
12
|
+
|
13
|
+
@tokenHttp = Net::HTTP.new('portal.exoscale.ch', 443)
|
14
|
+
@tokenHttp.use_ssl = true
|
15
|
+
end
|
16
|
+
private
|
17
|
+
def get_token
|
18
|
+
request = Net::HTTP::Post.new '/api/apps/token'
|
19
|
+
request.basic_auth options[:email], options[:password]
|
20
|
+
response = @tokenHttp.request(request)
|
21
|
+
error('authorization failed') if response.code != '200'
|
22
|
+
return JSON.parse response.body
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,191 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'dpl/provider/exoscale'
|
3
|
+
|
4
|
+
describe DPL::Provider::ExoScale do
|
5
|
+
subject :provider do
|
6
|
+
described_class.new(DummyContext.new, :deployment => 'foo_app/default', :email => 'foo@test.com', :password => 'password')
|
7
|
+
end
|
8
|
+
|
9
|
+
its(:app_name) { should == 'foo_app' }
|
10
|
+
its(:dep_name) { should == 'default' }
|
11
|
+
|
12
|
+
its(:needs_key?) { should be true }
|
13
|
+
|
14
|
+
describe 'constructor' do
|
15
|
+
it 'with wrong arguments' do
|
16
|
+
expect {
|
17
|
+
described_class.new(DummyContext.new, :foo_dep => 'foo_app/default', :email => 'foo@test.com', :password => 'password')
|
18
|
+
}.to raise_error(DPL::Error)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
it '#check_auth should call #headers_with_token' do
|
23
|
+
expect(provider).to receive(:headers_with_token)
|
24
|
+
provider.check_auth
|
25
|
+
end
|
26
|
+
|
27
|
+
describe '#check_app' do
|
28
|
+
it 'on deployment found' do
|
29
|
+
expect(provider).to receive(:api_call).and_return double(
|
30
|
+
:code => '200',
|
31
|
+
:body => '{"branch":"foo_repo.git"}'
|
32
|
+
)
|
33
|
+
expect(provider.instance_variable_get(:@repository)).to be_nil
|
34
|
+
provider.check_app
|
35
|
+
expect(provider.instance_variable_get(:@repository)).to eq('foo_repo.git')
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'on deployment not found' do
|
39
|
+
expect(provider).to receive(:api_call).and_return double(:code => '410')
|
40
|
+
expect { provider.check_app }.to raise_error(DPL::Error)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe '#setup_key' do
|
45
|
+
before do
|
46
|
+
expect(File).to receive(:read).with('file').and_return('foo_key')
|
47
|
+
expect(provider).to receive(:user).and_return({ 'username' => 'foo_user' })
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'on api success' do
|
51
|
+
expect(provider).to receive(:api_call).with('POST', '/user/foo_user/key', '{"key":"foo_key"}').and_return double(
|
52
|
+
:code => '200',
|
53
|
+
:body => '{ "key": "foo_key", "key_id": "foo_key_id"}'
|
54
|
+
)
|
55
|
+
|
56
|
+
expect(provider.instance_variable_get(:@ssh_key_id)).to be_nil
|
57
|
+
provider.setup_key 'file'
|
58
|
+
expect(provider.instance_variable_get(:@ssh_key_id)).to eq('foo_key_id')
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'on api failure' do
|
62
|
+
expect(provider).to receive(:api_call).with('POST', '/user/foo_user/key', '{"key":"foo_key"}').and_return double(:code => '401')
|
63
|
+
|
64
|
+
expect { provider.setup_key 'file' }.to raise_error(DPL::Error)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
describe '#remove_key' do
|
69
|
+
before do
|
70
|
+
provider.instance_variable_set(:@ssh_key_id, 'foo_key_id')
|
71
|
+
expect(provider).to receive(:user).and_return({ 'username' => 'foo_user' })
|
72
|
+
end
|
73
|
+
|
74
|
+
it 'on api success' do
|
75
|
+
expect(provider).to receive(:api_call).with('DELETE', '/user/foo_user/key/foo_key_id').and_return double(:code => '204')
|
76
|
+
provider.remove_key
|
77
|
+
end
|
78
|
+
|
79
|
+
it 'on api failure' do
|
80
|
+
expect(provider).to receive(:api_call).with('DELETE', '/user/foo_user/key/foo_key_id').and_return double(:code => '410')
|
81
|
+
expect { provider.remove_key }.to raise_error(DPL::Error)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
it '#push_app shuld deploy the app' do
|
86
|
+
provider.instance_variable_set(:@repository, 'foo_repo.git')
|
87
|
+
context = double(:shell)
|
88
|
+
expect(context).to receive(:shell).with("git push foo_repo.git HEAD:master -f")
|
89
|
+
expect(provider).to receive(:context).and_return context
|
90
|
+
expect(provider).to receive(:deploy_app)
|
91
|
+
|
92
|
+
provider.push_app
|
93
|
+
end
|
94
|
+
|
95
|
+
describe 'private method' do
|
96
|
+
describe '#get_token' do
|
97
|
+
it 'on api success' do
|
98
|
+
request = double()
|
99
|
+
expect(request).to receive(:basic_auth).with('foo@test.com', 'password')
|
100
|
+
expect(Net::HTTP::Post).to receive(:new).with('/api/apps/token').and_return request
|
101
|
+
|
102
|
+
expect(provider.instance_variable_get(:@tokenHttp)).to receive(:request).and_return double(
|
103
|
+
:code => '200',
|
104
|
+
:body => '{ "token": "foo_token"}'
|
105
|
+
)
|
106
|
+
|
107
|
+
expect(provider.instance_eval { get_token }).to eq({ 'token' => 'foo_token' })
|
108
|
+
end
|
109
|
+
|
110
|
+
it 'on api failure' do
|
111
|
+
expect(provider.instance_variable_get(:@tokenHttp)).to receive(:request).and_return double(:code => '401')
|
112
|
+
|
113
|
+
expect do
|
114
|
+
provider.instance_eval { get_token }
|
115
|
+
end.to raise_error(DPL::Error)
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
it '#headers_with_token should return headers' do
|
120
|
+
expect(provider).to receive(:get_token).and_return({ 'token' => 'foo_token' })
|
121
|
+
expected_return = {
|
122
|
+
'Authorization' => 'cc_auth_token="foo_token"',
|
123
|
+
'Content-Type' => 'application/json'
|
124
|
+
}
|
125
|
+
|
126
|
+
expect(provider.instance_eval { headers_with_token }).to eq(expected_return)
|
127
|
+
end
|
128
|
+
|
129
|
+
describe '#get_headers' do
|
130
|
+
let(:expected_args) { [ 'GET', '/user/', nil, {'foo' => 'headers'} ] }
|
131
|
+
|
132
|
+
before do
|
133
|
+
expect(provider).to receive(:headers_with_token).and_return({ 'foo' => 'headers' })
|
134
|
+
end
|
135
|
+
|
136
|
+
it 'on token valid' do
|
137
|
+
expect(provider).to receive(:api_call).with(*expected_args).and_return double(:code => '200')
|
138
|
+
expect(provider.instance_eval { get_headers }).to eq({ 'foo' => 'headers' })
|
139
|
+
end
|
140
|
+
|
141
|
+
it 'on token expired' do
|
142
|
+
expect(provider).to receive(:api_call).with(*expected_args).and_return double(:code => '401')
|
143
|
+
expect(provider).to receive(:headers_with_token).with({ :new_token => true})
|
144
|
+
|
145
|
+
provider.instance_eval { get_headers }
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
it '#api_call should send request' do
|
150
|
+
expected_args = [ "foo_method", "foo_path", "\"foo\":\"data\"", {"foo"=>"headers"} ]
|
151
|
+
expect(provider.instance_variable_get(:@http)).to receive(:send_request).with(*expected_args)
|
152
|
+
|
153
|
+
provider.instance_eval do
|
154
|
+
api_call('foo_method', 'foo_path', '"foo":"data"', { 'foo' => 'headers'})
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
describe '#deploy_app' do
|
159
|
+
it 'on api success' do
|
160
|
+
expect(provider).to receive(:api_call).with('PUT', '/app/foo_app/deployment/default', '{"version":-1}').and_return double(:code => '200')
|
161
|
+
provider.instance_eval { deploy_app }
|
162
|
+
end
|
163
|
+
|
164
|
+
it 'on api failure' do
|
165
|
+
expect(provider).to receive(:api_call).with('PUT', '/app/foo_app/deployment/default', '{"version":-1}').and_return double(:code => '410')
|
166
|
+
expect do
|
167
|
+
provider.instance_eval { deploy_app }
|
168
|
+
end.to raise_error(DPL::Error)
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
describe '#user' do
|
173
|
+
it 'on api success' do
|
174
|
+
expect(provider).to receive(:api_call).with('GET', '/user/').and_return double(
|
175
|
+
:code => '200',
|
176
|
+
:body => '["foo_user"]'
|
177
|
+
)
|
178
|
+
|
179
|
+
expect(provider.instance_eval { user }).to eq('foo_user')
|
180
|
+
end
|
181
|
+
|
182
|
+
it 'on api failure' do
|
183
|
+
expect(provider).to receive(:api_call).with('GET', '/user/').and_return double(:code => '410')
|
184
|
+
|
185
|
+
expect do
|
186
|
+
provider.instance_eval { user }
|
187
|
+
end.to raise_error(DPL::Error)
|
188
|
+
end
|
189
|
+
end
|
190
|
+
end
|
191
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dpl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.7.12.travis.
|
4
|
+
version: 1.7.12.travis.763.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Konstantin Haase
|
@@ -113,6 +113,7 @@ files:
|
|
113
113
|
- lib/dpl/provider/dot_cloud.rb
|
114
114
|
- lib/dpl/provider/elastic_beanstalk.rb
|
115
115
|
- lib/dpl/provider/engine_yard.rb
|
116
|
+
- lib/dpl/provider/exoscale.rb
|
116
117
|
- lib/dpl/provider/gae.rb
|
117
118
|
- lib/dpl/provider/gcs.rb
|
118
119
|
- lib/dpl/provider/hackage.rb
|
@@ -154,6 +155,7 @@ files:
|
|
154
155
|
- spec/provider/divshot_spec.rb
|
155
156
|
- spec/provider/dotcloud_spec.rb
|
156
157
|
- spec/provider/elastic_beanstalk_spec.rb
|
158
|
+
- spec/provider/exoscale_spec.rb
|
157
159
|
- spec/provider/gae_spec.rb
|
158
160
|
- spec/provider/gcs_spec.rb
|
159
161
|
- spec/provider/hackage_spec.rb
|