morpheus-cli 8.0.11 → 8.0.12

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.
@@ -555,7 +555,7 @@ EOT
555
555
  end
556
556
 
557
557
  def _get(id, params, options)
558
- if id !~ /\A\d{1,}\Z/ && rest_has_name
558
+ if id.to_s !~ /\A\d{1,}\Z/ && rest_has_name
559
559
  record = rest_find_by_name_or_id(id)
560
560
  if record.nil?
561
561
  return 1, "#{rest_label} not found for '#{id}'"
@@ -952,7 +952,7 @@ EOT
952
952
  end
953
953
 
954
954
  def _get_type(id, params, options)
955
- if id !~ /\A\d{1,}\Z/ # && rest_type_has_name
955
+ if id.to_s !~ /\A\d{1,}\Z/ # && rest_type_has_name
956
956
  record = rest_type_find_by_name_or_id(id)
957
957
  if record.nil?
958
958
  return 1, "#{rest_type_label} not found for '#{id}'"
@@ -24,6 +24,7 @@ module Morpheus
24
24
  # should use Readline.readline to probably
25
25
  Readline.completion_append_character = ""
26
26
  Readline.basic_word_break_characters = ''
27
+ Readline.completer_word_break_characters = '' rescue nil
27
28
  Readline.completion_proc = nil
28
29
  if default_value.nil?
29
30
  confirm_prompt = "#{message} (yes/no): "
@@ -723,10 +724,11 @@ module Morpheus
723
724
  end
724
725
  end
725
726
  # default to the first option
726
- if !value_found && default_value.nil? && option_type['defaultFirstOption'] && select_options && select_options[0]
727
- # default_value = select_options[0][value_field]
727
+ first_option = select_options ? select_options.find {|opt| opt['isGroup'] != true } : nil
728
+ if !value_found && default_value.nil? && option_type['defaultFirstOption'] && first_option
729
+ # default_value = first_option[value_field]
728
730
  # nicer to display name instead, it will match and replace with value
729
- default_value = select_options[0]['name'] ? select_options[0]['name'] : select_options[0][value_field]
731
+ default_value = first_option['name'] ? first_option['name'] : first_option[value_field]
730
732
  end
731
733
 
732
734
  if no_prompt
@@ -804,6 +806,7 @@ module Morpheus
804
806
  #Readline.input = $stdin
805
807
  Readline.completion_append_character = ""
806
808
  Readline.basic_word_break_characters = ''
