dpl 1.8.38.travis.2138.5 → 1.8.38.travis.2140.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 755ff043f6fd8173800aef1b07f14bf72a109fc9
4
- data.tar.gz: bf5e2431cc77bafe4d6c5fabc911f2af8e414c00
3
+ metadata.gz: 6e69d3e88330c677e155630790b4d67faceac989
4
+ data.tar.gz: b0db5ce5c2381ca1446e151c6bc16f77bc54a6e3
5
5
  SHA512:
6
- metadata.gz: 28843a5c87095f1b2206ba6143779be6cccbcb75dafadfdcbe25aa00eef1e996adac2668bb97277cc6ab07c99701f1c849e073a7d0942ae15598678736b9cd3d
7
- data.tar.gz: bbd9655d85d8c16243292e01e6bb78b8fcf0336ab3e6aa319852153cbfd61c0c6c8d0925787f98b837dbdfc77b9e14c50cccaf361bef58c12dd1ee7682be926a
6
+ metadata.gz: 87c912306cc66fa581c0596c5b2b39c208a24a6c77c8b4d5677f82dd871daadfbc75577e921874e4a03d75862f917aa2afda11bffb1e971b5b4f9b450baa2dcb
7
+ data.tar.gz: 2f0fd0341110191b116e0962d6069aadc18227689e3e9c37b6c1c0f4bee64bb78339ee3c4eefaa82a0935e559a982f0beae4ecb0102703c5eeb49aee234f3675
data/README.md CHANGED
@@ -25,7 +25,6 @@ Dpl supports the following providers:
25
25
  * [Deis](#deis)
26
26
  * [Divshot.io](#divshotio)
27
27
  * [Engine Yard](#engine-yard)
28
- * [ExoScale](#exoscale)
29
28
  * [Firebase](#firebase)
30
29
  * [Github Pages](#github-pages)
31
30
  * [Github Releases](#github-releases)
@@ -805,18 +804,6 @@ and your testers can start testing your app.
805
804
 
806
805
  dpl --provider=codedeploy --access-key-id=<aws access key> --secret_access_key=<aws secret access key> --application=<application name> --deployment_group=<deployment group> --revision_type=<s3/github> --commit_id=<commit ID> --repository=<repo name> --region=<AWS availability zone> --wait-until-deployed=<true>
807
806
 
808
- ### ExoScale:
809
-
810
- #### Options:
811
-
812
- * **email**: ExoScale email or Organization ID.
813
- * **password**: ExoScale password.
814
- * **deployment**: ExoScale Deployment. Follows the format "APP_NAME/DEP_NAME".
815
-
816
- #### Examples:
817
-
818
- dpl --provider=exoscale --email=<email> --password<password> --deployment=`APP_NAME/DEP_NAME`
819
-
820
807
  ### Scalingo:
821
808
 
822
809
  #### Options:
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.8.38.travis.2138.5
4
+ version: 1.8.38.travis.2140.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Haase
@@ -139,7 +139,6 @@ files:
139
139
  - lib/dpl/provider/divshot.rb
140
140
  - lib/dpl/provider/elastic_beanstalk.rb
141
141
  - lib/dpl/provider/engine_yard.rb
142
- - lib/dpl/provider/exoscale.rb
143
142
  - lib/dpl/provider/firebase.rb
144
143
  - lib/dpl/provider/gae.rb
145
144
  - lib/dpl/provider/gcs.rb
@@ -189,7 +188,6 @@ files:
189
188
  - spec/provider/deis_spec.rb
190
189
  - spec/provider/divshot_spec.rb
191
190
  - spec/provider/elastic_beanstalk_spec.rb
192
- - spec/provider/exoscale_spec.rb
193
191
  - spec/provider/firebase_spec.rb
194
192
  - spec/provider/gae_spec.rb
195
193
  - spec/provider/gcs_spec.rb
@@ -1,100 +0,0 @@
1
- require 'json'
2
- require 'net/http'
3
- require 'net/https'
4
-
5
- module DPL
6
- class Provider
7
- class ExoScale < Provider
8
- attr_accessor :app_name
9
- attr_accessor :dep_name
10
-
11
- def initialize(context, options)
12
- super
13
- option(:email) && option(:password) && option(:deployment)
14
- @app_name, @dep_name = options[:deployment].split('/')
15
-
16
- @http = Net::HTTP.new('api.app.exo.io', 443)
17
- @http.use_ssl = true
18
-
19
- @tokenHttp = Net::HTTP.new('portal.exoscale.ch', 443)
20
- @tokenHttp.use_ssl = true
21
- end
22
-
23
- def check_auth
24
- headers_with_token
25
- end
26
-
27
- def check_app
28
- response = api_call('GET', "/app/#{ app_name }/deployment/#{ dep_name }")
29
- error('application check failed') if response.code != '200'
30
- @repository = JSON.parse(response.body)["branch"]
31
- end
32
-
33
- def setup_key(file)
34
- data = { 'key' => File.read(file).chomp }
35
- response = api_call('POST', "/user/#{ user['username'] }/key", JSON.dump(data))
36
- error('adding key failed') if response.code != '200'
37
- key = JSON.parse response.body
38
- @ssh_key_id = key['key_id']
39
- end
40
-
41
- def remove_key
42
- response = api_call('DELETE', "/user/#{ user['username']}/key/#{ @ssh_key_id }")
43
- error('key removal failed') if response.code != '204'
44
- end
45
-
46
- def push_app
47
- branch = (dep_name == 'default') ? 'master' : dep_name
48
- context.shell "git push #{ @repository } HEAD:#{ branch } -f"
49
- deploy_app
50
- end
51
-
52
- private
53
-
54
- def get_token
55
- request = Net::HTTP::Post.new '/api/apps/token'
56
- request.basic_auth options[:email], options[:password]
57
- response = @tokenHttp.request(request)
58
- error('authorization failed') if response.code != '200'
59
- return JSON.parse response.body
60
- end
61
-
62
- def headers_with_token(options = {})
63
- @token = get_token if options[:new_token] || @token.nil?
64
- return {
65
- 'Authorization' => %Q|cc_auth_token="#{ @token['token'] }"|,
66
- 'Content-Type' => 'application/json'
67
- }
68
- end
69
-
70
- def get_headers
71
- headers = headers_with_token
72
- response = api_call('GET', '/user/', nil, headers)
73
- return headers if response.code == '200'
74
-
75
- return headers_with_token :new_token => true
76
- end
77
-
78
- def api_call(method, path, data = nil, headers = nil)
79
- return @http.send_request(method, path, data, headers || get_headers)
80
- end
81
-
82
- def deploy_app
83
- data = {'version' => -1}
84
- response = api_call('PUT', "/app/#{ app_name }/deployment/#{ dep_name }", JSON.dump(data))
85
- error('deployment failed - the deployment is already deploying') if response.code != '200'
86
- end
87
-
88
- def user
89
- if @user.nil?
90
- response = api_call('GET', '/user/')
91
- error('can not find the user') if response.code != '200'
92
- users = JSON.parse response.body
93
- @user = users[0]
94
- end
95
- return @user
96
- end
97
-
98
- end
99
- end
100
- end
@@ -1,191 +0,0 @@
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