morpheus-cli 3.6.5 → 3.6.6

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
  SHA256:
3
- metadata.gz: e5af54f955b29a018c9dc09a30706f3dff383b42b71f08e92ba63539cf679171
4
- data.tar.gz: f10233595e661594134eb2605bbe3dd48be90458c36441c5bd7afddbabc7093f
3
+ metadata.gz: 6da8f8d23212139cce4d64119553bfa16acfaeecb64eee54d6607f0f3e9e9171
4
+ data.tar.gz: b63b976a649deffd4cfeb86290a3573f60ca838697763b7721020f5bdb0b3f50
5
5
  SHA512:
6
- metadata.gz: 19e02a97f046c115b8080fb6489f07e4973e0dc734dd6986a492816e4abcd805d32ad49008593973acc9fc1346c1416d2cfc93121c96576a8fcb8cdb1b056dc3
7
- data.tar.gz: 69d7ab3ae77e4fccc8ee42f09fc7c16f4f3383801a39acd57c8d661bcc0ea38633ed97a6c81840f761e84d3038aded3e2bd15667c8d9522f129dc39a265e3339
6
+ metadata.gz: 137db6bddd24c7a6521e70e592ef2f8110cd8f14ec65d7c1777af8ff04bffc57fd73216d2416ad2365ac7173f6dd61707069ed0f610a683049f0ade41c1d09ff
7
+ data.tar.gz: 5e8dbd46a7c628ba8c658276c2dd08e28c51573a642888030f0340e36d4a00a5fc18ac34c76ff6d91ca3c0d0374a8c5e1f65d2524db914333fd5b09ed2eb6331
@@ -265,7 +265,7 @@ class Morpheus::Cli::Apps
265
265
  tier_instance_types = tier_instances ? tier_instances.collect {|it| (it['instance'] && it['instance']['type']) ? it['instance']['type'].to_s : 'unknown'}.compact : []
266
266
  unless options[:quiet]
267
267
  # print cyan, "Configuring Tier: #{tier_name} (#{tier_instance_types.empty? ? 'empty' : tier_instance_types.join(', ')})", "\n"
268
- print cyan, "Configuring tier #{tier_name}", "\n"
268
+ print cyan, "Configuring tier #{tier_name}", reset, "\n"
269
269
  end
270
270
  # todo: also prompt for tier settings here, like linkedTiers: []
271
271
  if tier_instances
@@ -280,23 +280,38 @@ class Morpheus::Cli::Apps
280
280
  return 1
281
281
  else
282
282
  unless options[:quiet]
283
- print cyan, "Configuring #{instance_type_code} instance #{tier_name}.#{instance_index}", "\n"
283
+ print cyan, "Configuring #{instance_type_code} instance #{tier_name}.#{instance_index}", reset, "\n"
284
284
  end
285
+
286
+ # Cloud
287
+ cloud_id = nil
288
+ v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'cloud', 'fieldLabel' => 'Cloud', 'type' => 'select', 'selectOptions' => scoped_available_clouds, 'defaultValue' => cloud ? cloud['name'] : nil}], options[:options])
289
+ cloud_id = v_prompt['cloud'] unless v_prompt['cloud'].to_s.empty?
290
+ if cloud_id
291
+ # cloud = find_cloud_by_name_or_id_for_provisioning(group['id'], cloud_id)
292
+ cloud = scoped_available_clouds.find {|it| it['name'] == cloud_id.to_s } || scoped_available_clouds.find {|it| it['id'].to_s == cloud_id.to_s }
293
+ return 1 if cloud.nil?
294
+ else
295
+ # prompt still happens inside get_scoped_instance_config
296
+ end
297
+
298
+
285
299
  # prompt for the cloud for this instance
286
300
  # the cloud is part of finding the scoped config in the blueprint
287
-
288
301
  scoped_instance_config = get_scoped_instance_config(instance_config.clone, payload['environment'], group ? group['name'] : nil, cloud ? cloud['name'] : nil)
302
+
289
303
  # now configure an instance like normal, use the config as default options with :always_prompt
290
304
  instance_prompt_options = {}
291
305
  instance_prompt_options[:group] = group ? group['id'] : nil
