kontena-cli 1.4.0 → 1.4.1.pre1

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.
Files changed (62) hide show
  1. checksums.yaml +5 -5
  2. data/VERSION +1 -1
  3. data/bin/kontena +2 -1
  4. data/kontena-cli.gemspec +1 -1
  5. data/lib/kontena/cli/certificate/common.rb +16 -0
  6. data/lib/kontena/cli/certificate/export_command.rb +28 -0
  7. data/lib/kontena/cli/certificate/import_command.rb +61 -0
  8. data/lib/kontena/cli/certificate/show_command.rb +5 -2
  9. data/lib/kontena/cli/certificate_command.rb +3 -1
  10. data/lib/kontena/cli/common.rb +5 -1
  11. data/lib/kontena/cli/config.rb +23 -5
  12. data/lib/kontena/cli/external_registries/add_command.rb +2 -0
  13. data/lib/kontena/cli/external_registries/list_command.rb +1 -1
  14. data/lib/kontena/cli/helpers/exec_helper.rb +12 -4
  15. data/lib/kontena/cli/master/config/import_command.rb +1 -1
  16. data/lib/kontena/cli/master/login_command.rb +1 -1
  17. data/lib/kontena/cli/stacks/common.rb +2 -1
  18. data/lib/kontena/cli/stacks/registry/show_command.rb +1 -1
  19. data/lib/kontena/cli/stacks/service_generator.rb +1 -0
  20. data/lib/kontena/cli/stacks/yaml/opto.rb +1 -0
  21. data/lib/kontena/cli/stacks/yaml/opto/certificates_resolver.rb +37 -0
  22. data/lib/kontena/cli/stacks/yaml/opto/vault_cert_prompt_resolver.rb +1 -1
  23. data/lib/kontena/cli/stacks/yaml/reader.rb +5 -2
  24. data/lib/kontena/cli/stacks/yaml/validations.rb +2 -1
  25. data/lib/kontena/cli/vault/import_command.rb +1 -1
  26. data/lib/kontena/client.rb +1 -1
  27. data/lib/kontena/command.rb +7 -5
  28. data/lib/kontena/plugin_manager.rb +1 -1
  29. data/lib/kontena/plugin_manager/cleaner.rb +1 -1
  30. data/lib/kontena/scripts/completer.rb +1 -1
  31. data/lib/kontena/stacks_cache.rb +2 -2
  32. data/lib/kontena_cli.rb +6 -2
  33. data/spec/fixtures/certificates/test/ca-key.pem +10 -0
  34. data/spec/fixtures/certificates/test/ca.pem +10 -0
  35. data/spec/fixtures/certificates/test/ca.srl +1 -0
  36. data/spec/fixtures/certificates/test/cert.pem +8 -0
  37. data/spec/fixtures/certificates/test/csr.pem +7 -0
  38. data/spec/fixtures/certificates/test/key.pem +10 -0
  39. data/spec/fixtures/certificates/test/real-cert.pem +30 -0
  40. data/spec/fixtures/docker-compose_v2.yml +1 -0
  41. data/spec/fixtures/docker-compose_v2_with_variables.yml +12 -0
  42. data/spec/fixtures/kontena_v3_with_compose_variables.yml +11 -0
  43. data/spec/fixtures/stack-with-anchors.yml +13 -0
  44. data/spec/kontena/cli/certificates/export_command_spec.rb +49 -0
  45. data/spec/kontena/cli/certificates/import_command_spec.rb +70 -0
  46. data/spec/kontena/cli/certificates/show_command_spec.rb +57 -0
  47. data/spec/kontena/cli/cloud/login_command_spec.rb +7 -14
  48. data/spec/kontena/cli/helpers/exec_helper_spec.rb +38 -0
  49. data/spec/kontena/cli/master/login_command_spec.rb +12 -24
  50. data/spec/kontena/cli/master/use_command_spec.rb +1 -1
  51. data/spec/kontena/cli/nodes/remove_command_spec.rb +1 -1
  52. data/spec/kontena/cli/registry/{create_spec.rb → create_command_spec.rb} +0 -0
  53. data/spec/kontena/cli/stacks/upgrade_command_spec.rb +1 -1
  54. data/spec/kontena/cli/stacks/yaml/opto/certificates_resolver_spec.rb +81 -0
  55. data/spec/kontena/cli/stacks/yaml/reader_spec.rb +22 -2
  56. data/spec/kontena/cli/stacks/yaml/validator_v3_spec.rb +17 -0
  57. data/spec/kontena/command_spec.rb +54 -0
  58. data/spec/kontena/config_spec.rb +17 -2
  59. data/spec/kontena/main_command_spec.rb +13 -0
  60. data/spec/spec_helper.rb +10 -17
  61. metadata +43 -11
  62. data/spec/kontena/cli/main_command_spec.rb +0 -19
