kontena-cli 0.17.0.pre4 → 0.17.0.pre5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/kontena/cli/master/login_command.rb +2 -2
- data/spec/kontena/cli/master/login_command_spec.rb +44 -0
- 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: 3835d40a477a0fb0ab94945857b84a1ab33d006f
|
4
|
+
data.tar.gz: 5f177bfca7d455d0861ddad86d3f83c79512697a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 291def87302aa7427d81ee28ff0040f4bc4b8d235f775bf42530e243fdf461c1e5022e853bd88a3807b887470e893cc469f0eb6c40315041c80bdd2f2611ebbf
|
7
|
+
data.tar.gz: 15705cab01e27db243cbe6d9be9c7b18a748027755ab7674b1f34ac5482b9c036d9d005e2cfb8cb12eab7a316532a0b0330976b648fdb42768b59f665771ba9d
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.17.0.
|
1
|
+
0.17.0.pre5
|
@@ -255,7 +255,7 @@ module Kontena::Cli::Master
|
|
255
255
|
def update_server_to_config(server)
|
256
256
|
server.name ||= next_default_name
|
257
257
|
config.servers << server unless config.servers.include?(server)
|
258
|
-
config.
|
258
|
+
config.current_master = server.name
|
259
259
|
config.write
|
260
260
|
config.reset_instance
|
261
261
|
end
|
@@ -289,7 +289,7 @@ module Kontena::Cli::Master
|
|
289
289
|
|
290
290
|
name_match = config.find_server(name)
|
291
291
|
|
292
|
-
if name_match
|
292
|
+
if name_match
|
293
293
|
#found a server with the provided name, set the provided url to it and return
|
294
294
|
name_match.url = url
|
295
295
|
return name_match
|
@@ -311,6 +311,50 @@ describe Kontena::Cli::Master::LoginCommand do
|
|
311
311
|
end
|
312
312
|
end
|
313
313
|
|
314
|
+
context 'with servers in config' do
|
315
|
+
let(:webserver) { double(:webserver) }
|
316
|
+
before(:each) do
|
317
|
+
allow(File).to receive(:read).and_return('
|
318
|
+
{
|
319
|
+
"current_server": null,
|
320
|
+
"current_account": "kontena",
|
321
|
+
"servers": [
|
322
|
+
{
|
323
|
+
"name": "fooserver",
|
324
|
+
"url": "http://foo.example.com:80",
|
325
|
+
"username": "admin",
|
326
|
+
"grid": "test",
|
327
|
+
"token": "abcd",
|
328
|
+
"token_expires_at": 0,
|
329
|
+
"refresh_token": null
|
330
|
+
}
|
331
|
+
]
|
332
|
+
}
|
333
|
+
')
|
334
|
+
|
335
|
+
allow(File).to receive(:write).and_return(true)
|
336
|
+
allow(File).to receive(:exist?).and_return(true)
|
337
|
+
allow(File).to receive(:readable?).and_return(true)
|
338
|
+
allow(Kontena::Client).to receive(:new).and_return(client)
|
339
|
+
allow(Kontena::LocalhostWebServer).to receive(:new).and_return(webserver)
|
340
|
+
allow(webserver).to receive(:port).and_return(12345)
|
341
|
+
allow(webserver).to receive(:serve_one).and_return(
|
342
|
+
{ 'code' => 'abcd1234' }
|
343
|
+
)
|
344
|
+
end
|
345
|
+
|
346
|
+
it 'changes current master to created master' do
|
347
|
+
allow(client).to receive(:last_response).at_least(:once).and_return(OpenStruct.new(status: 302, headers: { 'Location' => 'http://authprovider.example.com/authplz' }))
|
348
|
+
allow(client).to receive(:request).and_return({})
|
349
|
+
allow(Launchy).to receive(:open).with('http://authprovider.example.com/authplz').and_return(true)
|
350
|
+
allow(client).to receive(:exchange_code).with('abcd1234').and_return('access_token' => 'defg456', 'server' => { 'name' => 'foobar' }, 'user' => { 'name' => 'testuser' })
|
351
|
+
subject.config.current_master = 'fooserver'
|
352
|
+
subject.config.current_master
|
353
|
+
subject.run(%w(--skip-grid-auto-select http://foobar.example.com))
|
354
|
+
expect(subject.config.current_master.name).to eq 'foobar'
|
355
|
+
end
|
356
|
+
end
|
357
|
+
|
314
358
|
describe '#authentication_url_from_master' do
|
315
359
|
it 'should exit with error if master returns a json with error' do
|
316
360
|
allow(Kontena::Client).to receive(:new).and_return(client)
|
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.17.0.
|
4
|
+
version: 0.17.0.pre5
|
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-11-
|
11
|
+
date: 2016-11-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|