292
- instance_prompt_options[:default_cloud] = cloud ? cloud['id'] : nil
306
+ instance_prompt_options[:cloud] = cloud ? cloud['name'] : nil
307
+ instance_prompt_options[:default_cloud] = cloud ? cloud['name'] : nil
293
308
  instance_prompt_options[:no_prompt] = options[:no_prompt]
294
309
  instance_prompt_options[:always_prompt] = options[:no_prompt] != true # options[:always_prompt]
295
310
  instance_prompt_options[:options] = scoped_instance_config # meh, actually need to make these default values instead..
296
311
  instance_prompt_options[:options][:always_prompt] = instance_prompt_options[:no_prompt] != true
297
312
  instance_prompt_options[:options][:no_prompt] = instance_prompt_options[:no_prompt]
298
313
 
299
- # also allow arbritrary options passed as tierName.instanceIndex
314
+ # also allow arbritrary options passed as tierName.instanceIndex like Web.0.instance.layout.id=75
300
315
  instance_extra_options = {}
301
316
  if tier_extra_options && tier_extra_options[instance_index.to_s]
302
317
  instance_extra_options = tier_extra_options[instance_index.to_s]
@@ -1568,18 +1583,20 @@ class Morpheus::Cli::Apps
1568
1583
  # def tmplCfg = getConfigMap(appTemplateConfig?.tiers?.getAt(tierName)?.instances?.getAt(index), opts.environment, opts.group, instanceOpts.instance.cloud?: opts?.defaultCloud?.name)
1569
1584
  def get_scoped_instance_config(instance_config, env_name, group_name, cloud_name)
1570
1585
  config = instance_config.clone
1571
- if env_name && config['environments'] && config['environments'][env_name]
1586
+ if env_name.to_s != '' && config['environments'] && config['environments'][env_name]
1572
1587
  config = config['environments'][env_name].clone
1573
1588
  end
1574
- if group_name && config['groups'] && config['groups'][group_name]
1589
+ if group_name.to_s != '' && config['groups'] && config['groups'][group_name]
1575
1590
  config = config['groups'][group_name].clone
1576
1591
  end
1577
- if cloud_name && config['clouds'] && config['clouds'][cloud_name]
1592
+ if cloud_name.to_s != '' && config['clouds'] && config['clouds'][cloud_name]
1578
1593
  config = config['clouds'][cloud_name].clone
1579
1594
  end
1580
1595
  config.delete('environments')
1581
1596
  config.delete('groups')
1582
1597
  config.delete('clouds')
1598
+ # puts "get_scoped_instance_config(instance_config, #{env_name}, #{group_name}, #{cloud_name})"
1599
+ # puts "returned config: #{config}"
1583
1600
  return config
1584
1601
  end
1585
1602
 
@@ -811,7 +811,9 @@ class Morpheus::Cli::Hosts
811
811
  options = {}
812
812
  optparse = Morpheus::Cli::OptionParser.new do |opts|
813
813
  opts.banner = subcommand_usage("[name]")
814
- build_common_options(opts, options, [:json, :dry_run, :quiet, :remote])
814
+ build_common_options(opts, options, [:auto_confirm, :quiet, :json, :dry_run, :remote])
815
+ opts.footer = "Start a host.\n" +
816
+ "[name] is required. This is the name or id of a host. Supports 1-N [name] arguments."
815
817
  end
816
818
  optparse.parse!(args)
817
819
  if args.count < 1
@@ -842,7 +844,7 @@ class Morpheus::Cli::Hosts
842
844
  elsif !options[:quiet]
843
845
  print_green_success "Started #{objects_label}"
844
846
  end
845
- return
847
+ return 0
846
848
  rescue RestClient::Exception => e
847
849
  print_rest_exception(e, options)
848
850
  exit 1
@@ -853,7 +855,9 @@ class Morpheus::Cli::Hosts
853
855
  options = {}
854
856
  optparse = Morpheus::Cli::OptionParser.new do |opts|
855
857
  opts.banner = subcommand_usage("[name]")
856
- build_common_options(opts, options, [:json, :dry_run, :quiet, :remote])
858
+ build_common_options(opts, options, [:auto_confirm, :quiet, :json, :dry_run, :remote])
859
+ opts.footer = "Stop a host.\n" +
860
+ "[name] is required. This is the name or id of a host. Supports 1-N [name] arguments."
857
861
  end