@@ -12,4 +12,17 @@ describe Kontena::MainCommand do
12
12
  end
13
13
  end
14
14
  end
15
+
16
+ describe '#subcommand_missing' do
17
+ it 'suggests plugin install for known plugin commands' do
18
+ expect(subject).to receive(:known_plugin_subcommand?).with('testplugin').and_return(true)
19
+ expect(subject).to receive(:exit_with_error).with(/plugin has not been installed/).and_call_original
20
+ expect{subject.run(['testplugin', 'master', 'create'])}.to exit_with_error
21
+ end
22
+
23
+ it 'runs normal error handling for unknown sub commands' do
24
+ expect(subject).to receive(:known_plugin_subcommand?).with('testplugin').and_return(false)
25
+ expect{subject.run(['testplugin', 'master', 'create'])}.to raise_error(Clamp::UsageError)
26
+ end
27
+ end
15
28
  end
data/spec/spec_helper.rb CHANGED
@@ -45,24 +45,17 @@ RSpec.configure do |config|
45
45
  end
46
46
 
47
47
  config.around(:each) do |example|
48
- catch :exit_with_error do
49
- begin
50
- example.run
51
- rescue SystemExit
52
- puts "Got SystemExit: #{$!.message} - Exit code: #{$!.status}"
53
- end
54
- end
55
- end
56
-
57
- unless ENV["DEBUG"]
58
- config.before(:each) do
59
- $stdout = StringIO.new
60
- $stderr = StringIO.new
61
- end
48
+ stdout = $stdout
49
+ stderr = $stderr
50
+ $stdout = $stderr = StringIO.new
62
51
 
63
- config.after(:each) do
64
- $stdout = STDOUT
65
- $stderr = STDERR
52
+ begin
53
+ example.run
54
+ rescue SystemExit => exc
55
+ fail "SystemExit with code #{exc.status}: \n#{$stderr.string}"
56
+ ensure
57
+ $stdout = stdout
58
+ $stderr = stderr
66
59
  end
67
60
  end
68
61
  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.0
4
+ version: 1.4.1.pre1
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-10-16 00:00:00.000000000 Z
11
+ date: 2017-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -184,14 +184,14 @@ dependencies:
184
184
  requirements:
185
185
  - - "~>"
186
186
  - !ruby/object:Gem::Version
187
- version: 0.8.0
187
+ version: 0.9.0
188
188
  type: :runtime
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
192
  - - "~>"
193
193
  - !ruby/object:Gem::Version
194
- version: 0.8.0
194
+ version: 0.9.0
195
195
  - !ruby/object:Gem::Dependency
196
196
  name: kontena-websocket-client
197
197
  requirement: !ruby/object:Gem::Requirement
@@ -254,7 +254,10 @@ files:
254
254
  - lib/kontena/callbacks/master/deploy/90_proptip_after_deploy.rb
255
255
  - lib/kontena/cli/bytes_helper.rb
256
256
  - lib/kontena/cli/certificate/authorize_command.rb
257
+ - lib/kontena/cli/certificate/common.rb
258
+ - lib/kontena/cli/certificate/export_command.rb
257
259
  - lib/kontena/cli/certificate/get_command.rb