809
+ Readline.completer_word_break_characters = '' rescue nil
807
810
  Readline.completion_proc = proc {|s|
808
811
  matches = []
809
812
  available_options = (select_options || [])
@@ -901,6 +904,7 @@ module Morpheus
901
904
  #Readline.input = $stdin
902
905
  Readline.completion_append_character = ""
903
906
  Readline.basic_word_break_characters = ''
907
+ Readline.completer_word_break_characters = '' rescue nil
904
908
  Readline.completion_proc = proc {|s|
905
909
  matches = []
906
910
  available_options = (select_options || [])
@@ -975,6 +979,7 @@ module Morpheus
975
979
  query_value = (input || '')
976
980
  api_params ||= {}
977
981
  api_params['query'] = query_value
982
+ api_params['phrase'] = query_value
978
983
  # skip refresh if you just hit enter
979
984
  if !query_value.empty? || (select_options.nil? || select_options.empty?)
980
985
  select_options = load_options(option_type, api_client, api_params, query_value)
@@ -1120,6 +1125,7 @@ module Morpheus
1120
1125
  # input = $stdin.gets.chomp!
1121
1126
  Readline.completion_append_character = ""
1122
1127
  Readline.basic_word_break_characters = ''
1128
+ Readline.completer_word_break_characters = '' rescue nil
1123
1129
  Readline.completion_proc = nil
1124
1130
  prompt_label = "#{option_type['fieldLabel']}#{option_type['fieldAddOn'] ? (' (' + option_type['fieldAddOn'] + ') ') : '' }#{!option_type['required'] ? ' (optional)' : ''}#{!option_type['defaultValue'].to_s.empty? ? ' ['+option_type['defaultValue'].to_s+']' : ''}: "
1125
1131
  input = Readline.readline(prompt_label, false).to_s
@@ -1186,6 +1192,7 @@ module Morpheus
1186
1192
  else
1187
1193
  Readline.completion_append_character = ""
1188
1194
  Readline.basic_word_break_characters = ''
1195
+ Readline.completer_word_break_characters = '' rescue nil
1189
1196
  Readline.completion_proc = nil
1190
1197
  # needs to work like $stdin.noecho
1191
1198
  Readline.pre_input_hook = lambda {
@@ -1221,6 +1228,7 @@ module Morpheus
1221
1228
  #Readline.input = $stdin
1222
1229
  Readline.completion_append_character = ""
1223
1230
  Readline.basic_word_break_characters = ''
1231
+ Readline.completer_word_break_characters = '' rescue nil
1224
1232
  Readline.completion_proc = proc {|s|
1225
1233
  # FILENAME_COMPLETION_PROC is nil in newer rubies
1226
1234
  Readline::FILENAME_COMPLETION_PROC.call(s) rescue []
@@ -1,6 +1,6 @@
1
1
 
2
2
  module Morpheus
3
3
  module Cli
4
- VERSION = "8.0.11"
4
+ VERSION = "8.0.12"
5
5
  end
6
6
  end
@@ -127,7 +127,8 @@ module Morpheus::Routes
127
127
  buckets: {},
128
128
  },
129
129
  :'image-builder' => {},
130
- :vdi => {}
130
+ :migrations => {},
131
+ :vdi => {},
131
132
  },
132
133
  admin: {
133
134
  accounts: {}, # Tenants
@@ -356,30 +356,6 @@ module Morpheus
356
356
  @angry_prompt ||= Morpheus::Terminal.angry_prompt
357
357
  end
358
358
 
359
- # def gets
360
- # Readline.completion_append_character = " "
361
- # Readline.completion_proc = @auto_complete
362
- # Readline.basic_word_break_characters = ""
363
- # #Readline.basic_word_break_characters = "\t\n\"\‘`@$><=;|&{( "
364
- # input = Readline.readline("#{@prompt}", true).to_s
365
- # input = input.strip
366
- # execute(input)
367
- # end
368
-
369
- # def puts(*cmds)
370
- # cmds.each do |cmd|
371
- # self.execute(cmd) # exec
372
- # end
373
- # end
374
-
375
- # def gets(*args)
376
- # $stdin.gets(*args)
377
- # end
378
-
379
- def readline(*args)
380
- # todo: one prompt to rule them all
381
- end
382
-
383
359
  # protected
384
360
 
385
361
  def execute(input)
@@ -0,0 +1,39 @@
1
+ require 'morpheus_test'
2
+
3
+ class MorpheusTest::MigrationsTest < MorpheusTest::TestCase
4
+
5
+ def test_migrations_list
6
+ assert_execute %(migrations list)
7
+ assert_execute %(migrations list "apitest")
8
+ end
9
+
10
+ def test_migrations_get
11
+ # migration = client.migrations.list({})['migrations'][0]
12
+ migration = client.migrations.list({})['migrations'].find {|r| r['authority'] !~ /\A\d+\Z/}
13
+ if migration
14
+ assert_execute %(migrations get "#{migration['id']}")
15
+ # beware that duplicates may exist
16
+ name_arg = migration['name']
17
+ assert_execute %(migrations get "#{escape_arg name_arg}")
18
+ else
19
+ puts "No migration found, unable to execute test `#{__method__}`"
20
+ end
21
+ end
22
+
23
+
24
+ # todo: test all the other commands
25
+
26
+ # def test_migrations_add
27
+ # assert_execute %(migrations add "test_migration_#{random_id}" -N)
28
+ # end
29
+
30
+ # def test_migrations_update
31
+ # #skip "Test needs to be added"
32
+ # assert_execute %(migrations update "test_migration_#{random_id}" --description "neat")
33
+ # end
34
+
35
+ # def test_migrations_remove
36
+ # assert_execute %(migrations remove "test_migration_#{random_id}" -y")
37
+ # end
38
+
39
+ 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.11
4
+ version: 8.0.12
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-11-19 00:00:00.000000000 Z
14
+ date: 2025-12-25 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: tins
@@ -317,6 +317,7 @@ files:
317
317
  - lib/morpheus/api/load_balancers_interface.rb
318
318
  - lib/morpheus/api/log_settings_interface.rb
319
319
  - lib/morpheus/api/logs_interface.rb
320
+ - lib/morpheus/api/migrations_interface.rb
320
321
  - lib/morpheus/api/monitoring_alerts_interface.rb
321
322
  - lib/morpheus/api/monitoring_apps_interface.rb
322
323
  - lib/morpheus/api/monitoring_checks_interface.rb
@@ -445,6 +446,7 @@ files:
445
446
  - lib/morpheus/cli/commands/cloud_resource_pools_command.rb
446
447
  - lib/morpheus/cli/commands/clouds.rb
447
448
  - lib/morpheus/cli/commands/clouds_types.rb
449
+ - lib/morpheus/cli/commands/cluster_types.rb
448
450
  - lib/morpheus/cli/commands/clusters.rb
449
451
  - lib/morpheus/cli/commands/coloring_command.rb
450
452
  - lib/morpheus/cli/commands/containers_command.rb
@@ -509,6 +511,7 @@ files:
509
511
  - lib/morpheus/cli/commands/logout.rb
510
512
  - lib/morpheus/cli/commands/logs_command.rb
511
513
  - lib/morpheus/cli/commands/man_command.rb
514
+ - lib/morpheus/cli/commands/migrations.rb
512
515
  - lib/morpheus/cli/commands/monitoring_alerts_command.rb
513
516
  - lib/morpheus/cli/commands/monitoring_apps_command.rb
514
517
  - lib/morpheus/cli/commands/monitoring_checks_command.rb
@@ -659,6 +662,7 @@ files:
659
662
  - test/cli/help_test.rb
660
663
  - test/cli/instances_test.rb
661
664
  - test/cli/man_test.rb
665
+ - test/cli/migrations_test.rb
662
666
  - test/cli/network_routers_test.rb
663
667
  - test/cli/remote_test.rb
664
668
  - test/cli/roles_test.rb
@@ -707,6 +711,7 @@ test_files:
707
711
  - test/cli/help_test.rb
708
712
  - test/cli/instances_test.rb
709
713
  - test/cli/man_test.rb
714
+ - test/cli/migrations_test.rb
710
715
  - test/cli/network_routers_test.rb
711
716
  - test/cli/remote_test.rb
712
717
  - test/cli/roles_test.rb