858
862
  optparse.parse!(args)
859
863
  if args.count < 1
@@ -884,7 +888,7 @@ class Morpheus::Cli::Hosts
884
888
  elsif !options[:quiet]
885
889
  print_green_success "Stopped #{objects_label}"
886
890
  end
887
- return
891
+ return 0
888
892
  rescue RestClient::Exception => e
889
893
  print_rest_exception(e, options)
890
894
  exit 1
@@ -1348,7 +1348,7 @@ class Morpheus::Cli::Instances
1348
1348
  opts.add_hidden_option('muteMonitoring') if opts.is_a?(Morpheus::Cli::OptionParser)
1349
1349
  build_common_options(opts, options, [:auto_confirm, :quiet, :json, :dry_run, :remote])
1350
1350
  opts.footer = "Stop an instance.\n" +
1351
- "[name] is required. This is the name or id of an instance. Supports 1-N [instance] arguments."
1351
+ "[instance] is required. This is the name or id of an instance. Supports 1-N [instance] arguments."
1352
1352
  end
1353
1353
  optparse.parse!(args)
1354
1354
  if args.count < 1
@@ -1408,7 +1408,7 @@ class Morpheus::Cli::Instances
1408
1408
  opts.banner = subcommand_usage("[name]")
1409
1409
  build_common_options(opts, options, [:auto_confirm, :quiet, :json, :dry_run, :remote])
1410
1410
  opts.footer = "Start an instance.\n" +
1411
- "[name] is required. This is the name or id of an instance. Supports 1-N [instance] arguments."
1411
+ "[name] is required. This is the name or id of an instance. Supports 1-N [name] arguments."
1412
1412
  end
1413
1413
  optparse.parse!(args)
1414
1414
  if args.count < 1
@@ -1465,16 +1465,16 @@ class Morpheus::Cli::Instances
1465
1465
  options = {}
1466
1466
  optparse = Morpheus::Cli::OptionParser.new do |opts|
1467
1467
  opts.banner = subcommand_usage("[name]")
1468
- opts.on('--mute-monitoring [on|off]', String, "Mute monitoring. Default is off.") do |val|
1468
+ opts.on('--mute-monitoring [on|off]', String, "Mute monitoring. Default is on.") do |val|
1469
1469
  params['muteMonitoring'] = val.nil? || val.to_s == 'on' || val.to_s == 'true'
1470
1470
  end
1471
- opts.on('--muteMonitoring [on|off]', String, "Mute monitoring. Default is off.") do |val|
1471
+ opts.on('--muteMonitoring [on|off]', String, "Mute monitoring. Default is on.") do |val|
1472
1472
  params['muteMonitoring'] = val.nil? || val.to_s == 'on' || val.to_s == 'true'
1473
1473
  end
1474
1474
  opts.add_hidden_option('muteMonitoring') if opts.is_a?(Morpheus::Cli::OptionParser)
1475
1475
  build_common_options(opts, options, [:auto_confirm, :quiet, :json, :dry_run, :remote])
1476
- opts.footer = "Start an instance.\n" +
1477
- "[name] is required. This is the name or id of an instance. Supports 1-N [instance] arguments."
1476
+ opts.footer = "Restart an instance.\n" +
1477
+ "[name] is required. This is the name or id of an instance. Supports 1-N [name] arguments."
1478
1478
  end
1479
1479
  optparse.parse!(args)
1480
1480
  if args.count < 1
@@ -1535,6 +1535,8 @@ class Morpheus::Cli::Instances
1535
1535
  params['muteMonitoring'] = val.nil? || val.to_s == 'on' || val.to_s == 'true'
1536
1536
  end
1537
1537
  build_common_options(opts, options, [:auto_confirm, :quiet, :json, :dry_run, :remote])
1538
+ opts.footer = "Suspend an instance.\n" +
1539
+ "[name] is required. This is the name or id of an instance. Supports 1-N [name] arguments."
1538
1540
  end
1539
1541
  optparse.parse!(args)
1540
1542
  if args.count < 1
@@ -1581,6 +1583,8 @@ class Morpheus::Cli::Instances
1581
1583
  optparse = Morpheus::Cli::OptionParser.new do |opts|
1582
1584
  opts.banner = subcommand_usage("[name]")
1583
1585
  build_common_options(opts, options, [:auto_confirm, :quiet, :json, :dry_run, :remote])
1586
+ opts.footer = "Eject an instance.\n" +
1587
+ "[name] is required. This is the name or id of an instance. Supports 1-N [name] arguments."
1584
1588
  end
1585
1589
  optparse.parse!(args)
1586
1590
  if args.count < 1
@@ -1634,7 +1638,7 @@ class Morpheus::Cli::Instances
1634
1638
  opts.add_hidden_option('muteMonitoring') if opts.is_a?(Morpheus::Cli::OptionParser)
1635
1639
  build_common_options(opts, options, [:auto_confirm, :quiet, :json, :dry_run, :remote])
1636
1640
  opts.footer = "Stop service on an instance.\n" +
1637
- "[name] is required. This is the name or id of an instance. Supports 1-N [instance] arguments."
1641
+ "[name] is required. This is the name or id of an instance. Supports 1-N [name] arguments."
1638
1642
  end
1639
1643
  optparse.parse!(args)
1640
1644
  if args.count < 1
@@ -1694,7 +1698,7 @@ class Morpheus::Cli::Instances
1694
1698
  opts.banner = subcommand_usage("[name]")
1695
1699
  build_common_options(opts, options, [:auto_confirm, :quiet, :json, :dry_run, :remote])
1696
1700
  opts.footer = "Start service on an instance.\n" +
1697
- "[name] is required. This is the name or id of an instance. Supports 1-N [instance] arguments."
1701
+ "[name] is required. This is the name or id of an instance. Supports 1-N [name] arguments."
1698
1702
  end
1699
1703
  optparse.parse!(args)
1700
1704
  if args.count < 1
@@ -1751,16 +1755,16 @@ class Morpheus::Cli::Instances
1751
1755
  options = {}
1752
1756
  optparse = Morpheus::Cli::OptionParser.new do |opts|
1753
1757
  opts.banner = subcommand_usage("[name]")
1754
- opts.on('--mute-monitoring [on|off]', String, "Mute monitoring. Default is off.") do |val|
1758
+ opts.on('--mute-monitoring [on|off]', String, "Mute monitoring. Default is on.") do |val|
1755
1759
  params['muteMonitoring'] = val.nil? || val.to_s == 'on' || val.to_s == 'true'
1756
1760
  end
1757
- opts.on('--muteMonitoring [on|off]', String, "Mute monitoring. Default is off.") do |val|
1761
+ opts.on('--muteMonitoring [on|off]', String, "Mute monitoring. Default is on.") do |val|
1758
1762
  params['muteMonitoring'] = val.nil? || val.to_s == 'on' || val.to_s == 'true'
1759
1763
  end
1760
1764
  opts.add_hidden_option('muteMonitoring') if opts.is_a?(Morpheus::Cli::OptionParser)
1761
1765
  build_common_options(opts, options, [:auto_confirm, :quiet, :json, :dry_run, :remote])
1762
1766
  opts.footer = "Restart service on an instance.\n" +
1763
- "[name] is required. This is the name or id of an instance. Supports 1-N [instance] arguments."
1767
+ "[name] is required. This is the name or id of an instance. Supports 1-N [name] arguments."
1764
1768
  end
1765
1769
  optparse.parse!(args)
1766
1770
  if args.count < 1
@@ -258,6 +258,8 @@ module Morpheus::Cli::ProvisioningHelper
258
258
  instance_name = nil
259
259
  if options[:instance_name]
260
260
  options[:options]['name'] = options[:instance_name]
261
+ elsif options[:options]['instance'] && options[:options]['instance']['name']
262
+ options[:options]['name'] = options[:options]['instance']['name']
261
263
  end
262
264
  name_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'name', 'fieldLabel' => 'Instance Name', 'type' => 'text', 'required' => options[:name_required]}], options[:options])
263
265
  instance_name = name_prompt['name']
@@ -1,6 +1,6 @@
1
1
 
2
2
  module Morpheus
3
3
  module Cli
4
- VERSION = "3.6.5"
4
+ VERSION = "3.6.6"
5
5
  end
6
6
  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: 3.6.5
4
+ version: 3.6.6
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: 2019-02-11 00:00:00.000000000 Z
14
+ date: 2019-02-12 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler