kontena-plugin-cloud 1.2.0.pre3 → 1.2.0.pre4

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
  SHA256:
3
- metadata.gz: 9a0321e44435bc55fe3feb110f4e3d473763f5b96b9c79563bbd0036f85ffa2c
4
- data.tar.gz: 4b0c16f46bfcff2ead931dbfe7ad97a07fa491ce926fc398fe8c595e0c98c0ea
3
+ metadata.gz: f9e4eba676152d47b5effc551728bc8d79fa77351e935a0c54ed672695853164
4
+ data.tar.gz: 64d1898e5115c26d06058f1ae20787a81e10b7ffa81a819887daa678d5ef8050
5
5
  SHA512:
6
- metadata.gz: 608f083d9c1a2ef98ce84031c0e5ca684080d2d41ca25acc38fe5c7dbc0e76f446a2ec6f0f350aa88b4c0386550526f9f7130d0177e14df79a2cbc3b346e0b3f
7
- data.tar.gz: 8f70c145db6aa4e9003b644a786eabd2b17249680d3fedb9d83fd9df0f29a57d19aed4f55dc963e65330b506d06938957961a85986033d32ad5619537118c9c9
6
+ metadata.gz: c701b5421f14192706e66f45e7841e333ad82bd0ed2d347abad402fca4cee0a2c34773fbdb6da72aa1b338a90e352d07f8633b18f32a497dfd4e307f5f77a0ea
7
+ data.tar.gz: beeca426616465e23e6996483b5d04c927edf9f589817f214bcb80bf6917bd924338632860123e71afc9f496fcfa78612db2a8ae72eb1da1b54c5487fffcf3ec
@@ -1,5 +1,6 @@
1
1
  require_relative '../../../cli/master_code_exchanger'
2
2
  require_relative '../../../cli/models/platform'
3
+ require 'kontena/cli/master/login_command'
3
4
 
4
5
  module Kontena::Plugin::Cloud::Platform::Common
5
6
 
@@ -99,11 +100,13 @@ module Kontena::Plugin::Cloud::Platform::Common
99
100
  authorization = cloud_client.post("/organizations/#{organization}/masters/#{platform.master_id}/authorize", {})
100
101
  exchanger = Kontena::Cli::MasterCodeExchanger.new(platform.url)
101
102
  code = exchanger.exchange_code(authorization['code'])
103
+
104
+ login = Kontena::Cli::Master::LoginCommand.new('kontena')
102
105
  cmd = [
103
- 'master', 'login', '--silent', '--no-login-info', '--skip-grid-auto-select',
106
+ '--silent', '--no-login-info', '--skip-grid-auto-select',
104
107
  '--name', name, '--code', code, url
105
108
  ]
106
- Kontena.run!(cmd)
109
+ login.run(cmd)
107
110
  rescue => e
108
111
  error e.message
109
112
  end
@@ -1,7 +1,7 @@
1
1
  module Kontena
2
2
  module Plugin
3
3
  module Cloud
4
- VERSION = "1.2.0.pre3"
4
+ VERSION = "1.2.0.pre4"
5
5
 
6
6
  module Organization
7
7
  module User; end
@@ -17,6 +17,44 @@ module Kontena
17
17
  end
18
18
  end
19
19
  end
20
+
21
+ class Config
22
+
23
+ # patch broken cli
24
+ unless self.instance_methods.include?(:load_cloud_settings_from_env)
25
+
26
+ def load_settings_from_env
27
+ load_cloud_settings_from_env
28
+ load_master_settings_from_env
29
+ end
30
+
31
+ def load_master_settings_from_env
32
+ return nil unless ENV['KONTENA_URL']
33
+
34
+ debug { 'Loading master configuration from ENV' }
35
+ servers << Server.new(
36
+ url: ENV['KONTENA_URL'],
37
+ name: 'default',
38
+ token: Token.new(access_token: ENV['KONTENA_TOKEN'], parent_type: :master, parent_name: 'default'),
39
+ grid: ENV['KONTENA_GRID'],
40
+ parent_type: :master,
41
+ parent_name: 'default'
42
+ )
43
+
44
+ self.current_master = 'default'
45
+ self.current_account = 'kontena'
46
+ end
47
+
48
+ def load_cloud_settings_from_env
49
+ return unless ENV['KONTENA_CLOUD_TOKEN']
50
+
51
+ debug { 'Loading cloud configuration from ENV' }
52
+ accounts << Account.new(kontena_account_data.merge(
53
+ token: Token.new(access_token: ENV['KONTENA_CLOUD_TOKEN'], parent_type: :account, parent_name: 'default')
54
+ ))
55
+ end
56
+ end
57
+ end
20
58
  end
21
59
 
22
60
  module CloudCommand
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kontena-plugin-cloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0.pre3
4
+ version: 1.2.0.pre4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kontena, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-06 00:00:00.000000000 Z
11
+ date: 2017-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kontena-cli