260
+ - lib/kontena/cli/certificate/import_command.rb
258
261
  - lib/kontena/cli/certificate/list_command.rb
259
262
  - lib/kontena/cli/certificate/register_command.rb
260
263
  - lib/kontena/cli/certificate/remove_command.rb
@@ -440,6 +443,7 @@ files:
440
443
  - lib/kontena/cli/stacks/yaml/custom_validators/hooks_validator.rb
441
444
  - lib/kontena/cli/stacks/yaml/custom_validators/secrets_validator.rb
442
445
  - lib/kontena/cli/stacks/yaml/opto.rb
446
+ - lib/kontena/cli/stacks/yaml/opto/certificates_resolver.rb
443
447
  - lib/kontena/cli/stacks/yaml/opto/prompt_resolver.rb
444
448
  - lib/kontena/cli/stacks/yaml/opto/service_instances_resolver.rb
445
449
  - lib/kontena/cli/stacks/yaml/opto/service_link_resolver.rb
@@ -525,15 +529,25 @@ files:
525
529
  - omnibus/resources/kontena/pkg/welcome.html.erb
526
530
  - omnibus/wrappers/sh/kontena
527
531
  - spec/fixtures/api/node.json
532
+ - spec/fixtures/certificates/test/ca-key.pem
533
+ - spec/fixtures/certificates/test/ca.pem
534
+ - spec/fixtures/certificates/test/ca.srl
535
+ - spec/fixtures/certificates/test/cert.pem
536
+ - spec/fixtures/certificates/test/csr.pem
537
+ - spec/fixtures/certificates/test/key.pem
538
+ - spec/fixtures/certificates/test/real-cert.pem
528
539
  - spec/fixtures/docker-compose-invalid.yml
529
540
  - spec/fixtures/docker-compose.yml
530
541
  - spec/fixtures/docker-compose_v2.yml
542
+ - spec/fixtures/docker-compose_v2_with_variables.yml
531
543
  - spec/fixtures/kontena-malformed-yaml.yml
532
544
  - spec/fixtures/kontena-not-hash-service-config.yml
533
545
  - spec/fixtures/kontena_build_v3.yml
534
546
  - spec/fixtures/kontena_v3.yml
547
+ - spec/fixtures/kontena_v3_with_compose_variables.yml
535
548
  - spec/fixtures/stack-internal-extend.yml
536
549
  - spec/fixtures/stack-invalid.yml
550
+ - spec/fixtures/stack-with-anchors.yml
537
551
  - spec/fixtures/stack-with-dependencies-dep-1-1.yml
538
552
  - spec/fixtures/stack-with-dependencies-dep-1.yml
539
553
  - spec/fixtures/stack-with-dependencies-dep-2.yml
@@ -550,6 +564,9 @@ files:
550
564
  - spec/fixtures/stack-with-prompted-variables.yml
551
565
  - spec/fixtures/stack-with-variables.yml
552
566
  - spec/fixtures/stack-with-volumes.yml
567
+ - spec/kontena/cli/certificates/export_command_spec.rb
568
+ - spec/kontena/cli/certificates/import_command_spec.rb
569
+ - spec/kontena/cli/certificates/show_command_spec.rb
553
570
  - spec/kontena/cli/cloud/login_command_spec.rb
554
571
  - spec/kontena/cli/cloud/logout_command_spec.rb
555
572
  - spec/kontena/cli/cloud/master/add_command_spec.rb
@@ -567,7 +584,6 @@ files:
567
584
  - spec/kontena/cli/grids/use_command_spec.rb
568
585
  - spec/kontena/cli/helpers/exec_helper_spec.rb
569
586
  - spec/kontena/cli/helpers/log_helper_spec.rb
570
- - spec/kontena/cli/main_command_spec.rb
571
587
  - spec/kontena/cli/master/current_command_spec.rb
572
588
  - spec/kontena/cli/master/init_cloud_command_spec.rb
573
589
  - spec/kontena/cli/master/join_command_spec.rb
