kontena-plugin-cloud 1.2.0.pre3 → 1.2.0.pre4
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.
- checksums.yaml +4 -4
- data/lib/kontena/plugin/cloud/platform/common.rb +5 -2
- data/lib/kontena/plugin/cloud.rb +1 -1
- data/lib/kontena_cli_plugin.rb +38 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f9e4eba676152d47b5effc551728bc8d79fa77351e935a0c54ed672695853164
|
4
|
+
data.tar.gz: 64d1898e5115c26d06058f1ae20787a81e10b7ffa81a819887daa678d5ef8050
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
'
|
106
|
+
'--silent', '--no-login-info', '--skip-grid-auto-select',
|
104
107
|
'--name', name, '--code', code, url
|
105
108
|
]
|
106
|
-
|
109
|
+
login.run(cmd)
|
107
110
|
rescue => e
|
108
111
|
error e.message
|
109
112
|
end
|
data/lib/kontena/plugin/cloud.rb
CHANGED
data/lib/kontena_cli_plugin.rb
CHANGED
@@ -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.
|
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-
|
11
|
+
date: 2017-11-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: kontena-cli
|