morpheus-cli 8.0.5 → 8.0.7

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.
@@ -1,6 +1,6 @@
1
1
  require 'term/ansicolor'
2
2
  require 'readline'
3
- require 'csv'
3
+
4
4
  module Morpheus
5
5
  module Cli
6
6
  module OptionTypes
@@ -304,8 +304,8 @@ module Morpheus
304
304
  value = select_prompt(option_type.merge({'defaultValue' => value, 'defaultInputValue' => input_value}), api_client, option_params, true, nil, false, ignore_empty, options[:edit_mode])
305
305
  elsif option_type['type'] == 'multiSelect'
306
306
  # support value as csv like "thing1, thing2"
307
- value_list = value.is_a?(String) ? value.parse_csv.collect {|v| v ? v.to_s.strip : v } : [value].flatten
308
- input_value_list = input_value.is_a?(String) ? input_value.parse_csv.collect {|v| v ? v.to_s.strip : v } : [input_value].flatten
307
+ value_list = value.is_a?(String) ? value.split(",").collect {|v| v ? v.to_s.strip : v } : [value].flatten
308
+ input_value_list = input_value.is_a?(String) ? input_value.split(",").collect {|v| v ? v.to_s.strip : v } : [input_value].flatten
309
309
  select_value_list = []
310
310
  value_list.each_with_index do |v, i|
311
311
  select_value_list << select_prompt(option_type.merge({'defaultValue' => v, 'defaultInputValue' => input_value_list[i]}), api_client, option_params, true, nil, false, ignore_empty, options[:edit_mode])
@@ -315,8 +315,8 @@ module Morpheus
315
315
  value = typeahead_prompt(option_type.merge({'defaultValue' => value, 'defaultInputValue' => input_value}), api_client, option_params, true)
316
316
  elsif option_type['type'] == 'multiTypeahead'
317
317
  # support value as csv like "thing1, thing2"
318
- value_list = value.is_a?(String) ? value.parse_csv.collect {|v| v ? v.to_s.strip : v } : [value].flatten
319
- input_value_list = input_value.is_a?(String) ? input_value.parse_csv.collect {|v| v ? v.to_s.strip : v } : [input_value].flatten
318
+ value_list = value.is_a?(String) ? value.split(",").collect {|v| v ? v.to_s.strip : v } : [value].flatten
319
+ input_value_list = input_value.is_a?(String) ? input_value.split(",").collect {|v| v ? v.to_s.strip : v } : [input_value].flatten
320
320
  select_value_list = []
321
321
  value_list.each_with_index do |v, i|
322
322
  select_value_list << typeahead_prompt(option_type.merge({'defaultValue' => v, 'defaultInputValue' => input_value_list[i]}), api_client, option_params, true)
@@ -1,6 +1,6 @@
1
1
 
2
2
  module Morpheus
3
3
  module Cli
4
- VERSION = "8.0.5"
4
+ VERSION = "8.0.7"
5
5
  end
6
6
  end