@@ -591,7 +607,7 @@ files:
591
607
  - spec/kontena/cli/nodes/ssh_command_spec.rb
592
608
  - spec/kontena/cli/nodes/update_command_spec.rb
593
609
  - spec/kontena/cli/plugins/install_command_spec.rb
594
- - spec/kontena/cli/registry/create_spec.rb
610
+ - spec/kontena/cli/registry/create_command_spec.rb
595
611
  - spec/kontena/cli/services/containers_command_spec.rb
596
612
  - spec/kontena/cli/services/events_command_spec.rb
597
613
  - spec/kontena/cli/services/exec_command_spec.rb
@@ -621,6 +637,7 @@ files:
621
637
  - spec/kontena/cli/stacks/upgrade_command_spec.rb
622
638
  - spec/kontena/cli/stacks/validate_command_spec.rb
623
639
  - spec/kontena/cli/stacks/yaml/custom_validators/affinities_validator_spec.rb
640
+ - spec/kontena/cli/stacks/yaml/opto/certificates_resolver_spec.rb
624
641
  - spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
625
642
  - spec/kontena/cli/stacks/yaml/opto/service_link_resolver_spec.rb
626
643
  - spec/kontena/cli/stacks/yaml/opto/vault_cert_prompt_resolver_spec.rb
@@ -640,6 +657,7 @@ files:
640
657
  - spec/kontena/cli/volumes/list_command_spec.rb
641
658
  - spec/kontena/cli/vpn/create_command_spec.rb
642
659
  - spec/kontena/client_spec.rb
660
+ - spec/kontena/command_spec.rb
643
661
  - spec/kontena/config_spec.rb
644
662
  - spec/kontena/kontena_cli_spec.rb
645
663
  - spec/kontena/main_command_spec.rb
@@ -673,26 +691,36 @@ required_ruby_version: !ruby/object:Gem::Requirement
673
691
  version: 2.1.0
674
692
  required_rubygems_version: !ruby/object:Gem::Requirement
675
693
  requirements:
676
- - - ">="
694
+ - - ">"
677
695
  - !ruby/object:Gem::Version
678
- version: '0'
696
+ version: 1.3.1
679
697
  requirements: []
680
698
  rubyforge_project:
681
- rubygems_version: 2.6.14
699
+ rubygems_version: 2.7.2
682
700
  signing_key:
683
701
  specification_version: 4
684
702
  summary: Kontena command line tool
685
703
  test_files:
686
704
  - spec/fixtures/api/node.json
705
+ - spec/fixtures/certificates/test/ca-key.pem
706
+ - spec/fixtures/certificates/test/ca.pem
707
+ - spec/fixtures/certificates/test/ca.srl
708
+ - spec/fixtures/certificates/test/cert.pem
709
+ - spec/fixtures/certificates/test/csr.pem
710
+ - spec/fixtures/certificates/test/key.pem
711
+ - spec/fixtures/certificates/test/real-cert.pem
687
712
  - spec/fixtures/docker-compose-invalid.yml
688
713
  - spec/fixtures/docker-compose.yml
689
714
  - spec/fixtures/docker-compose_v2.yml
715
+ - spec/fixtures/docker-compose_v2_with_variables.yml
690
716
  - spec/fixtures/kontena-malformed-yaml.yml
691
717
  - spec/fixtures/kontena-not-hash-service-config.yml
692
718
  - spec/fixtures/kontena_build_v3.yml
693
719
  - spec/fixtures/kontena_v3.yml
720
+ - spec/fixtures/kontena_v3_with_compose_variables.yml
694
721
  - spec/fixtures/stack-internal-extend.yml
695
722
  - spec/fixtures/stack-invalid.yml
723
+ - spec/fixtures/stack-with-anchors.yml
696
724
  - spec/fixtures/stack-with-dependencies-dep-1-1.yml
697
725
  - spec/fixtures/stack-with-dependencies-dep-1.yml
698
726
  - spec/fixtures/stack-with-dependencies-dep-2.yml
@@ -709,6 +737,9 @@ test_files:
709
737
  - spec/fixtures/stack-with-prompted-variables.yml
710
738
  - spec/fixtures/stack-with-variables.yml
711
739
  - spec/fixtures/stack-with-volumes.yml
740
+ - spec/kontena/cli/certificates/export_command_spec.rb
741
+ - spec/kontena/cli/certificates/import_command_spec.rb
742
+ - spec/kontena/cli/certificates/show_command_spec.rb
712
743
  - spec/kontena/cli/cloud/login_command_spec.rb
713
744
  - spec/kontena/cli/cloud/logout_command_spec.rb
714
745
  - spec/kontena/cli/cloud/master/add_command_spec.rb
@@ -726,7 +757,6 @@ test_files:
726
757
  - spec/kontena/cli/grids/use_command_spec.rb
727
758
  - spec/kontena/cli/helpers/exec_helper_spec.rb
728
759
  - spec/kontena/cli/helpers/log_helper_spec.rb
729
- - spec/kontena/cli/main_command_spec.rb
730
760
  - spec/kontena/cli/master/current_command_spec.rb
731
761
  - spec/kontena/cli/master/init_cloud_command_spec.rb
732
762
  - spec/kontena/cli/master/join_command_spec.rb
@@ -750,7 +780,7 @@ test_files:
750
780
  - spec/kontena/cli/nodes/ssh_command_spec.rb
751
781
  - spec/kontena/cli/nodes/update_command_spec.rb
752
782
  - spec/kontena/cli/plugins/install_command_spec.rb
753
- - spec/kontena/cli/registry/create_spec.rb
783
+ - spec/kontena/cli/registry/create_command_spec.rb
754
784
  - spec/kontena/cli/services/containers_command_spec.rb
755
785
  - spec/kontena/cli/services/events_command_spec.rb
756
786
  - spec/kontena/cli/services/exec_command_spec.rb
@@ -780,6 +810,7 @@ test_files:
780
810
  - spec/kontena/cli/stacks/upgrade_command_spec.rb
781
811
  - spec/kontena/cli/stacks/validate_command_spec.rb
782
812
  - spec/kontena/cli/stacks/yaml/custom_validators/affinities_validator_spec.rb
813
+ - spec/kontena/cli/stacks/yaml/opto/certificates_resolver_spec.rb
783
814
  - spec/kontena/cli/stacks/yaml/opto/prompt_resolver_spec.rb
784
815
  - spec/kontena/cli/stacks/yaml/opto/service_link_resolver_spec.rb
785
816
  - spec/kontena/cli/stacks/yaml/opto/vault_cert_prompt_resolver_spec.rb
@@ -799,6 +830,7 @@ test_files:
799
830
  - spec/kontena/cli/volumes/list_command_spec.rb
800
831
  - spec/kontena/cli/vpn/create_command_spec.rb
801
832
  - spec/kontena/client_spec.rb
833
+ - spec/kontena/command_spec.rb
802
834
  - spec/kontena/config_spec.rb
803
835
  - spec/kontena/kontena_cli_spec.rb
804
836
  - spec/kontena/main_command_spec.rb
@@ -1,19 +0,0 @@
1
- require "kontena/main_command"
2
-
3
- describe Kontena::MainCommand do
4
-
5
- let(:subject) { described_class.new(File.basename($0)) }
6
- describe '#subcommand_missing' do
7
- it 'suggests plugin install for known plugin commands' do
8
- expect(subject).to receive(:known_plugin_subcommand?).with('testplugin').and_return(true)
9
- expect(subject).to receive(:exit_with_error).with(/plugin has not been installed/).and_call_original
10
- expect{subject.run(['testplugin', 'master', 'create'])}.to exit_with_error
11
- end
12
-
13
- it 'runs normal error handling for unknown sub commands' do
14
- expect(subject).to receive(:known_plugin_subcommand?).with('testplugin').and_return(false)
15
- expect{subject.run(['testplugin', 'master', 'create'])}.to raise_error(Clamp::UsageError)
16
- end
17
- end
18
- end
19
-