kontena-cli 0.16.0.pre2 → 0.16.0.pre3
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/VERSION +1 -1
- data/lib/kontena/callbacks/auth/01_list_and_select_grid_after_master_auth.rb +1 -1
- data/lib/kontena/callbacks/master/deploy/55_create_initial_grid_after_deploy.rb +1 -6
- data/lib/kontena/cli/localhost_web_server.rb +20 -10
- data/lib/kontena/cli/master/config_command.rb +0 -1
- data/lib/kontena/cli/master/join_command.rb +1 -1
- data/lib/kontena/cli/master/users/invite_command.rb +4 -11
- data/lib/kontena/cli/master_command.rb +0 -1
- data/lib/kontena/client.rb +2 -2
- data/lib/kontena/command.rb +2 -2
- data/lib/kontena/main_command.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa0396ae545ef65b7d8f8011ff078e644d593a94
|
4
|
+
data.tar.gz: b146002d263311acb234c18fc39c9bd187dc360c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 050323b6a272b3ba7ee93bd21dc7b717b6254297c0e53a55035ed42cc4d0c0e98a021eea80fb5037b725e504c59116ac5b56435ca21defce0752567ac8082a73
|
7
|
+
data.tar.gz: fff1427644f1620501fb95660e609090dfd2e2d8b8dfaaf4b29005bfedfb8e705204f238810960f9b64816b0c1605664289be0e77aed6f333aa6f485ab7dad6a
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.16.0.
|
1
|
+
0.16.0.pre3
|
@@ -1,10 +1,5 @@
|
|
1
1
|
module Kontena
|
2
2
|
module Callbacks
|
3
|
-
# Runs kontena master auth-provider config after deployment if
|
4
|
-
# auth provider configuration options have been supplied.
|
5
|
-
#
|
6
|
-
# Runs the config command with --preset kontena if the user has
|
7
|
-
# authenticated to Kontena unless --no-auth-config is used.
|
8
3
|
class CreateInitialGridAfterDeploy < Kontena::Callback
|
9
4
|
|
10
5
|
include Kontena::Cli::Common
|
@@ -24,7 +19,7 @@ module Kontena
|
|
24
19
|
end
|
25
20
|
|
26
21
|
spinner "Selecting 'test' as current grid" do
|
27
|
-
Kontena.run("grid use test")
|
22
|
+
Kontena.run("grid use --silent test")
|
28
23
|
end
|
29
24
|
end
|
30
25
|
end
|
@@ -16,15 +16,15 @@ module Kontena
|
|
16
16
|
# => { "foo" => "bar", "bar" => 123 } # (it converts integers!)
|
17
17
|
attr_accessor :server, :success_response, :error_response, :port
|
18
18
|
|
19
|
-
DEFAULT_SUCCESS_MESSAGE = "<html><head><title>Success</title></head><body><h3>Success!</h3><p>You can now close this browser window and return to the terminal application.</p></body></html>".freeze
|
20
19
|
DEFAULT_ERROR_MESSAGE = "Bad request"
|
20
|
+
SUCCESS_URL = "https://cloud-beta.kontena.io/terminal-success"
|
21
21
|
|
22
22
|
# Get new server instance
|
23
23
|
#
|
24
24
|
# @param [String] success_response Returned for successful callback
|
25
25
|
# @param [String] error_response Returned for unsuccessful callback
|
26
26
|
def initialize(success_response: nil, error_response: nil, port: nil)
|
27
|
-
@success_response = success_response
|
27
|
+
@success_response = success_response
|
28
28
|
@error_response = error_response || DEFAULT_ERROR_MESSAGE
|
29
29
|
@server = TCPServer.new('localhost', port || 0)
|
30
30
|
@port = @server.addr[1]
|
@@ -60,14 +60,24 @@ module Kontena
|
|
60
60
|
|
61
61
|
get_request = request[/GET (\/cb.+?) HTTP/, 1]
|
62
62
|
if get_request
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
63
|
+
if success_response
|
64
|
+
socket.print [
|
65
|
+
'HTTP/1.1 200 OK',
|
66
|
+
'Content-Type: text/html',
|
67
|
+
"Content-Length: #{success_response.bytesize}",
|
68
|
+
"Connection: close",
|
69
|
+
'',
|
70
|
+
success_response
|
71
|
+
].join("\r\n")
|
72
|
+
else
|
73
|
+
socket.print [
|
74
|
+
'HTTP/1.1 301 Found',
|
75
|
+
"Location: #{SUCCESS_URL}",
|
76
|
+
"Connection: close",
|
77
|
+
''
|
78
|
+
].join("\r\n")
|
79
|
+
end
|
80
|
+
|
71
81
|
socket.close
|
72
82
|
server.close
|
73
83
|
uri = URI.parse("http://localhost#{get_request}")
|
@@ -8,7 +8,6 @@ module Kontena
|
|
8
8
|
module Cli
|
9
9
|
module Master
|
10
10
|
class ConfigCommand < Kontena::Command
|
11
|
-
|
12
11
|
subcommand "set", "Set a config value", Kontena::Cli::Master::Config::SetCommand
|
13
12
|
subcommand "get", "Get a config value", Kontena::Cli::Master::Config::GetCommand
|
14
13
|
subcommand "unset", "Clear a config value", Kontena::Cli::Master::Config::UnsetCommand
|
@@ -14,7 +14,7 @@ module Kontena::Cli::Master
|
|
14
14
|
params << "--name #{self.name.shellescape}" if self.name
|
15
15
|
params << "--verbose" if self.verbose?
|
16
16
|
|
17
|
-
Kontena.run("master
|
17
|
+
Kontena.run("master login #{params.join(' ')} #{self.url.shellescape}")
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
@@ -7,20 +7,13 @@ module Kontena::Cli::Master::Users
|
|
7
7
|
|
8
8
|
parameter "EMAIL ...", "List of emails"
|
9
9
|
|
10
|
-
banner <<-EOB.gsub(/^\s+/, "")
|
11
|
-
If the email address matches the one returned from authentication provider
|
12
|
-
then the user can authenticate using 'kontena master auth <url>'.
|
13
|
-
If it doesn't, the user must use the invitation code:
|
14
|
-
$ kontena master join <url> <invite_code>
|
15
|
-
EOB
|
16
|
-
|
17
10
|
option ['-r', '--roles'], '[ROLES]', 'Comma separated list of roles to assign to the invited users'
|
18
11
|
option ['-c', '--code'], :flag, 'Only output the invite code'
|
19
12
|
|
20
|
-
|
21
|
-
|
22
|
-
token = require_token
|
13
|
+
requires_current_master
|
14
|
+
requires_current_master_token
|
23
15
|
|
16
|
+
def execute
|
24
17
|
if self.roles
|
25
18
|
roles = self.roles.split(',')
|
26
19
|
else
|
@@ -30,7 +23,7 @@ module Kontena::Cli::Master::Users
|
|
30
23
|
email_list.each do |email|
|
31
24
|
begin
|
32
25
|
data = { email: email, response_type: 'invite' }
|
33
|
-
response = client
|
26
|
+
response = client.post('/oauth2/authorize', data)
|
34
27
|
if self.code?
|
35
28
|
puts response['invite_code']
|
36
29
|
else
|
@@ -16,7 +16,6 @@ if ENV["DEV"]
|
|
16
16
|
end
|
17
17
|
|
18
18
|
class Kontena::Cli::MasterCommand < Kontena::Command
|
19
|
-
|
20
19
|
subcommand ["list", "ls"], "List masters where client has logged in", Kontena::Cli::Master::ListCommand
|
21
20
|
subcommand ["config", "cfg"], "Configure master settings", Kontena::Cli::Master::ConfigCommand
|
22
21
|
subcommand "use", "Switch to use selected master", Kontena::Cli::Master::UseCommand
|
data/lib/kontena/client.rb
CHANGED
@@ -300,7 +300,7 @@ module Kontena
|
|
300
300
|
retried ||= false
|
301
301
|
|
302
302
|
if auth && token_expired?
|
303
|
-
raise Excon::Errors::Unauthorized, "Token expired or not valid, you need to login again, use: kontena #{token_is_for_master? ? "master
|
303
|
+
raise Excon::Errors::Unauthorized, "Token expired or not valid, you need to login again, use: kontena #{token_is_for_master? ? "master" : "cloud"} login"
|
304
304
|
end
|
305
305
|
|
306
306
|
request_headers = request_headers(headers, auth)
|
@@ -329,7 +329,7 @@ module Kontena
|
|
329
329
|
|
330
330
|
parse_response
|
331
331
|
rescue Excon::Errors::Unauthorized
|
332
|
-
if token
|
332
|
+
if token
|
333
333
|
logger.debug 'Server reports access token expired'
|
334
334
|
|
335
335
|
if retried || !token || !token['refresh_token']
|
data/lib/kontena/command.rb
CHANGED
@@ -74,7 +74,7 @@ class Kontena::Command < Clamp::Command
|
|
74
74
|
end
|
75
75
|
|
76
76
|
def self.requires_current_master
|
77
|
-
banner "#{Kontena.pastel.green("Requires current master")}: This command requires that you have selected a current master using 'kontena master
|
77
|
+
banner "#{Kontena.pastel.green("Requires current master")}: This command requires that you have selected a current master using 'kontena master login' or 'kontena master use'. You can also use the environment variable KONTENA_URL to specify the master address or KONTENA_MASTER=master_name to override the current_master setting."
|
78
78
|
@requires_current_master = true
|
79
79
|
end
|
80
80
|
|
@@ -135,7 +135,7 @@ class Kontena::Command < Clamp::Command
|
|
135
135
|
retried = true
|
136
136
|
retry
|
137
137
|
else
|
138
|
-
raise Kontena::Cli::Config::TokenExpiredError, "The access token has expired and refresh failed. Try authenticating again, use: kontena master
|
138
|
+
raise Kontena::Cli::Config::TokenExpiredError, "The access token has expired and refresh failed. Try authenticating again, use: kontena master login"
|
139
139
|
end
|
140
140
|
end
|
141
141
|
|
data/lib/kontena/main_command.rb
CHANGED
@@ -47,7 +47,7 @@ class Kontena::MainCommand < Kontena::Command
|
|
47
47
|
subcommand "whoami", "Shows current logged in user", Kontena::Cli::WhoamiCommand
|
48
48
|
subcommand "plugin", "Plugin related commands", Kontena::Cli::PluginCommand
|
49
49
|
subcommand "version", "Show version", Kontena::Cli::VersionCommand
|
50
|
-
subcommand "login", "Login to Kontena Master (removed, use kontena master
|
50
|
+
subcommand "login", "Login to Kontena Master (removed, use kontena master login)", Kontena::Cli::LoginCommand
|
51
51
|
|
52
52
|
def execute
|
53
53
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kontena-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.16.0.
|
4
|
+
version: 0.16.0.pre3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kontena, Inc
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|