kontena-cli 1.1.6 → 1.2.0.dev1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +1 -0
- data/VERSION +1 -1
- data/bin/kontena +8 -28
- data/kontena-cli.gemspec +2 -2
- data/lib/kontena/cli/app_command.rb +14 -27
- data/lib/kontena/cli/certificate_command.rb +4 -7
- data/lib/kontena/cli/cloud/master_command.rb +5 -12
- data/lib/kontena/cli/cloud_command.rb +4 -7
- data/lib/kontena/cli/container_command.rb +4 -9
- data/lib/kontena/cli/etcd/health_command.rb +1 -0
- data/lib/kontena/cli/etcd_command.rb +6 -13
- data/lib/kontena/cli/external_registry_command.rb +3 -7
- data/lib/kontena/cli/grid_command.rb +14 -29
- data/lib/kontena/cli/grids/cloud_config_command.rb +1 -0
- data/lib/kontena/cli/grids/common.rb +2 -0
- data/lib/kontena/cli/grids/create_command.rb +5 -0
- data/lib/kontena/cli/grids/trusted_subnet_command.rb +6 -8
- data/lib/kontena/cli/grids/user_command.rb +3 -6
- data/lib/kontena/cli/master/config_command.rb +6 -12
- data/lib/kontena/cli/master/token_command.rb +6 -11
- data/lib/kontena/cli/master/users/role_command.rb +2 -4
- data/lib/kontena/cli/master/users_command.rb +4 -8
- data/lib/kontena/cli/master_command.rb +14 -33
- data/lib/kontena/cli/node_command.rb +7 -15
- data/lib/kontena/cli/nodes/health_command.rb +1 -1
- data/lib/kontena/cli/nodes/label_command.rb +3 -9
- data/lib/kontena/cli/nodes/show_command.rb +1 -1
- data/lib/kontena/cli/nodes/ssh_command.rb +13 -4
- data/lib/kontena/cli/plugin_command.rb +5 -9
- data/lib/kontena/cli/registry_command.rb +2 -5
- data/lib/kontena/cli/service_command.rb +22 -45
- data/lib/kontena/cli/services/container_command.rb +2 -3
- data/lib/kontena/cli/services/env_command.rb +3 -6
- data/lib/kontena/cli/services/secret_command.rb +2 -4
- data/lib/kontena/cli/stack_command.rb +11 -24
- data/lib/kontena/cli/stacks/registry_command.rb +5 -12
- data/lib/kontena/cli/stacks/upgrade_command.rb +6 -0
- data/lib/kontena/cli/stacks/yaml/reader.rb +17 -2
- data/lib/kontena/cli/subcommand_loader.rb +82 -0
- data/lib/kontena/cli/vault_command.rb +7 -15
- data/lib/kontena/cli/version.rb +6 -1
- data/lib/kontena/cli/vpn_command.rb +3 -7
- data/lib/kontena/command.rb +28 -1
- data/lib/kontena/machine/cloud_config/cloudinit.yml +1 -1
- data/lib/kontena/main_command.rb +22 -38
- data/lib/kontena/scripts/completer +2 -233
- data/lib/kontena/scripts/completer.rb +230 -0
- data/lib/kontena/scripts/init +5 -8
- data/lib/kontena/scripts/kontena.bash +8 -0
- data/lib/kontena/scripts/kontena.zsh +11 -0
- data/lib/kontena_cli.rb +9 -1
- data/omnibus/wrappers/sh/kontena +1 -1
- data/spec/fixtures/stack-with-liquid-optional.yml +14 -0
- data/spec/fixtures/stack-with-liquid-undefined.yml +12 -0
- data/spec/kontena/cli/app/build_command_spec.rb +1 -2
- data/spec/kontena/cli/app/common_spec.rb +1 -2
- data/spec/kontena/cli/app/config_command_spec.rb +0 -1
- data/spec/kontena/cli/app/deploy_command_spec.rb +2 -3
- data/spec/kontena/cli/app/docker_helper_spec.rb +0 -1
- data/spec/kontena/cli/app/init_command_spec.rb +0 -1
- data/spec/kontena/cli/app/logs_command_spec.rb +0 -1
- data/spec/kontena/cli/app/scale_spec.rb +2 -3
- data/spec/kontena/cli/app/service_generator_spec.rb +1 -2
- data/spec/kontena/cli/app/service_generator_v2_spec.rb +0 -1
- data/spec/kontena/cli/app/yaml/reader_spec.rb +0 -1
- data/spec/kontena/cli/app/yaml/service_extender_spec.rb +0 -1
- data/spec/kontena/cli/app/yaml/validator_spec.rb +0 -1
- data/spec/kontena/cli/app/yaml/validator_v2_spec.rb +0 -1
- data/spec/kontena/cli/cloud/login_command_spec.rb +0 -1
- data/spec/kontena/cli/cloud/logout_command_spec.rb +0 -1
- data/spec/kontena/cli/cloud/master/add_command_spec.rb +0 -1
- data/spec/kontena/cli/common_spec.rb +0 -1
- data/spec/kontena/cli/containers/list_command_spec.rb +0 -1
- data/spec/kontena/cli/containers/logs_command_spec.rb +0 -1
- data/spec/kontena/cli/etcd/health_command_spec.rb +2 -0
- data/spec/kontena/cli/grids/trusted_subnets/add_command_spec.rb +0 -11
- data/spec/kontena/cli/grids/trusted_subnets/list_command_spec.rb +4 -13
- data/spec/kontena/cli/grids/trusted_subnets/remove_command_spec.rb +0 -11
- data/spec/kontena/cli/grids/use_command_spec.rb +0 -1
- data/spec/kontena/cli/helpers/log_helper_spec.rb +0 -1
- data/spec/kontena/cli/main_command_spec.rb +2 -3
- data/spec/kontena/cli/master/current_command_spec.rb +5 -15
- data/spec/kontena/cli/master/init_cloud_command_spec.rb +0 -1
- data/spec/kontena/cli/master/login_command_spec.rb +0 -1
- data/spec/kontena/cli/master/logout_command_spec.rb +0 -1
- data/spec/kontena/cli/master/use_command_spec.rb +0 -1
- data/spec/kontena/cli/master/users/invite_command_spec.rb +1 -5
- data/spec/kontena/cli/master/users/remove_command_spec.rb +2 -14
- data/spec/kontena/cli/master/users/roles/add_command_spec.rb +0 -1
- data/spec/kontena/cli/master/users/roles/remove_command_spec.rb +0 -1
- data/spec/kontena/cli/nodes/list_command_spec.rb +2 -0
- data/spec/kontena/cli/services/containers_command_spec.rb +0 -18
- data/spec/kontena/cli/services/exec_command_spec.rb +6 -4
- data/spec/kontena/cli/services/link_command_spec.rb +5 -19
- data/spec/kontena/cli/services/restart_command_spec.rb +0 -16
- data/spec/kontena/cli/services/secrets/link_command_spec.rb +0 -11
- data/spec/kontena/cli/services/secrets/unlink_command_spec.rb +1 -12
- data/spec/kontena/cli/services/services_helper_spec.rb +0 -1
- data/spec/kontena/cli/services/unlink_command_spec.rb +7 -21
- data/spec/kontena/cli/services/update_command_spec.rb +0 -15
- data/spec/kontena/cli/stacks/build_command_spec.rb +0 -1
- data/spec/kontena/cli/stacks/deploy_command_spec.rb +10 -13
- data/spec/kontena/cli/stacks/install_command_spec.rb +0 -15
- data/spec/kontena/cli/stacks/list_command_spec.rb +4 -10
- data/spec/kontena/cli/stacks/remove_command_spec.rb +1 -16
- data/spec/kontena/cli/stacks/service_generator_spec.rb +0 -1
- data/spec/kontena/cli/stacks/service_generator_v2_spec.rb +0 -1
- data/spec/kontena/cli/stacks/show_command_spec.rb +1 -14
- data/spec/kontena/cli/stacks/upgrade_command_spec.rb +19 -1
- data/spec/kontena/cli/stacks/yaml/reader_spec.rb +163 -130
- data/spec/kontena/cli/stacks/yaml/service_extender_spec.rb +0 -1
- data/spec/kontena/cli/stacks/yaml/validator_v3_spec.rb +0 -1
- data/spec/kontena/cli/vault/export_spec.rb +0 -1
- data/spec/kontena/cli/vault/import_spec.rb +4 -5
- data/spec/kontena/cli/version_command_spec.rb +8 -6
- data/spec/kontena/cli/vpn/create_command_spec.rb +3 -4
- data/spec/kontena/client_spec.rb +0 -1
- data/spec/kontena/config_spec.rb +0 -1
- data/spec/kontena/kontena_cli_spec.rb +1 -1
- data/spec/kontena/main_command_spec.rb +0 -1
- data/spec/kontena/plugin_manager_spec.rb +0 -1
- data/spec/spec_helper.rb +1 -0
- data/spec/support/client_helpers.rb +1 -1
- data/spec/support/exit_with_error_helper.rb +36 -0
- data/spec/support/fixtures_helpers.rb +5 -2
- metadata +18 -7
@@ -1,4 +1,3 @@
|
|
1
|
-
require_relative "../../../spec_helper"
|
2
1
|
require 'kontena/cli/vault/import_command'
|
3
2
|
|
4
3
|
|
@@ -18,15 +17,15 @@ describe Kontena::Cli::Vault::ImportCommand do
|
|
18
17
|
expect_to_require_current_master
|
19
18
|
|
20
19
|
it 'asks for confirmation' do
|
21
|
-
expect(subject).to receive(:confirm).
|
20
|
+
expect(subject).to receive(:confirm).and_return(false)
|
22
21
|
expect(File).to receive(:read).with('foo.yml').and_return("foo: bar\n")
|
23
|
-
|
22
|
+
subject.run(['foo.yml'])
|
24
23
|
end
|
25
24
|
|
26
25
|
it 'dies if the yml contains something odd' do
|
27
26
|
expect(File).to receive(:read).with('foo.yml').and_return({foo: 'bar', bar: { foo: ["bar"] }}.to_yaml)
|
28
|
-
expect(subject).to receive(:exit_with_error).with(/Invalid value/).
|
29
|
-
expect{subject.run(['foo.yml'])}.to
|
27
|
+
expect(subject).to receive(:exit_with_error).with(/Invalid value/).and_call_original
|
28
|
+
expect{subject.run(['--force', 'foo.yml'])}.to exit_with_error
|
30
29
|
end
|
31
30
|
|
32
31
|
it 'runs vault write for kv-pairs in yaml' do
|
@@ -1,17 +1,19 @@
|
|
1
|
-
require_relative "../../spec_helper"
|
2
1
|
require "kontena/cli/version_command"
|
3
2
|
|
4
3
|
describe Kontena::Cli::VersionCommand do
|
5
4
|
|
6
5
|
include ClientHelpers
|
6
|
+
|
7
|
+
let :http_client do
|
8
|
+
double(:http_client)
|
9
|
+
end
|
7
10
|
|
8
11
|
describe '#execute' do
|
9
|
-
before(:each) do
|
10
|
-
allow(subject).to receive(:client).and_return(client)
|
11
|
-
end
|
12
|
-
|
13
12
|
it 'runs without errors' do
|
14
|
-
expect
|
13
|
+
expect(client).to receive(:http_client).and_return(http_client)
|
14
|
+
expect(http_client).to receive(:get).with(path: '/').and_return(double(body: '{"version": "0.1"}'))
|
15
|
+
|
16
|
+
expect { subject.run([]) }.to output("cli: #{Kontena::Cli::VERSION}\nmaster: 0.1 (someurl)\n").to_stdout
|
15
17
|
end
|
16
18
|
end
|
17
19
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
require_relative "../../../spec_helper"
|
2
1
|
require "kontena/cli/vpn/create_command"
|
3
2
|
|
4
3
|
describe Kontena::Cli::Vpn::CreateCommand do
|
@@ -13,7 +12,7 @@ describe Kontena::Cli::Vpn::CreateCommand do
|
|
13
12
|
|
14
13
|
expect {
|
15
14
|
subject.execute
|
16
|
-
}.to
|
15
|
+
}.to exit_with_error
|
17
16
|
end
|
18
17
|
end
|
19
18
|
|
@@ -29,7 +28,7 @@ describe Kontena::Cli::Vpn::CreateCommand do
|
|
29
28
|
|
30
29
|
expect {
|
31
30
|
subject.find_node(token, nil)
|
32
|
-
}.to
|
31
|
+
}.to exit_with_error
|
33
32
|
end
|
34
33
|
|
35
34
|
it 'should return first online node with public ip' do
|
@@ -69,7 +68,7 @@ describe Kontena::Cli::Vpn::CreateCommand do
|
|
69
68
|
|
70
69
|
expect {
|
71
70
|
subject.find_node(token, 'foobar')
|
72
|
-
}.to
|
71
|
+
}.to exit_with_error
|
73
72
|
end
|
74
73
|
|
75
74
|
end
|
data/spec/kontena/client_spec.rb
CHANGED
data/spec/kontena/config_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -0,0 +1,36 @@
|
|
1
|
+
RSpec::Matchers.define :exit_with_error do
|
2
|
+
|
3
|
+
def supports_block_expectations?
|
4
|
+
true
|
5
|
+
end
|
6
|
+
|
7
|
+
match do |block|
|
8
|
+
begin
|
9
|
+
block.call
|
10
|
+
rescue SystemExit => e
|
11
|
+
@exit_status = e.status
|
12
|
+
end
|
13
|
+
!@exit_status.nil? && @exit_status == expected_status
|
14
|
+
end
|
15
|
+
|
16
|
+
chain :status do |status|
|
17
|
+
@expected_status = status
|
18
|
+
end
|
19
|
+
|
20
|
+
failure_message do |block|
|
21
|
+
"expected block to exit with status #{expected_status} but exit " +
|
22
|
+
(@exit_status.nil? ? "was not called" : "status was #{@exit_status}")
|
23
|
+
end
|
24
|
+
|
25
|
+
failure_message_when_negated do |block|
|
26
|
+
"expected block not to raise SystemExit, got exit with status #{@exit_status}"
|
27
|
+
end
|
28
|
+
|
29
|
+
description do
|
30
|
+
"expect block to exit #{expected_status.zero? ? "without error" : "with error (status #{expected_status})"}"
|
31
|
+
end
|
32
|
+
|
33
|
+
def expected_status
|
34
|
+
@expected_status ||= 1
|
35
|
+
end
|
36
|
+
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: 1.
|
4
|
+
version: 1.2.0.dev1
|
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-03-
|
11
|
+
date: 2017-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 0.11.0
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 0.11.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: clamp
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -192,7 +192,7 @@ dependencies:
|
|
192
192
|
- - "~>"
|
193
193
|
- !ruby/object:Gem::Version
|
194
194
|
version: 4.0.0
|
195
|
-
description: Kontena
|
195
|
+
description: Command-line client for the Kontena container and microservices platform
|
196
196
|
email:
|
197
197
|
- info@kontena.io
|
198
198
|
executables:
|
@@ -202,6 +202,7 @@ extra_rdoc_files: []
|
|
202
202
|
files:
|
203
203
|
- ".dockerignore"
|
204
204
|
- ".gitignore"
|
205
|
+
- ".rspec"
|
205
206
|
- Dockerfile
|
206
207
|
- Gemfile
|
207
208
|
- LICENSE.txt
|
@@ -444,6 +445,7 @@ files:
|
|
444
445
|
- lib/kontena/cli/stacks/yaml/service_extender.rb
|
445
446
|
- lib/kontena/cli/stacks/yaml/validations.rb
|
446
447
|
- lib/kontena/cli/stacks/yaml/validator_v3.rb
|
448
|
+
- lib/kontena/cli/subcommand_loader.rb
|
447
449
|
- lib/kontena/cli/vault/export_command.rb
|
448
450
|
- lib/kontena/cli/vault/import_command.rb
|
449
451
|
- lib/kontena/cli/vault/list_command.rb
|
@@ -474,7 +476,10 @@ files:
|
|
474
476
|
- lib/kontena/presets/github_auth_provider.yml
|
475
477
|
- lib/kontena/presets/kontena_auth_provider.yml
|
476
478
|
- lib/kontena/scripts/completer
|
479
|
+
- lib/kontena/scripts/completer.rb
|
477
480
|
- lib/kontena/scripts/init
|
481
|
+
- lib/kontena/scripts/kontena.bash
|
482
|
+
- lib/kontena/scripts/kontena.zsh
|
478
483
|
- lib/kontena/stacks_cache.rb
|
479
484
|
- lib/kontena/stacks_client.rb
|
480
485
|
- lib/kontena/util.rb
|
@@ -522,6 +527,8 @@ files:
|
|
522
527
|
- spec/fixtures/stack-with-env-file.yml
|
523
528
|
- spec/fixtures/stack-with-ifs.yml
|
524
529
|
- spec/fixtures/stack-with-invalid-liquid.yml
|
530
|
+
- spec/fixtures/stack-with-liquid-optional.yml
|
531
|
+
- spec/fixtures/stack-with-liquid-undefined.yml
|
525
532
|
- spec/fixtures/stack-with-liquid.yml
|
526
533
|
- spec/fixtures/stack-with-prompted-variables.yml
|
527
534
|
- spec/fixtures/stack-with-variables.yml
|
@@ -601,6 +608,7 @@ files:
|
|
601
608
|
- spec/kontena/plugin_manager_spec.rb
|
602
609
|
- spec/spec_helper.rb
|
603
610
|
- spec/support/client_helpers.rb
|
611
|
+
- spec/support/exit_with_error_helper.rb
|
604
612
|
- spec/support/fixtures_helpers.rb
|
605
613
|
- spec/support/output_helpers.rb
|
606
614
|
- spec/support/requirements_helper.rb
|
@@ -621,9 +629,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
621
629
|
version: 2.1.0
|
622
630
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
623
631
|
requirements:
|
624
|
-
- - "
|
632
|
+
- - ">"
|
625
633
|
- !ruby/object:Gem::Version
|
626
|
-
version:
|
634
|
+
version: 1.3.1
|
627
635
|
requirements: []
|
628
636
|
rubyforge_project:
|
629
637
|
rubygems_version: 2.6.8
|
@@ -655,6 +663,8 @@ test_files:
|
|
655
663
|
- spec/fixtures/stack-with-env-file.yml
|
656
664
|
- spec/fixtures/stack-with-ifs.yml
|
657
665
|
- spec/fixtures/stack-with-invalid-liquid.yml
|
666
|
+
- spec/fixtures/stack-with-liquid-optional.yml
|
667
|
+
- spec/fixtures/stack-with-liquid-undefined.yml
|
658
668
|
- spec/fixtures/stack-with-liquid.yml
|
659
669
|
- spec/fixtures/stack-with-prompted-variables.yml
|
660
670
|
- spec/fixtures/stack-with-variables.yml
|
@@ -734,6 +744,7 @@ test_files:
|
|
734
744
|
- spec/kontena/plugin_manager_spec.rb
|
735
745
|
- spec/spec_helper.rb
|
736
746
|
- spec/support/client_helpers.rb
|
747
|
+
- spec/support/exit_with_error_helper.rb
|
737
748
|
- spec/support/fixtures_helpers.rb
|
738
749
|
- spec/support/output_helpers.rb
|
739
750
|
- spec/support/requirements_helper.rb
|