@@ -0,0 +1,23 @@
1
+ require 'morpheus_test'
2
+
3
+ # Tests for Morpheus::InstancesInterface
4
+ class MorpheusTest::ClientsInterfaceTest < MorpheusTest::TestCase
5
+
6
+ def test_clients_interface
7
+ @clients_interface = client.clients
8
+ response = @clients_interface.list()
9
+ records = response['clients']
10
+ assert records.is_a?(Array)
11
+ if !records.empty?
12
+ response = @clients_interface.get(records[0]['id'])
13
+ record = response['client']
14
+ assert record.is_a?(Hash)
15
+ assert_equal record['id'], records[0]['id']
16
+ assert_equal record['clientId'], records[0]['clientId']
17
+ else
18
+ #puts "No clients found in this environment"
19
+ end
20
+ #todo: create and delete
21
+ end
22
+
23
+ end
@@ -0,0 +1,45 @@
1
+ require 'morpheus_test'
2
+
3
+ class MorpheusTest::ClientsTest < MorpheusTest::TestCase
4
+
5
+ def test_clients_list
6
+ assert_execute %(clients list)
7
+ assert_execute %(clients list "System Admin")
8
+ end
9
+
10
+ # def test_clients_get_system_admin
11
+ # assert_execute %(clients get "System Admin")
12
+ # assert_execute %(clients get "System Admin" --permissions)
13
+ # end
14
+
15
+ def test_clients_get
16
+ record = client.clients.list({})['clients'][0]
17
+ if record
18
+ assert_execute %(clients get "#{record['id']}")
19
+ name_arg = record['clientId']
20
+ assert_execute %(clients get "#{escape_arg name_arg}")
21
+ else
22
+ puts "No client found, unable to execute test `#{__method__}`"
23
+ end
24
+ end
25
+
26
+ def test_clients_get_morph_cli
27
+ assert_execute %(clients get morph-cli)
28
+ end
29
+
30
+ # todo: test all the other commands
31
+
32
+ # def test_clients_add
33
+ # assert_execute %(clients add "test_client_#{random_id}" -N)
34
+ # end
35
+
36
+ # def test_clients_update
37
+ # #skip "Test needs to be added"
38
+ # assert_execute %(clients update "test_client_#{random_id}" --description "neat")
39
+ # end
40
+
41
+ # def test_clients_remove
42
+ # assert_execute %(clients remove "test_client_#{random_id}" -y")
43
+ # end
44
+
45
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: morpheus-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.0.5
4
+ version: 8.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Estes
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2025-04-10 00:00:00.000000000 Z
14
+ date: 2025-06-13 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: public_suffix
@@ -372,6 +372,7 @@ files:
372
372
  - lib/morpheus/api/service_plans_interface.rb
373
373
  - lib/morpheus/api/setup_interface.rb
374
374
  - lib/morpheus/api/snapshots_interface.rb
375
+ - lib/morpheus/api/storage_datastores_interface.rb
375
376
  - lib/morpheus/api/storage_providers_interface.rb
376
377
  - lib/morpheus/api/storage_server_types_interface.rb
377
378
  - lib/morpheus/api/storage_servers_interface.rb
@@ -559,6 +560,7 @@ files:
559
560
  - lib/morpheus/cli/commands/snapshots.rb
560
561
  - lib/morpheus/cli/commands/source_command.rb
561
562
  - lib/morpheus/cli/commands/ssl_verification_command.rb
563
+ - lib/morpheus/cli/commands/storage_datastores.rb
562
564
  - lib/morpheus/cli/commands/storage_providers_command.rb
563
565
  - lib/morpheus/cli/commands/storage_server_types.rb
564
566
  - lib/morpheus/cli/commands/storage_servers.rb
@@ -630,6 +632,7 @@ files:
630
632
  - lib/morpheus/terminal.rb
631
633
  - lib/morpheus/util.rb
632
634
  - morpheus-cli.gemspec
635
+ - test/api/clients_interface_test.rb
633
636
  - test/api/containers_interface_test.rb
634
637
  - test/api/instances_interface_test.rb
635
638
  - test/api/network_routers_interface_test.rb
@@ -637,6 +640,7 @@ files:
637
640
  - test/cli/access_token_test.rb
638
641
  - test/cli/auth_test.rb
639
642
  - test/cli/cli_test.rb
643
+ - test/cli/clients_test.rb
640
644
  - test/cli/containers_test.rb
641
645
  - test/cli/help_test.rb
642
646
  - test/cli/instances_test.rb
@@ -676,6 +680,7 @@ signing_key:
676
680
  specification_version: 4
677
681
  summary: Provides CLI Interface to the Morpheus Public/Private Cloud Appliance
678
682
  test_files:
683
+ - test/api/clients_interface_test.rb
679
684
  - test/api/containers_interface_test.rb
680
685
  - test/api/instances_interface_test.rb
681
686
  - test/api/network_routers_interface_test.rb
@@ -683,6 +688,7 @@ test_files:
683
688
  - test/cli/access_token_test.rb
684
689
  - test/cli/auth_test.rb
685
690
  - test/cli/cli_test.rb
691
+ - test/cli/clients_test.rb
686
692
  - test/cli/containers_test.rb
687
693
  - test/cli/help_test.rb
688
694
  - test/cli/instances_test.rb