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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2cd10a782d72e14c697891b6de5aa825f6d25ee3
4
- data.tar.gz: 4a00e35a86fed8fa9f41dd194a81577e921a26d1
3
+ metadata.gz: 3835d40a477a0fb0ab94945857b84a1ab33d006f
4
+ data.tar.gz: 5f177bfca7d455d0861ddad86d3f83c79512697a
5
5
  SHA512:
6
- metadata.gz: 73c71530dac6cd22b3781754cd6302cca76e4b3421edf58ea7e929d2dff00e077a507b80e81bd759e8abdc9625faf5247c724852ad9bf17074afc7634678a1c0
7
- data.tar.gz: 68493feaf35cbb9e0c0a2611d1ca52b7f7ed4aafde767565d73e799e873c05f9ff83a5b99c50279696b6f3ba604a76899d6485effb595b3e9221332816447c3c
6
+ metadata.gz: 291def87302aa7427d81ee28ff0040f4bc4b8d235f775bf42530e243fdf461c1e5022e853bd88a3807b887470e893cc469f0eb6c40315041c80bdd2f2611ebbf
7
+ data.tar.gz: 15705cab01e27db243cbe6d9be9c7b18a748027755ab7674b1f34ac5482b9c036d9d005e2cfb8cb12eab7a316532a0b0330976b648fdb42768b59f665771ba9d
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.17.0.pre4
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.current_server = server.name
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.pre4
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-22 00:00:00.000000000 Z
11
+ date: 2016-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler