morpheus-cli 3.6.28 → 3.6.29
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/morpheus/api/api_client.rb +16 -0
- data/lib/morpheus/api/cloud_folders_interface.rb +47 -0
- data/lib/morpheus/api/cloud_resource_pools_interface.rb +47 -0
- data/lib/morpheus/api/network_types_interface.rb +26 -0
- data/lib/morpheus/api/reports_interface.rb +77 -0
- data/lib/morpheus/api/security_group_rules_interface.rb +6 -0
- data/lib/morpheus/api/security_groups_interface.rb +21 -15
- data/lib/morpheus/cli.rb +3 -0
- data/lib/morpheus/cli/accounts.rb +1 -1
- data/lib/morpheus/cli/apps.rb +2 -2
- data/lib/morpheus/cli/archives_command.rb +18 -18
- data/lib/morpheus/cli/blueprints_command.rb +1 -1
- data/lib/morpheus/cli/boot_scripts_command.rb +6 -6
- data/lib/morpheus/cli/cli_command.rb +4 -0
- data/lib/morpheus/cli/cloud_datastores_command.rb +58 -20
- data/lib/morpheus/cli/cloud_folders_command.rb +463 -0
- data/lib/morpheus/cli/cloud_resource_pools_command.rb +707 -0
- data/lib/morpheus/cli/clouds.rb +2 -0
- data/lib/morpheus/cli/hosts.rb +33 -8
- data/lib/morpheus/cli/instances.rb +79 -54
- data/lib/morpheus/cli/library_option_lists_command.rb +1 -1
- data/lib/morpheus/cli/library_option_types_command.rb +1 -1
- data/lib/morpheus/cli/mixins/provisioning_helper.rb +11 -2
- data/lib/morpheus/cli/monitoring_contacts_command.rb +1 -1
- data/lib/morpheus/cli/monitoring_incidents_command.rb +1 -1
- data/lib/morpheus/cli/network_services_command.rb +7 -3
- data/lib/morpheus/cli/networks_command.rb +164 -63
- data/lib/morpheus/cli/option_types.rb +16 -15
- data/lib/morpheus/cli/policies_command.rb +76 -9
- data/lib/morpheus/cli/preseed_scripts_command.rb +2 -2
- data/lib/morpheus/cli/remote.rb +26 -28
- data/lib/morpheus/cli/reports_command.rb +594 -0
- data/lib/morpheus/cli/security_group_rules.rb +5 -1
- data/lib/morpheus/cli/security_groups.rb +882 -45
- data/lib/morpheus/cli/tasks.rb +158 -23
- data/lib/morpheus/cli/tenants_command.rb +1 -1
- data/lib/morpheus/cli/users.rb +1 -1
- data/lib/morpheus/cli/version.rb +1 -1
- metadata +9 -2
data/lib/morpheus/cli/clouds.rb
CHANGED
@@ -201,6 +201,8 @@ class Morpheus::Cli::Clouds
|
|
201
201
|
"Location" => 'location',
|
202
202
|
"Visibility" => lambda {|it| it['visibility'].to_s.capitalize },
|
203
203
|
"Groups" => lambda {|it| it['groups'].collect {|g| g.instance_of?(Hash) ? g['name'] : g.to_s }.join(', ') },
|
204
|
+
#"Owner" => lambda {|it| it['owner'].instance_of?(Hash) ? it['owner']['name'] : it['ownerId'] },
|
205
|
+
"Tenant" => lambda {|it| it['account'].instance_of?(Hash) ? it['account']['name'] : it['accountId'] },
|
204
206
|
"Enabled" => lambda {|it| format_boolean(it['enabled']) },
|
205
207
|
"Status" => lambda {|it| format_cloud_status(it) }
|
206
208
|
}
|
data/lib/morpheus/cli/hosts.rb
CHANGED
@@ -804,7 +804,7 @@ class Morpheus::Cli::Hosts
|
|
804
804
|
end
|
805
805
|
else
|
806
806
|
if params.empty?
|
807
|
-
print_red_alert "Specify
|
807
|
+
print_red_alert "Specify at least one option to update"
|
808
808
|
puts optparse
|
809
809
|
return 1
|
810
810
|
end
|
@@ -1173,7 +1173,7 @@ class Morpheus::Cli::Hosts
|
|
1173
1173
|
|
1174
1174
|
host = find_host_by_name_or_id(args[0])
|
1175
1175
|
return 1 if host.nil?
|
1176
|
-
workflow =
|
1176
|
+
workflow = find_workflow_by_name_or_id(args[1])
|
1177
1177
|
return 1 if workflow.nil?
|
1178
1178
|
|
1179
1179
|
# support -O options as arbitrary params
|
@@ -1485,16 +1485,41 @@ class Morpheus::Cli::Hosts
|
|
1485
1485
|
return cloud_type
|
1486
1486
|
end
|
1487
1487
|
|
1488
|
-
def
|
1489
|
-
|
1490
|
-
|
1491
|
-
return task_set_results['taskSets'][0]
|
1488
|
+
def find_workflow_by_name_or_id(val)
|
1489
|
+
if val.to_s =~ /\A\d{1,}\Z/
|
1490
|
+
return find_workflow_by_id(val)
|
1492
1491
|
else
|
1493
|
-
|
1494
|
-
|
1492
|
+
return find_workflow_by_name(val)
|
1493
|
+
end
|
1494
|
+
end
|
1495
|
+
|
1496
|
+
def find_workflow_by_id(id)
|
1497
|
+
begin
|
1498
|
+
json_response = @task_sets_interface.get(id.to_i)
|
1499
|
+
return json_response['taskSet']
|
1500
|
+
rescue RestClient::Exception => e
|
1501
|
+
if e.response && e.response.code == 404
|
1502
|
+
print_red_alert "Workflow not found by id #{id}"
|
1503
|
+
else
|
1504
|
+
raise e
|
1505
|
+
end
|
1495
1506
|
end
|
1496
1507
|
end
|
1497
1508
|
|
1509
|
+
def find_workflow_by_name(name)
|
1510
|
+
workflows = @task_sets_interface.get({name: name.to_s})['taskSets']
|
1511
|
+
if workflows.empty?
|
1512
|
+
print_red_alert "Workflow not found by name #{name}"
|
1513
|
+
return nil
|
1514
|
+
elsif workflows.size > 1
|
1515
|
+
print_red_alert "#{workflows.size} workflows by name #{name}"
|
1516
|
+
print_workflows_table(workflows, {color: red})
|
1517
|
+
print reset,"\n\n"
|
1518
|
+
return nil
|
1519
|
+
else
|
1520
|
+
return workflows[0]
|
1521
|
+
end
|
1522
|
+
end
|
1498
1523
|
|
1499
1524
|
def format_server_power_state(server, return_color=cyan)
|
1500
1525
|
out = ""
|
@@ -427,11 +427,11 @@ class Morpheus::Cli::Instances
|
|
427
427
|
end
|
428
428
|
|
429
429
|
def update(args)
|
430
|
-
usage = "Usage: morpheus instances update [
|
430
|
+
usage = "Usage: morpheus instances update [instance] [options]"
|
431
431
|
options = {}
|
432
432
|
params = {}
|
433
433
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
434
|
-
opts.banner = subcommand_usage("[
|
434
|
+
opts.banner = subcommand_usage("[instance]")
|
435
435
|
opts.on('--name VALUE', String, "Name") do |val|
|
436
436
|
params['displayName'] = val
|
437
437
|
end
|
@@ -508,7 +508,7 @@ class Morpheus::Cli::Instances
|
|
508
508
|
end
|
509
509
|
else
|
510
510
|
if params.empty?
|
511
|
-
print_red_alert "Specify
|
511
|
+
print_red_alert "Specify at least one option to update"
|
512
512
|
puts optparse
|
513
513
|
exit 1
|
514
514
|
end
|
@@ -537,11 +537,11 @@ class Morpheus::Cli::Instances
|
|
537
537
|
end
|
538
538
|
|
539
539
|
def update_notes(args)
|
540
|
-
usage = "Usage: morpheus instances update-notes [
|
540
|
+
usage = "Usage: morpheus instances update-notes [instance] [options]"
|
541
541
|
options = {}
|
542
542
|
params = {}
|
543
543
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
544
|
-
opts.banner = subcommand_usage("[
|
544
|
+
opts.banner = subcommand_usage("[instance]")
|
545
545
|
opts.on('--notes VALUE', String, "Notes content (Markdown)") do |val|
|
546
546
|
params['notes'] = val
|
547
547
|
end
|
@@ -616,7 +616,7 @@ class Morpheus::Cli::Instances
|
|
616
616
|
out = ""
|
617
617
|
options = {}
|
618
618
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
619
|
-
opts.banner = subcommand_usage("[
|
619
|
+
opts.banner = subcommand_usage("[instance]")
|
620
620
|
build_common_options(opts, options, [:quiet, :json, :remote]) # no :dry_run, just do it man
|
621
621
|
end
|
622
622
|
optparse.parse!(args)
|
@@ -648,7 +648,7 @@ class Morpheus::Cli::Instances
|
|
648
648
|
def stats(args)
|
649
649
|
options = {}
|
650
650
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
651
|
-
opts.banner = subcommand_usage("[
|
651
|
+
opts.banner = subcommand_usage("[instance]")
|
652
652
|
build_common_options(opts, options, [:json, :yaml, :csv, :fields, :dry_run, :remote])
|
653
653
|
end
|
654
654
|
optparse.parse!(args)
|
@@ -699,7 +699,7 @@ class Morpheus::Cli::Instances
|
|
699
699
|
def console(args)
|
700
700
|
options = {}
|
701
701
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
702
|
-
opts.banner = subcommand_usage("[
|
702
|
+
opts.banner = subcommand_usage("[instance]")
|
703
703
|
opts.on( '-n', '--node NODE_ID', "Scope console to specific Container or VM" ) do |node_id|
|
704
704
|
options[:node_id] = node_id.to_i
|
705
705
|
end
|
@@ -736,7 +736,7 @@ class Morpheus::Cli::Instances
|
|
736
736
|
def logs(args)
|
737
737
|
options = {}
|
738
738
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
739
|
-
opts.banner = subcommand_usage("[
|
739
|
+
opts.banner = subcommand_usage("[instance]")
|
740
740
|
opts.on( '-n', '--node NODE_ID', "Scope logs to specific Container or VM" ) do |node_id|
|
741
741
|
options[:node_id] = node_id.to_i
|
742
742
|
end
|
@@ -864,7 +864,7 @@ class Morpheus::Cli::Instances
|
|
864
864
|
end
|
865
865
|
return
|
866
866
|
end
|
867
|
-
instance = find_instance_by_name_or_id(arg)
|
867
|
+
instance = find_instance_by_name_or_id(arg =~ /\A\d{1,}\Z/ ? arg.to_i : arg)
|
868
868
|
@instances_interface.setopts(options)
|
869
869
|
json_response = @instances_interface.get(instance['id'])
|
870
870
|
if options[:quiet]
|
@@ -1059,7 +1059,7 @@ class Morpheus::Cli::Instances
|
|
1059
1059
|
def list_containers(args)
|
1060
1060
|
options = {}
|
1061
1061
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
1062
|
-
opts.banner = subcommand_usage("[
|
1062
|
+
opts.banner = subcommand_usage("[instance]")
|
1063
1063
|
build_common_options(opts, options, [:json, :yaml, :csv, :fields, :dry_run, :remote])
|
1064
1064
|
end
|
1065
1065
|
optparse.parse!(args)
|
@@ -1152,7 +1152,7 @@ class Morpheus::Cli::Instances
|
|
1152
1152
|
def backups(args)
|
1153
1153
|
options = {}
|
1154
1154
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
1155
|
-
opts.banner = subcommand_usage("[
|
1155
|
+
opts.banner = subcommand_usage("[instance]")
|
1156
1156
|
build_common_options(opts, options, [:json, :dry_run, :remote])
|
1157
1157
|
end
|
1158
1158
|
optparse.parse!(args)
|
@@ -1245,7 +1245,7 @@ class Morpheus::Cli::Instances
|
|
1245
1245
|
def clone(args)
|
1246
1246
|
options = {}
|
1247
1247
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
1248
|
-
opts.banner = subcommand_usage("[
|
1248
|
+
opts.banner = subcommand_usage("[instance] -g GROUP")
|
1249
1249
|
build_option_type_options(opts, options, clone_instance_option_types(false))
|
1250
1250
|
opts.on( '-g', '--group GROUP', "Group Name or ID for the new instance" ) do |val|
|
1251
1251
|
options[:group] = val
|
@@ -1312,7 +1312,7 @@ class Morpheus::Cli::Instances
|
|
1312
1312
|
def envs(args)
|
1313
1313
|
options = {}
|
1314
1314
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
1315
|
-
opts.banner = subcommand_usage("[
|
1315
|
+
opts.banner = subcommand_usage("[instance]")
|
1316
1316
|
build_common_options(opts, options, [:json, :dry_run, :remote])
|
1317
1317
|
end
|
1318
1318
|
optparse.parse!(args)
|
@@ -1353,7 +1353,7 @@ class Morpheus::Cli::Instances
|
|
1353
1353
|
options = {}
|
1354
1354
|
|
1355
1355
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
1356
|
-
opts.banner = subcommand_usage("[
|
1356
|
+
opts.banner = subcommand_usage("[instance] VAR VALUE [-e]")
|
1357
1357
|
opts.on( '-e', "Exportable" ) do |exportable|
|
1358
1358
|
options[:export] = exportable
|
1359
1359
|
end
|
@@ -1394,7 +1394,7 @@ class Morpheus::Cli::Instances
|
|
1394
1394
|
def delenv(args)
|
1395
1395
|
options = {}
|
1396
1396
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
1397
|
-
opts.banner = subcommand_usage("[
|
1397
|
+
opts.banner = subcommand_usage("[instance] VAR")
|
1398
1398
|
build_common_options(opts, options, [:json, :dry_run, :remote])
|
1399
1399
|
end
|
1400
1400
|
optparse.parse!(args)
|
@@ -1428,7 +1428,7 @@ class Morpheus::Cli::Instances
|
|
1428
1428
|
params = {'server' => true, 'muteMonitoring' => false}
|
1429
1429
|
options = {}
|
1430
1430
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
1431
|
-
opts.banner = subcommand_usage("[
|
1431
|
+
opts.banner = subcommand_usage("[instance]")
|
1432
1432
|
opts.on('--mute-monitoring [on|off]', String, "Mute monitoring. Default is off.") do |val|
|
1433
1433
|
params['muteMonitoring'] = val.nil? || val.to_s == 'on' || val.to_s == 'true'
|
1434
1434
|
end
|
@@ -1496,10 +1496,10 @@ class Morpheus::Cli::Instances
|
|
1496
1496
|
params = {'server' => true}
|
1497
1497
|
options = {}
|
1498
1498
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
1499
|
-
opts.banner = subcommand_usage("[
|
1499
|
+
opts.banner = subcommand_usage("[instance]")
|
1500
1500
|
build_common_options(opts, options, [:auto_confirm, :quiet, :json, :dry_run, :remote])
|
1501
1501
|
opts.footer = "Start an instance.\n" +
|
1502
|
-
"[
|
1502
|
+
"[instance] is required. This is the name or id of an instance. Supports 1-N [instance] arguments."
|
1503
1503
|
end
|
1504
1504
|
optparse.parse!(args)
|
1505
1505
|
if args.count < 1
|
@@ -1556,7 +1556,7 @@ class Morpheus::Cli::Instances
|
|
1556
1556
|
params = {'server' => true, 'muteMonitoring' => true}
|
1557
1557
|
options = {}
|
1558
1558
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
1559
|
-
opts.banner = subcommand_usage("[
|
1559
|
+
opts.banner = subcommand_usage("[instance]")
|
1560
1560
|
opts.on('--mute-monitoring [on|off]', String, "Mute monitoring. Default is on.") do |val|
|
1561
1561
|
params['muteMonitoring'] = val.nil? || val.to_s == 'on' || val.to_s == 'true'
|
1562
1562
|
end
|
@@ -1566,7 +1566,7 @@ class Morpheus::Cli::Instances
|
|
1566
1566
|
opts.add_hidden_option('muteMonitoring') if opts.is_a?(Morpheus::Cli::OptionParser)
|
1567
1567
|
build_common_options(opts, options, [:auto_confirm, :quiet, :json, :dry_run, :remote])
|
1568
1568
|
opts.footer = "Restart an instance.\n" +
|
1569
|
-
"[
|
1569
|
+
"[instance] is required. This is the name or id of an instance. Supports 1-N [instance] arguments."
|
1570
1570
|
end
|
1571
1571
|
optparse.parse!(args)
|
1572
1572
|
if args.count < 1
|
@@ -1623,13 +1623,13 @@ class Morpheus::Cli::Instances
|
|
1623
1623
|
params = {'server' => true, 'muteMonitoring' => false}
|
1624
1624
|
options = {}
|
1625
1625
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
1626
|
-
opts.banner = subcommand_usage("[
|
1626
|
+
opts.banner = subcommand_usage("[instance]")
|
1627
1627
|
opts.on('--muteMonitoring [on|off]', String, "Mute monitoring. Default is off.") do |val|
|
1628
1628
|
params['muteMonitoring'] = val.nil? || val.to_s == 'on' || val.to_s == 'true'
|
1629
1629
|
end
|
1630
1630
|
build_common_options(opts, options, [:auto_confirm, :quiet, :json, :dry_run, :remote])
|
1631
1631
|
opts.footer = "Suspend an instance.\n" +
|
1632
|
-
"[
|
1632
|
+
"[instance] is required. This is the name or id of an instance. Supports 1-N [instance] arguments."
|
1633
1633
|
end
|
1634
1634
|
optparse.parse!(args)
|
1635
1635
|
if args.count < 1
|
@@ -1674,10 +1674,10 @@ class Morpheus::Cli::Instances
|
|
1674
1674
|
params = {'server' => true}
|
1675
1675
|
options = {}
|
1676
1676
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
1677
|
-
opts.banner = subcommand_usage("[
|
1677
|
+
opts.banner = subcommand_usage("[instance]")
|
1678
1678
|
build_common_options(opts, options, [:auto_confirm, :quiet, :json, :dry_run, :remote])
|
1679
1679
|
opts.footer = "Eject an instance.\n" +
|
1680
|
-
"[
|
1680
|
+
"[instance] is required. This is the name or id of an instance. Supports 1-N [instance] arguments."
|
1681
1681
|
end
|
1682
1682
|
optparse.parse!(args)
|
1683
1683
|
if args.count < 1
|
@@ -1722,7 +1722,7 @@ class Morpheus::Cli::Instances
|
|
1722
1722
|
params = {'server' => false, 'muteMonitoring' => false}
|
1723
1723
|
options = {}
|
1724
1724
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
1725
|
-
opts.banner = subcommand_usage("[
|
1725
|
+
opts.banner = subcommand_usage("[instance]")
|
1726
1726
|
opts.on('--mute-monitoring [on|off]', String, "Mute monitoring. Default is off.") do |val|
|
1727
1727
|
params['muteMonitoring'] = val.nil? || val.to_s == 'on' || val.to_s == 'true'
|
1728
1728
|
end
|
@@ -1732,7 +1732,7 @@ class Morpheus::Cli::Instances
|
|
1732
1732
|
opts.add_hidden_option('muteMonitoring') if opts.is_a?(Morpheus::Cli::OptionParser)
|
1733
1733
|
build_common_options(opts, options, [:auto_confirm, :quiet, :json, :dry_run, :remote])
|
1734
1734
|
opts.footer = "Stop service on an instance.\n" +
|
1735
|
-
"[
|
1735
|
+
"[instance] is required. This is the name or id of an instance. Supports 1-N [instance] arguments."
|
1736
1736
|
end
|
1737
1737
|
optparse.parse!(args)
|
1738
1738
|
if args.count < 1
|
@@ -1790,10 +1790,10 @@ class Morpheus::Cli::Instances
|
|
1790
1790
|
params = {'server' => true} # server is true eh? so start-service is the same as start
|
1791
1791
|
options = {}
|
1792
1792
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
1793
|
-
opts.banner = subcommand_usage("[
|
1793
|
+
opts.banner = subcommand_usage("[instance]")
|
1794
1794
|
build_common_options(opts, options, [:auto_confirm, :quiet, :json, :dry_run, :remote])
|
1795
1795
|
opts.footer = "Start service on an instance.\n" +
|
1796
|
-
"[
|
1796
|
+
"[instance] is required. This is the name or id of an instance. Supports 1-N [instance] arguments."
|
1797
1797
|
end
|
1798
1798
|
optparse.parse!(args)
|
1799
1799
|
if args.count < 1
|
@@ -1850,7 +1850,7 @@ class Morpheus::Cli::Instances
|
|
1850
1850
|
params = {'server' => false, 'muteMonitoring' => true}
|
1851
1851
|
options = {}
|
1852
1852
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
1853
|
-
opts.banner = subcommand_usage("[
|
1853
|
+
opts.banner = subcommand_usage("[instance]")
|
1854
1854
|
opts.on('--mute-monitoring [on|off]', String, "Mute monitoring. Default is on.") do |val|
|
1855
1855
|
params['muteMonitoring'] = val.nil? || val.to_s == 'on' || val.to_s == 'true'
|
1856
1856
|
end
|
@@ -1860,7 +1860,7 @@ class Morpheus::Cli::Instances
|
|
1860
1860
|
opts.add_hidden_option('muteMonitoring') if opts.is_a?(Morpheus::Cli::OptionParser)
|
1861
1861
|
build_common_options(opts, options, [:auto_confirm, :quiet, :json, :dry_run, :remote])
|
1862
1862
|
opts.footer = "Restart service on an instance.\n" +
|
1863
|
-
"[
|
1863
|
+
"[instance] is required. This is the name or id of an instance. Supports 1-N [instance] arguments."
|
1864
1864
|
end
|
1865
1865
|
optparse.parse!(args)
|
1866
1866
|
if args.count < 1
|
@@ -2060,7 +2060,7 @@ class Morpheus::Cli::Instances
|
|
2060
2060
|
def resize(args)
|
2061
2061
|
options = {}
|
2062
2062
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
2063
|
-
opts.banner = subcommand_usage("[
|
2063
|
+
opts.banner = subcommand_usage("[instance]")
|
2064
2064
|
build_common_options(opts, options, [:options, :json, :dry_run, :remote])
|
2065
2065
|
end
|
2066
2066
|
optparse.parse!(args)
|
@@ -2136,7 +2136,7 @@ class Morpheus::Cli::Instances
|
|
2136
2136
|
def backup(args)
|
2137
2137
|
options = {}
|
2138
2138
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
2139
|
-
opts.banner = subcommand_usage("[
|
2139
|
+
opts.banner = subcommand_usage("[instance]")
|
2140
2140
|
build_common_options(opts, options, [:auto_confirm, :json, :dry_run, :remote])
|
2141
2141
|
end
|
2142
2142
|
optparse.parse!(args)
|
@@ -2186,7 +2186,7 @@ class Morpheus::Cli::Instances
|
|
2186
2186
|
options = {}
|
2187
2187
|
query_params = {}
|
2188
2188
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
2189
|
-
opts.banner = subcommand_usage("[
|
2189
|
+
opts.banner = subcommand_usage("[instance]")
|
2190
2190
|
opts.on( '-B', '--keep-backups', "Preserve copy of backups" ) do
|
2191
2191
|
query_params[:keepBackups] = 'on'
|
2192
2192
|
end
|
@@ -2239,7 +2239,7 @@ class Morpheus::Cli::Instances
|
|
2239
2239
|
def firewall_disable(args)
|
2240
2240
|
options = {}
|
2241
2241
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
2242
|
-
opts.banner = subcommand_usage("[
|
2242
|
+
opts.banner = subcommand_usage("[instance]")
|
2243
2243
|
build_common_options(opts, options, [:json, :dry_run, :quiet, :remote])
|
2244
2244
|
end
|
2245
2245
|
optparse.parse!(args)
|
@@ -2271,7 +2271,7 @@ class Morpheus::Cli::Instances
|
|
2271
2271
|
def firewall_enable(args)
|
2272
2272
|
options = {}
|
2273
2273
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
2274
|
-
opts.banner = subcommand_usage("[
|
2274
|
+
opts.banner = subcommand_usage("[instance]")
|
2275
2275
|
build_common_options(opts, options, [:json, :dry_run, :quiet, :remote])
|
2276
2276
|
end
|
2277
2277
|
optparse.parse!(args)
|
@@ -2303,7 +2303,7 @@ class Morpheus::Cli::Instances
|
|
2303
2303
|
def security_groups(args)
|
2304
2304
|
options = {}
|
2305
2305
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
2306
|
-
opts.banner = subcommand_usage("[
|
2306
|
+
opts.banner = subcommand_usage("[instance]")
|
2307
2307
|
build_common_options(opts, options, [:json, :dry_run, :remote])
|
2308
2308
|
end
|
2309
2309
|
optparse.parse!(args)
|
@@ -2351,7 +2351,7 @@ class Morpheus::Cli::Instances
|
|
2351
2351
|
security_group_ids = nil
|
2352
2352
|
clear_or_secgroups_specified = false
|
2353
2353
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
2354
|
-
opts.banner = subcommand_usage("[
|
2354
|
+
opts.banner = subcommand_usage("[instance] [-S] [-c]")
|
2355
2355
|
opts.on( '-S', '--secgroups SECGROUPS', "Apply the specified comma separated security group ids" ) do |secgroups|
|
2356
2356
|
security_group_ids = secgroups.split(",")
|
2357
2357
|
clear_or_secgroups_specified = true
|
@@ -2398,7 +2398,7 @@ class Morpheus::Cli::Instances
|
|
2398
2398
|
def run_workflow(args)
|
2399
2399
|
options = {}
|
2400
2400
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
2401
|
-
opts.banner = subcommand_usage("[
|
2401
|
+
opts.banner = subcommand_usage("[instance] [workflow] [options]")
|
2402
2402
|
build_common_options(opts, options, [:options, :json, :dry_run, :remote])
|
2403
2403
|
end
|
2404
2404
|
optparse.parse!(args)
|
@@ -2408,7 +2408,7 @@ class Morpheus::Cli::Instances
|
|
2408
2408
|
end
|
2409
2409
|
connect(options)
|
2410
2410
|
instance = find_instance_by_name_or_id(args[0])
|
2411
|
-
workflow =
|
2411
|
+
workflow = find_workflow_by_name_or_id(args[1])
|
2412
2412
|
task_types = @tasks_interface.task_types()
|
2413
2413
|
editable_options = []
|
2414
2414
|
workflow['taskSetTasks'].sort{|a,b| a['taskOrder'] <=> b['taskOrder']}.each do |task_set_task|
|
@@ -2457,7 +2457,7 @@ class Morpheus::Cli::Instances
|
|
2457
2457
|
options = {}
|
2458
2458
|
storage_provider_id = nil
|
2459
2459
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
2460
|
-
opts.banner = subcommand_usage("[
|
2460
|
+
opts.banner = subcommand_usage("[instance]")
|
2461
2461
|
opts.on("--storage-provider ID", String, "Optional storage provider") do |val|
|
2462
2462
|
storage_provider_id = val
|
2463
2463
|
end
|
@@ -2513,7 +2513,7 @@ class Morpheus::Cli::Instances
|
|
2513
2513
|
options = {}
|
2514
2514
|
params = {}
|
2515
2515
|
optparse = Morpheus::Cli::OptionParser.new do|opts|
|
2516
|
-
opts.banner = subcommand_usage("[
|
2516
|
+
opts.banner = subcommand_usage("[instance]")
|
2517
2517
|
build_common_options(opts, options, [:json, :yaml, :csv, :fields, :dry_run, :remote])
|
2518
2518
|
opts.footer = "Show scaling threshold information for an instance."
|
2519
2519
|
end
|
@@ -2567,10 +2567,10 @@ class Morpheus::Cli::Instances
|
|
2567
2567
|
end
|
2568
2568
|
|
2569
2569
|
def scaling_update(args)
|
2570
|
-
usage = "Usage: morpheus instances scaling-update [
|
2570
|
+
usage = "Usage: morpheus instances scaling-update [instance] [options]"
|
2571
2571
|
options = {}
|
2572
2572
|
optparse = Morpheus::Cli::OptionParser.new do|opts|
|
2573
|
-
opts.banner = subcommand_usage("[
|
2573
|
+
opts.banner = subcommand_usage("[instance]")
|
2574
2574
|
build_option_type_options(opts, options, instance_scaling_option_types(nil))
|
2575
2575
|
build_common_options(opts, options, [:options, :json, :dry_run, :remote])
|
2576
2576
|
opts.footer = "Update scaling threshold information for an instance."
|
@@ -2689,10 +2689,10 @@ class Morpheus::Cli::Instances
|
|
2689
2689
|
|
2690
2690
|
def load_balancer_update(args)
|
2691
2691
|
raise "Not Yet Implemented"
|
2692
|
-
usage = "Usage: morpheus instances lb-update [
|
2692
|
+
usage = "Usage: morpheus instances lb-update [instance] [options]"
|
2693
2693
|
options = {}
|
2694
2694
|
optparse = Morpheus::Cli::OptionParser.new do|opts|
|
2695
|
-
opts.banner = subcommand_usage("[
|
2695
|
+
opts.banner = subcommand_usage("[instance]")
|
2696
2696
|
#build_option_type_options(opts, options, instance_load_balancer_option_types(nil))
|
2697
2697
|
build_common_options(opts, options, [:options, :json, :dry_run, :remote])
|
2698
2698
|
opts.footer = "Assign a load balancer for an instance."
|
@@ -2770,10 +2770,10 @@ class Morpheus::Cli::Instances
|
|
2770
2770
|
end
|
2771
2771
|
|
2772
2772
|
def load_balancer_remove(args)
|
2773
|
-
usage = "Usage: morpheus instances lb-remove [
|
2773
|
+
usage = "Usage: morpheus instances lb-remove [instance] [options]"
|
2774
2774
|
options = {}
|
2775
2775
|
optparse = Morpheus::Cli::OptionParser.new do|opts|
|
2776
|
-
opts.banner = subcommand_usage("[
|
2776
|
+
opts.banner = subcommand_usage("[instance]")
|
2777
2777
|
build_option_type_options(opts, options, instance_scaling_option_types(nil))
|
2778
2778
|
build_common_options(opts, options, [:auto_confirm, :json, :dry_run, :remote])
|
2779
2779
|
opts.footer = "Remove a load balancer from an instance."
|
@@ -3273,16 +3273,41 @@ private
|
|
3273
3273
|
end
|
3274
3274
|
end
|
3275
3275
|
|
3276
|
-
def
|
3277
|
-
|
3278
|
-
|
3279
|
-
return task_set_results['taskSets'][0]
|
3276
|
+
def find_workflow_by_name_or_id(val)
|
3277
|
+
if val.to_s =~ /\A\d{1,}\Z/
|
3278
|
+
return find_workflow_by_id(val)
|
3280
3279
|
else
|
3281
|
-
|
3282
|
-
exit 1
|
3280
|
+
return find_workflow_by_name(val)
|
3283
3281
|
end
|
3284
3282
|
end
|
3285
3283
|
|
3284
|
+
def find_workflow_by_id(id)
|
3285
|
+
begin
|
3286
|
+
json_response = @task_sets_interface.get(id.to_i)
|
3287
|
+
return json_response['taskSet']
|
3288
|
+
rescue RestClient::Exception => e
|
3289
|
+
if e.response && e.response.code == 404
|
3290
|
+
print_red_alert "Workflow not found by id #{id}"
|
3291
|
+
else
|
3292
|
+
raise e
|
3293
|
+
end
|
3294
|
+
end
|
3295
|
+
end
|
3296
|
+
|
3297
|
+
def find_workflow_by_name(name)
|
3298
|
+
workflows = @task_sets_interface.get({name: name.to_s})['taskSets']
|
3299
|
+
if workflows.empty?
|
3300
|
+
print_red_alert "Workflow not found by name #{name}"
|
3301
|
+
return nil
|
3302
|
+
elsif workflows.size > 1
|
3303
|
+
print_red_alert "#{workflows.size} workflows by name #{name}"
|
3304
|
+
print_workflows_table(workflows, {color: red})
|
3305
|
+
print reset,"\n\n"
|
3306
|
+
return nil
|
3307
|
+
else
|
3308
|
+
return workflows[0]
|
3309
|
+
end
|
3310
|
+
end
|
3286
3311
|
|
3287
3312
|
def format_instance_status(instance, return_color=cyan)
|
3288
3313
|
out = ""
|