morpheus-cli 5.5.2.2 → 5.5.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/Dockerfile +1 -1
- data/README.md +57 -4
- data/Rakefile +9 -0
- data/bin/morpheus +4 -4
- data/lib/morpheus/api/api_client.rb +20 -2
- data/lib/morpheus/api/appliance_settings_interface.rb +15 -0
- data/lib/morpheus/api/archive_buckets_interface.rb +1 -1
- data/lib/morpheus/api/archive_files_interface.rb +3 -3
- data/lib/morpheus/api/clients_interface.rb +2 -2
- data/lib/morpheus/api/clusters_interface.rb +8 -1
- data/lib/morpheus/api/containers_interface.rb +29 -16
- data/lib/morpheus/api/custom_instance_types_interface.rb +0 -2
- data/lib/morpheus/api/cypher_interface.rb +1 -2
- data/lib/morpheus/api/doc_interface.rb +8 -6
- data/lib/morpheus/api/file_copy_request_interface.rb +1 -1
- data/lib/morpheus/api/guidance_settings_interface.rb +17 -0
- data/lib/morpheus/api/health_interface.rb +1 -1
- data/lib/morpheus/api/image_builder_interface.rb +3 -3
- data/lib/morpheus/api/instances_interface.rb +25 -0
- data/lib/morpheus/api/logs_interface.rb +2 -4
- data/lib/morpheus/api/monitoring_interface.rb +6 -6
- data/lib/morpheus/api/monitoring_settings_interface.rb +25 -0
- data/lib/morpheus/api/network_server_groups_interface.rb +7 -0
- data/lib/morpheus/api/packages_interface.rb +1 -1
- data/lib/morpheus/api/reports_interface.rb +1 -1
- data/lib/morpheus/api/servers_interface.rb +9 -1
- data/lib/morpheus/api/storage_providers_interface.rb +2 -2
- data/lib/morpheus/api/virtual_images_interface.rb +1 -1
- data/lib/morpheus/api.rb +2 -0
- data/lib/morpheus/benchmarking.rb +1 -1
- data/lib/morpheus/cli/cli_command.rb +79 -37
- data/lib/morpheus/cli/cli_registry.rb +19 -10
- data/lib/morpheus/cli/commands/access_token_command.rb +1 -1
- data/lib/morpheus/cli/commands/appliance_settings_command.rb +57 -2
- data/lib/morpheus/cli/commands/apps.rb +1 -1
- data/lib/morpheus/cli/commands/archives_command.rb +25 -33
- data/lib/morpheus/cli/commands/backup_settings_command.rb +1 -1
- data/lib/morpheus/cli/commands/blueprints_command.rb +10 -21
- data/lib/morpheus/cli/commands/boot_scripts_command.rb +2 -2
- data/lib/morpheus/cli/commands/cat_command.rb +1 -1
- data/lib/morpheus/cli/commands/catalog_item_types_command.rb +18 -13
- data/lib/morpheus/cli/commands/clouds.rb +3 -3
- data/lib/morpheus/cli/commands/clusters.rb +154 -3
- data/lib/morpheus/cli/commands/containers_command.rb +398 -253
- data/lib/morpheus/cli/commands/cypher_command.rb +3 -0
- data/lib/morpheus/cli/commands/deployments.rb +1 -1
- data/lib/morpheus/cli/commands/deploys.rb +9 -9
- data/lib/morpheus/cli/commands/doc.rb +15 -16
- data/lib/morpheus/cli/commands/execution_request_command.rb +2 -2
- data/lib/morpheus/cli/commands/file_copy_request_command.rb +5 -5
- data/lib/morpheus/cli/commands/groups.rb +2 -2
- data/lib/morpheus/cli/commands/guidance_command.rb +2 -2
- data/lib/morpheus/cli/commands/guidance_settings.rb +148 -0
- data/lib/morpheus/cli/commands/health_command.rb +4 -4
- data/lib/morpheus/cli/commands/hosts.rb +43 -5
- data/lib/morpheus/cli/commands/image_builder_command.rb +1 -1
- data/lib/morpheus/cli/commands/instances.rb +419 -148
- data/lib/morpheus/cli/commands/integrations_command.rb +22 -20
- data/lib/morpheus/cli/commands/key_pairs.rb +2 -2
- data/lib/morpheus/cli/commands/library_container_scripts_command.rb +2 -2
- data/lib/morpheus/cli/commands/library_container_templates_command.rb +2 -2
- data/lib/morpheus/cli/commands/library_instance_types_command.rb +3 -3
- data/lib/morpheus/cli/commands/library_spec_templates_command.rb +2 -2
- data/lib/morpheus/cli/commands/log_settings_command.rb +1 -1
- data/lib/morpheus/cli/commands/login.rb +1 -1
- data/lib/morpheus/cli/commands/man_command.rb +32 -18
- data/lib/morpheus/cli/commands/monitoring_settings.rb +228 -0
- data/lib/morpheus/cli/commands/network_server_groups_command.rb +222 -0
- data/lib/morpheus/cli/commands/packages_command.rb +11 -11
- data/lib/morpheus/cli/commands/plugins.rb +1 -1
- data/lib/morpheus/cli/commands/policies_command.rb +4 -4
- data/lib/morpheus/cli/commands/preseed_scripts_command.rb +2 -2
- data/lib/morpheus/cli/commands/provisioning_settings_command.rb +1 -1
- data/lib/morpheus/cli/commands/remote.rb +1 -1
- data/lib/morpheus/cli/commands/reports_command.rb +13 -3
- data/lib/morpheus/cli/commands/security_groups.rb +1 -1
- data/lib/morpheus/cli/commands/shell.rb +40 -62
- data/lib/morpheus/cli/commands/snapshots.rb +3 -5
- data/lib/morpheus/cli/commands/source_command.rb +8 -16
- data/lib/morpheus/cli/commands/storage_providers_command.rb +7 -7
- data/lib/morpheus/cli/commands/tasks.rb +2 -2
- data/lib/morpheus/cli/commands/vdi_pools_command.rb +6 -6
- data/lib/morpheus/cli/commands/view.rb +5 -1
- data/lib/morpheus/cli/commands/whitelabel_settings_command.rb +5 -5
- data/lib/morpheus/cli/commands/whoami.rb +2 -2
- data/lib/morpheus/cli/credentials.rb +30 -8
- data/lib/morpheus/cli/dot_file.rb +8 -15
- data/lib/morpheus/cli/error_handler.rb +16 -0
- data/lib/morpheus/cli/errors.rb +8 -1
- data/lib/morpheus/cli/mixins/print_helper.rb +17 -13
- data/lib/morpheus/cli/mixins/provisioning_helper.rb +14 -12
- data/lib/morpheus/cli/mixins/rest_command.rb +23 -19
- data/lib/morpheus/cli/mixins/secondary_rest_command.rb +47 -24
- data/lib/morpheus/cli/option_parser.rb +5 -1
- data/lib/morpheus/cli/option_types.rb +59 -12
- data/lib/morpheus/cli/version.rb +1 -1
- data/lib/morpheus/cli.rb +26 -16
- data/lib/morpheus/ext/rest_client.rb +3 -2
- data/lib/morpheus/ext/string.rb +6 -4
- data/lib/morpheus/formatters.rb +1 -1
- data/lib/morpheus/logging.rb +4 -4
- data/lib/morpheus/morpkg.rb +4 -4
- data/lib/morpheus/rest_client.rb +2 -2
- data/lib/morpheus/routes.rb +41 -9
- data/lib/morpheus/terminal.rb +65 -16
- data/lib/morpheus.rb +1 -1
- data/morpheus-cli.gemspec +1 -0
- data/test/api/containers_interface_test.rb +68 -0
- data/test/api/doc_interface_test.rb +35 -0
- data/test/api/instances_interface_test.rb +22 -0
- data/test/api/whoami_interface_test.rb +14 -0
- data/test/cli/access_token_test.rb +36 -0
- data/test/cli/auth_test.rb +82 -0
- data/test/cli/cli_test.rb +48 -0
- data/test/cli/containers_test.rb +92 -0
- data/test/cli/doc_test.rb +35 -0
- data/test/cli/help_test.rb +25 -0
- data/test/cli/instances_test.rb +36 -0
- data/test/cli/man_test.rb +14 -0
- data/test/cli/remote_test.rb +89 -0
- data/test/cli/roles_test.rb +34 -0
- data/test/cli/shell_test.rb +81 -0
- data/test/cli/version_test.rb +23 -0
- data/test/cli/view_test.rb +55 -0
- data/test/cli/whoami_test.rb +17 -0
- data/test/morpheus_test.rb +16 -0
- data/test/test_case.rb +338 -0
- data/test/test_config.rb +137 -0
- data/test/test_data_helper.rb +97 -0
- metadata +67 -3
@@ -383,7 +383,6 @@ class Morpheus::Cli::ArchivesCommand
|
|
383
383
|
end
|
384
384
|
|
385
385
|
def remove_bucket(args)
|
386
|
-
full_command_string = "#{command_name} remove #{args.join(' ')}".strip
|
387
386
|
options = {}
|
388
387
|
query_params = {}
|
389
388
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
@@ -414,7 +413,7 @@ class Morpheus::Cli::ArchivesCommand
|
|
414
413
|
end
|
415
414
|
@archive_buckets_interface.setopts(options)
|
416
415
|
if options[:dry_run]
|
417
|
-
print_dry_run @archive_buckets_interface.dry.destroy(archive_bucket['id'], query_params)
|
416
|
+
print_dry_run @archive_buckets_interface.dry.destroy(archive_bucket['id'], query_params)
|
418
417
|
return 0
|
419
418
|
end
|
420
419
|
json_response = @archive_buckets_interface.destroy(archive_bucket['id'], query_params)
|
@@ -470,7 +469,7 @@ class Morpheus::Cli::ArchivesCommand
|
|
470
469
|
puts_error "#{command_name} missing argument: [local-file]\n#{optparse}"
|
471
470
|
return 1
|
472
471
|
end
|
473
|
-
if !File.
|
472
|
+
if !File.exist?(local_file_path)
|
474
473
|
print_error Morpheus::Terminal.angry_prompt
|
475
474
|
puts_error "#{command_name} bad argument: [local-file]\nFile '#{local_file_path}' was not found.\n#{optparse}"
|
476
475
|
return 1
|
@@ -595,7 +594,7 @@ class Morpheus::Cli::ArchivesCommand
|
|
595
594
|
else
|
596
595
|
|
597
596
|
# upload file
|
598
|
-
if !File.
|
597
|
+
if !File.exist?(local_file_path) && !File.file?(local_file_path)
|
599
598
|
print_error Morpheus::Terminal.angry_prompt
|
600
599
|
puts_error "#{command_name} bad argument: [local-file]\nFile '#{local_file_path}' was not found.\n#{optparse}"
|
601
600
|
return 1
|
@@ -886,7 +885,6 @@ class Morpheus::Cli::ArchivesCommand
|
|
886
885
|
end
|
887
886
|
|
888
887
|
def get_file(args)
|
889
|
-
full_command_string = "#{command_name} get-file #{args.join(' ')}".strip
|
890
888
|
options = {}
|
891
889
|
max_links = 10
|
892
890
|
max_history = 10
|
@@ -929,9 +927,9 @@ class Morpheus::Cli::ArchivesCommand
|
|
929
927
|
@archive_files_interface.setopts(options)
|
930
928
|
if options[:dry_run]
|
931
929
|
if file_id
|
932
|
-
print_dry_run @archive_files_interface.dry.get(file_id, params)
|
930
|
+
print_dry_run @archive_files_interface.dry.get(file_id, params)
|
933
931
|
else
|
934
|
-
print_dry_run @archive_buckets_interface.dry.list_files(bucket_id, file_path, params)
|
932
|
+
print_dry_run @archive_buckets_interface.dry.list_files(bucket_id, file_path, params)
|
935
933
|
end
|
936
934
|
return 0
|
937
935
|
end
|
@@ -1211,7 +1209,6 @@ class Morpheus::Cli::ArchivesCommand
|
|
1211
1209
|
end
|
1212
1210
|
|
1213
1211
|
def download_file(args)
|
1214
|
-
full_command_string = "#{command_name} download #{args.join(' ')}".strip
|
1215
1212
|
options = {}
|
1216
1213
|
outfile = nil
|
1217
1214
|
do_overwrite = false
|
@@ -1256,15 +1253,15 @@ class Morpheus::Cli::ArchivesCommand
|
|
1256
1253
|
# outfile = File.join(outfile, File.basename(full_file_path))
|
1257
1254
|
# end
|
1258
1255
|
outfile = File.expand_path(outfile)
|
1259
|
-
if Dir.
|
1256
|
+
if Dir.exist?(outfile)
|
1260
1257
|
outfile = File.join(outfile, File.basename(full_file_path))
|
1261
1258
|
end
|
1262
|
-
if Dir.
|
1259
|
+
if Dir.exist?(outfile)
|
1263
1260
|
print_red_alert "[local-file] is invalid. It is the name of an existing directory: #{outfile}"
|
1264
1261
|
return 1
|
1265
1262
|
end
|
1266
1263
|
destination_dir = File.dirname(outfile)
|
1267
|
-
if !Dir.
|
1264
|
+
if !Dir.exist?(destination_dir)
|
1268
1265
|
if do_mkdir
|
1269
1266
|
print cyan,"Creating local directory #{destination_dir}",reset,"\n"
|
1270
1267
|
FileUtils.mkdir_p(destination_dir)
|
@@ -1273,7 +1270,7 @@ class Morpheus::Cli::ArchivesCommand
|
|
1273
1270
|
return 1
|
1274
1271
|
end
|
1275
1272
|
end
|
1276
|
-
if File.
|
1273
|
+
if File.exist?(outfile)
|
1277
1274
|
if do_overwrite
|
1278
1275
|
# uhh need to be careful wih the passed filepath here..
|
1279
1276
|
# don't delete, just overwrite.
|
@@ -1288,11 +1285,10 @@ class Morpheus::Cli::ArchivesCommand
|
|
1288
1285
|
begin
|
1289
1286
|
@archive_files_interface.setopts(options)
|
1290
1287
|
if options[:dry_run]
|
1291
|
-
# print_dry_run @archive_files_interface.dry.download_file_by_path(full_file_path), full_command_string
|
1292
1288
|
if use_public_url
|
1293
|
-
print_dry_run @archive_files_interface.dry.download_public_file_by_path_chunked(full_file_path, outfile)
|
1289
|
+
print_dry_run @archive_files_interface.dry.download_public_file_by_path_chunked(full_file_path, outfile)
|
1294
1290
|
else
|
1295
|
-
print_dry_run @archive_files_interface.dry.download_file_by_path_chunked(full_file_path, outfile)
|
1291
|
+
print_dry_run @archive_files_interface.dry.download_file_by_path_chunked(full_file_path, outfile)
|
1296
1292
|
end
|
1297
1293
|
return 0
|
1298
1294
|
end
|
@@ -1322,7 +1318,7 @@ class Morpheus::Cli::ArchivesCommand
|
|
1322
1318
|
print red + "ERROR" + reset + " HTTP #{http_response.code}" + "\n"
|
1323
1319
|
end
|
1324
1320
|
# F it, just remove a bad result
|
1325
|
-
if File.
|
1321
|
+
if File.exist?(outfile) && File.file?(outfile)
|
1326
1322
|
Morpheus::Logging::DarkPrinter.puts "Deleting bad file download: #{outfile}" if Morpheus::Logging.debug?
|
1327
1323
|
File.delete(outfile)
|
1328
1324
|
end
|
@@ -1348,7 +1344,6 @@ class Morpheus::Cli::ArchivesCommand
|
|
1348
1344
|
end
|
1349
1345
|
|
1350
1346
|
def read_file(args)
|
1351
|
-
full_command_string = "archives read #{args.join(' ')}".strip
|
1352
1347
|
options = {}
|
1353
1348
|
outfile = nil
|
1354
1349
|
do_overwrite = false
|
@@ -1374,7 +1369,7 @@ class Morpheus::Cli::ArchivesCommand
|
|
1374
1369
|
full_file_path = "#{bucket_id}/#{file_path}".squeeze('/')
|
1375
1370
|
@archive_files_interface.setopts(options)
|
1376
1371
|
if options[:dry_run]
|
1377
|
-
print_dry_run @archive_files_interface.dry.download_file_by_path(full_file_path)
|
1372
|
+
print_dry_run @archive_files_interface.dry.download_file_by_path(full_file_path)
|
1378
1373
|
return 1
|
1379
1374
|
end
|
1380
1375
|
if archive_file['rawSize'].to_i > 1024
|
@@ -1497,7 +1492,6 @@ class Morpheus::Cli::ArchivesCommand
|
|
1497
1492
|
end
|
1498
1493
|
|
1499
1494
|
def download_file_link(args)
|
1500
|
-
full_command_string = "archives download-link #{args.join(' ')}".strip
|
1501
1495
|
options = {}
|
1502
1496
|
outfile = nil
|
1503
1497
|
do_overwrite = false
|
@@ -1533,15 +1527,15 @@ class Morpheus::Cli::ArchivesCommand
|
|
1533
1527
|
# full_file_path = args[0]
|
1534
1528
|
outfile = File.expand_path(args[1])
|
1535
1529
|
# [local-file] must include the full file name when downloading a link
|
1536
|
-
# if Dir.
|
1530
|
+
# if Dir.exist?(outfile)
|
1537
1531
|
# outfile = File.join(outfile, File.basename(archive_file['name']))
|
1538
1532
|
# end
|
1539
|
-
if Dir.
|
1533
|
+
if Dir.exist?(outfile)
|
1540
1534
|
print_red_alert "[local-file] is invalid. It is the name of an existing directory: #{outfile}"
|
1541
1535
|
return 1
|
1542
1536
|
end
|
1543
1537
|
destination_dir = File.dirname(outfile)
|
1544
|
-
if !Dir.
|
1538
|
+
if !Dir.exist?(destination_dir)
|
1545
1539
|
if do_mkdir
|
1546
1540
|
print cyan,"Creating local directory #{destination_dir}",reset,"\n"
|
1547
1541
|
FileUtils.mkdir_p(destination_dir)
|
@@ -1550,7 +1544,7 @@ class Morpheus::Cli::ArchivesCommand
|
|
1550
1544
|
return 1
|
1551
1545
|
end
|
1552
1546
|
end
|
1553
|
-
if File.
|
1547
|
+
if File.exist?(outfile)
|
1554
1548
|
if do_overwrite
|
1555
1549
|
# uhh need to be careful wih the passed filepath here..
|
1556
1550
|
# don't delete, just overwrite.
|
@@ -1566,8 +1560,7 @@ class Morpheus::Cli::ArchivesCommand
|
|
1566
1560
|
end
|
1567
1561
|
@archive_files_interface.setopts(options)
|
1568
1562
|
if options[:dry_run]
|
1569
|
-
|
1570
|
-
print_dry_run @archive_files_interface.dry.download_file_by_link_chunked(link_key, outfile), full_command_string
|
1563
|
+
print_dry_run @archive_files_interface.dry.download_file_by_link_chunked(link_key, outfile)
|
1571
1564
|
return 1
|
1572
1565
|
end
|
1573
1566
|
if !options[:quiet]
|
@@ -1591,7 +1584,7 @@ class Morpheus::Cli::ArchivesCommand
|
|
1591
1584
|
print red + "ERROR" + reset + " HTTP #{http_response.code}" + "\n"
|
1592
1585
|
end
|
1593
1586
|
# F it, just remove a bad result
|
1594
|
-
if File.
|
1587
|
+
if File.exist?(outfile) && File.file?(outfile)
|
1595
1588
|
Morpheus::Logging::DarkPrinter.puts "Deleting bad file download: #{outfile}" if Morpheus::Logging.debug?
|
1596
1589
|
File.delete(outfile)
|
1597
1590
|
end
|
@@ -1608,7 +1601,6 @@ class Morpheus::Cli::ArchivesCommand
|
|
1608
1601
|
end
|
1609
1602
|
|
1610
1603
|
def download_bucket_zip(args)
|
1611
|
-
full_command_string = "#{command_name} download-bucket #{args.join(' ')}".strip
|
1612
1604
|
options = {}
|
1613
1605
|
outfile = nil
|
1614
1606
|
do_overwrite = false
|
@@ -1651,10 +1643,10 @@ class Morpheus::Cli::ArchivesCommand
|
|
1651
1643
|
# outfile = File.join(outfile, archive_bucket['name'].to_s) + ".zip"
|
1652
1644
|
# end
|
1653
1645
|
outfile = File.expand_path(outfile)
|
1654
|
-
if Dir.
|
1646
|
+
if Dir.exist?(outfile)
|
1655
1647
|
outfile = File.join(outfile, archive_bucket['name'].to_s) + ".zip"
|
1656
1648
|
end
|
1657
|
-
if Dir.
|
1649
|
+
if Dir.exist?(outfile)
|
1658
1650
|
print_red_alert "[local-file] is invalid. It is the name of an existing directory: #{outfile}"
|
1659
1651
|
return 1
|
1660
1652
|
end
|
@@ -1663,7 +1655,7 @@ class Morpheus::Cli::ArchivesCommand
|
|
1663
1655
|
outfile << ".zip"
|
1664
1656
|
end
|
1665
1657
|
destination_dir = File.dirname(outfile)
|
1666
|
-
if !Dir.
|
1658
|
+
if !Dir.exist?(destination_dir)
|
1667
1659
|
if do_mkdir
|
1668
1660
|
print cyan,"Creating local directory #{destination_dir}",reset,"\n"
|
1669
1661
|
FileUtils.mkdir_p(destination_dir)
|
@@ -1672,7 +1664,7 @@ class Morpheus::Cli::ArchivesCommand
|
|
1672
1664
|
return 1
|
1673
1665
|
end
|
1674
1666
|
end
|
1675
|
-
if File.
|
1667
|
+
if File.exist?(outfile)
|
1676
1668
|
if do_overwrite
|
1677
1669
|
# uhh need to be careful wih the passed filepath here..
|
1678
1670
|
# don't delete, just overwrite.
|
@@ -1686,7 +1678,7 @@ class Morpheus::Cli::ArchivesCommand
|
|
1686
1678
|
end
|
1687
1679
|
@archive_buckets_interface.setopts(options)
|
1688
1680
|
if options[:dry_run]
|
1689
|
-
print_dry_run @archive_buckets_interface.dry.download_bucket_zip_chunked(bucket_id, outfile)
|
1681
|
+
print_dry_run @archive_buckets_interface.dry.download_bucket_zip_chunked(bucket_id, outfile)
|
1690
1682
|
return 1
|
1691
1683
|
end
|
1692
1684
|
if !options[:quiet]
|
@@ -1707,7 +1699,7 @@ class Morpheus::Cli::ArchivesCommand
|
|
1707
1699
|
print red + "ERROR" + reset + " HTTP #{http_response.code}" + "\n"
|
1708
1700
|
end
|
1709
1701
|
# F it, just remove a bad result
|
1710
|
-
if File.
|
1702
|
+
if File.exist?(outfile) && File.file?(outfile)
|
1711
1703
|
Morpheus::Logging::DarkPrinter.puts "Deleting bad file download: #{outfile}" if Morpheus::Logging.debug?
|
1712
1704
|
File.delete(outfile)
|
1713
1705
|
end
|
@@ -66,7 +66,7 @@ class Morpheus::Cli::BackupSettingsCommand
|
|
66
66
|
"Backup Retention Count" => lambda {|it| it['retentionCount'] }
|
67
67
|
}
|
68
68
|
print_description_list(description_cols, backup_settings)
|
69
|
-
print reset "\n"
|
69
|
+
print reset, "\n"
|
70
70
|
return 0
|
71
71
|
rescue RestClient::Exception => e
|
72
72
|
print_rest_exception(e, options)
|
@@ -260,7 +260,7 @@ class Morpheus::Cli::BlueprintsCommand
|
|
260
260
|
end
|
261
261
|
|
262
262
|
def update(args)
|
263
|
-
|
263
|
+
payload, options = {}, {}
|
264
264
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
265
265
|
opts.banner = subcommand_usage("[blueprint] [options]")
|
266
266
|
build_option_type_options(opts, options, update_blueprint_option_types(false))
|
@@ -283,7 +283,6 @@ class Morpheus::Cli::BlueprintsCommand
|
|
283
283
|
blueprint = find_blueprint_by_name_or_id(args[0])
|
284
284
|
return 1 if blueprint.nil?
|
285
285
|
payload = {}
|
286
|
-
passed_options = options[:options] ? options[:options].reject {|k,v| k.is_a?(Symbol) } : {}
|
287
286
|
if options[:payload]
|
288
287
|
payload = options[:payload]
|
289
288
|
payload.deep_merge!(parse_passed_options(options))
|
@@ -341,7 +340,7 @@ class Morpheus::Cli::BlueprintsCommand
|
|
341
340
|
end
|
342
341
|
|
343
342
|
def update_permissions(args)
|
344
|
-
|
343
|
+
payload, options = {}, {}
|
345
344
|
group_access_all = nil
|
346
345
|
group_access_list = nil
|
347
346
|
group_defaults_list = nil
|
@@ -453,7 +452,6 @@ class Morpheus::Cli::BlueprintsCommand
|
|
453
452
|
|
454
453
|
|
455
454
|
def upload_image(args)
|
456
|
-
image_type_name = nil
|
457
455
|
options = {}
|
458
456
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
459
457
|
opts.banner = subcommand_usage("[blueprint] [file]")
|
@@ -889,7 +887,7 @@ class Morpheus::Cli::BlueprintsCommand
|
|
889
887
|
end
|
890
888
|
|
891
889
|
def remove_instance_config(args)
|
892
|
-
instance_index = nil
|
890
|
+
#instance_index = nil
|
893
891
|
options = {}
|
894
892
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
895
893
|
opts.banner = subcommand_usage("[blueprint] [tier] [instance] -g GROUP -c CLOUD")
|
@@ -1081,7 +1079,7 @@ class Morpheus::Cli::BlueprintsCommand
|
|
1081
1079
|
end
|
1082
1080
|
|
1083
1081
|
def remove_instance(args)
|
1084
|
-
instance_index = nil
|
1082
|
+
#instance_index = nil
|
1085
1083
|
options = {}
|
1086
1084
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
1087
1085
|
opts.banner = subcommand_usage("[blueprint] [tier] [instance]")
|
@@ -1402,7 +1400,6 @@ class Morpheus::Cli::BlueprintsCommand
|
|
1402
1400
|
new_tier_name = v_prompt['name']
|
1403
1401
|
end
|
1404
1402
|
if new_tier_name && new_tier_name != tier_name
|
1405
|
-
old_tier_name = tier_name
|
1406
1403
|
if tiers[new_tier_name]
|
1407
1404
|
print_red_alert "A tier named #{tier_name} already exists."
|
1408
1405
|
return 1
|
@@ -1415,7 +1412,6 @@ class Morpheus::Cli::BlueprintsCommand
|
|
1415
1412
|
v['linkedTiers'] = v['linkedTiers'].map {|it| it == tier_name ? new_tier_name : it }
|
1416
1413
|
end
|
1417
1414
|
end
|
1418
|
-
# old_tier_name = tier_name
|
1419
1415
|
tier_name = new_tier_name
|
1420
1416
|
end
|
1421
1417
|
|
@@ -1577,15 +1573,9 @@ class Morpheus::Cli::BlueprintsCommand
|
|
1577
1573
|
tiers = blueprint["config"]["tiers"]
|
1578
1574
|
|
1579
1575
|
if !tiers || tiers.keys.size == 0
|
1580
|
-
|
1581
|
-
# print_red_alert "Blueprint #{blueprint['name']} has no tiers."
|
1582
|
-
# raise_command_error "Blueprint #{blueprint['name']} has no tiers."
|
1583
|
-
print_error Morpheus::Terminal.angry_prompt
|
1584
|
-
puts_error "Blueprint #{blueprint['name']} has no tiers."
|
1585
|
-
return 1
|
1576
|
+
raise_command_error "Blueprint #{blueprint['name']} has no tiers."
|
1586
1577
|
end
|
1587
1578
|
|
1588
|
-
connect_tiers = []
|
1589
1579
|
tier1 = tiers[tier1_name]
|
1590
1580
|
tier2 = tiers[tier2_name]
|
1591
1581
|
# uhh support N args
|
@@ -1682,7 +1672,6 @@ class Morpheus::Cli::BlueprintsCommand
|
|
1682
1672
|
return 1
|
1683
1673
|
end
|
1684
1674
|
|
1685
|
-
connect_tiers = []
|
1686
1675
|
tier1 = tiers[tier1_name]
|
1687
1676
|
tier2 = tiers[tier2_name]
|
1688
1677
|
# uhh support N args
|
@@ -1859,7 +1848,7 @@ class Morpheus::Cli::BlueprintsCommand
|
|
1859
1848
|
@available_blueprint_types = results['types'].collect {|it|
|
1860
1849
|
{"name" => (it["name"] || it["code"]), "value" => (it["code"] || it["value"])}
|
1861
1850
|
}
|
1862
|
-
rescue RestClient::Exception
|
1851
|
+
rescue RestClient::Exception
|
1863
1852
|
# older version
|
1864
1853
|
@available_blueprint_types = [{"name" => "Morpheus", "value" => "morpheus"}, {"name" => "Terraform", "value" => "terraform"}, {"name" => "CloudFormation", "value" => "cloudFormation"}, {"name" => "ARM template", "value" => "arm"}]
|
1865
1854
|
end
|
@@ -1935,7 +1924,7 @@ class Morpheus::Cli::BlueprintsCommand
|
|
1935
1924
|
table_color = opts[:color] || cyan
|
1936
1925
|
rows = blueprints.collect do |blueprint|
|
1937
1926
|
#instance_type_names = (blueprint['instanceTypes'] || []).collect {|it| it['name'] }.join(', ')
|
1938
|
-
instance_type_names = []
|
1927
|
+
#instance_type_names = []
|
1939
1928
|
# if blueprint['config'] && blueprint['config']["tiers"]
|
1940
1929
|
# blueprint['config']["tiers"]
|
1941
1930
|
# end
|
@@ -2086,7 +2075,7 @@ class Morpheus::Cli::BlueprintsCommand
|
|
2086
2075
|
end
|
2087
2076
|
sorted_tiers = tiers.collect {|k,v| [k,v] }.sort {|a,b| a[1]['tierIndex'] <=> b[1]['tierIndex'] }
|
2088
2077
|
sorted_tiers.each do |tier_obj|
|
2089
|
-
tier_name = tier_obj[0]
|
2078
|
+
#tier_name = tier_obj[0]
|
2090
2079
|
tier_config = tier_obj[1]
|
2091
2080
|
if tier_config && tier_config['instances']
|
2092
2081
|
tier_config['instances'].each_with_index do |instance_config, instance_index|
|
@@ -2145,7 +2134,7 @@ class Morpheus::Cli::BlueprintsCommand
|
|
2145
2134
|
config_list.each do |config_obj|
|
2146
2135
|
# puts " = #{config_obj[:scope].inspect}"
|
2147
2136
|
config_scope = config_obj[:scope]
|
2148
|
-
scoped_instance_config = config_obj[:config]
|
2137
|
+
#scoped_instance_config = config_obj[:config]
|
2149
2138
|
config_description = ""
|
2150
2139
|
config_items = []
|
2151
2140
|
if config_scope[:environment]
|
@@ -2167,7 +2156,7 @@ class Morpheus::Cli::BlueprintsCommand
|
|
2167
2156
|
print white," Instance has no configs, use `blueprints add-instance-config \"#{blueprint['name']}\" \"#{tier_name}\" \"#{instance_name.to_s.empty? ? instance_type_code : instance_name}\"`",reset,"\n"
|
2168
2157
|
end
|
2169
2158
|
rescue => err
|
2170
|
-
|
2159
|
+
Morpheus::Logging::DarkPrinter.puts "Failed to parse instance config at index #{instance_index}. Exception: #{err.class} #{err.message}" if Morpheus::Logging.debug?
|
2171
2160
|
end
|
2172
2161
|
print "\n"
|
2173
2162
|
#puts as_yaml(instance_config)
|
@@ -173,7 +173,7 @@ class Morpheus::Cli::BootScriptsCommand
|
|
173
173
|
params = Morpheus::Cli::OptionTypes.prompt(my_options, options[:options], @api_client, options[:params])
|
174
174
|
script_file = params.delete('file')
|
175
175
|
if script_file
|
176
|
-
if !File.
|
176
|
+
if !File.exist?(script_file)
|
177
177
|
print_red_alert "File not found: #{script_file}"
|
178
178
|
return 1
|
179
179
|
end
|
@@ -244,7 +244,7 @@ class Morpheus::Cli::BootScriptsCommand
|
|
244
244
|
# params = Morpheus::Cli::OptionTypes.prompt(my_options, options[:options], @api_client, options[:params])
|
245
245
|
script_file = params.delete('file')
|
246
246
|
if script_file
|
247
|
-
if !File.
|
247
|
+
if !File.exist?(script_file)
|
248
248
|
print_red_alert "File not found: #{script_file}"
|
249
249
|
return 1
|
250
250
|
end
|
@@ -25,7 +25,7 @@ class Morpheus::Cli::CatCommand
|
|
25
25
|
arg_files = args
|
26
26
|
arg_files.each do |arg_file|
|
27
27
|
arg_file = File.expand_path(arg_file)
|
28
|
-
if !File.
|
28
|
+
if !File.exist?(arg_file)
|
29
29
|
print_error Morpheus::Terminal.angry_prompt
|
30
30
|
puts_error "#{command_name}: file not found: '#{arg_file}'"
|
31
31
|
#print_red_alert "morpheus cat: file not found: '#{arg_file}'"
|
@@ -248,7 +248,7 @@ EOT
|
|
248
248
|
logo_file = 'null' # clear it
|
249
249
|
else
|
250
250
|
filename = File.expand_path(filename)
|
251
|
-
if !File.
|
251
|
+
if !File.exist?(filename)
|
252
252
|
raise_command_error "File not found: #{filename}"
|
253
253
|
end
|
254
254
|
logo_file = File.new(filename, 'rb')
|
@@ -261,7 +261,7 @@ EOT
|
|
261
261
|
dark_logo_file = 'null' # clear it
|
262
262
|
else
|
263
263
|
filename = File.expand_path(filename)
|
264
|
-
if !File.
|
264
|
+
if !File.exist?(filename)
|
265
265
|
raise_command_error "File not found: #{filename}"
|
266
266
|
end
|
267
267
|
dark_logo_file = File.new(filename, 'rb')
|
@@ -271,7 +271,7 @@ EOT
|
|
271
271
|
options[:config_file] = val.to_s
|
272
272
|
file_content = nil
|
273
273
|
full_filename = File.expand_path(options[:config_file])
|
274
|
-
if File.
|
274
|
+
if File.exist?(full_filename)
|
275
275
|
file_content = File.read(full_filename)
|
276
276
|
else
|
277
277
|
print_red_alert "File not found: #{full_filename}"
|
@@ -281,7 +281,7 @@ EOT
|
|
281
281
|
config_map = parse_result[:data]
|
282
282
|
if config_map.nil?
|
283
283
|
# todo: bubble up JSON.parse error message
|
284
|
-
raise_command_error "Failed to parse config as YAML or JSON. Error: #{parse_result[:
|
284
|
+
raise_command_error "Failed to parse config as YAML or JSON. Error: #{parse_result[:error]}"
|
285
285
|
#raise_command_error "Failed to parse config as valid YAML or JSON."
|
286
286
|
else
|
287
287
|
params['config'] = config_map
|
@@ -345,7 +345,7 @@ EOT
|
|
345
345
|
config_map = parse_result[:data]
|
346
346
|
if config_map.nil?
|
347
347
|
# todo: bubble up JSON.parse error message
|
348
|
-
raise_command_error "Failed to parse config as YAML or JSON. Error: #{parse_result[:
|
348
|
+
raise_command_error "Failed to parse config as YAML or JSON. Error: #{parse_result[:error]}"
|
349
349
|
#raise_command_error "Failed to parse config as valid YAML or JSON."
|
350
350
|
else
|
351
351
|
params['config'] = config_map
|
@@ -405,7 +405,7 @@ EOT
|
|
405
405
|
logo_file = 'null' # clear it
|
406
406
|
else
|
407
407
|
filename = File.expand_path(filename)
|
408
|
-
if !File.
|
408
|
+
if !File.exist?(filename)
|
409
409
|
raise_command_error "File not found: #{filename}"
|
410
410
|
end
|
411
411
|
logo_file = File.new(filename, 'rb')
|
@@ -418,7 +418,7 @@ EOT
|
|
418
418
|
dark_logo_file = 'null' # clear it
|
419
419
|
else
|
420
420
|
filename = File.expand_path(filename)
|
421
|
-
if !File.
|
421
|
+
if !File.exist?(filename)
|
422
422
|
raise_command_error "File not found: #{filename}"
|
423
423
|
end
|
424
424
|
dark_logo_file = File.new(filename, 'rb')
|
@@ -428,7 +428,7 @@ EOT
|
|
428
428
|
options[:config_file] = val.to_s
|
429
429
|
file_content = nil
|
430
430
|
full_filename = File.expand_path(options[:config_file])
|
431
|
-
if File.
|
431
|
+
if File.exist?(full_filename)
|
432
432
|
file_content = File.read(full_filename)
|
433
433
|
else
|
434
434
|
print_red_alert "File not found: #{full_filename}"
|
@@ -438,7 +438,7 @@ EOT
|
|
438
438
|
config_map = parse_result[:data]
|
439
439
|
if config_map.nil?
|
440
440
|
# todo: bubble up JSON.parse error message
|
441
|
-
raise_command_error "Failed to parse config as YAML or JSON. Error: #{parse_result[:
|
441
|
+
raise_command_error "Failed to parse config as YAML or JSON. Error: #{parse_result[:error]}"
|
442
442
|
#raise_command_error "Failed to parse config as valid YAML or JSON."
|
443
443
|
else
|
444
444
|
params['config'] = config_map
|
@@ -495,7 +495,7 @@ EOT
|
|
495
495
|
config_map = parse_result[:data]
|
496
496
|
if config_map.nil?
|
497
497
|
# todo: bubble up JSON.parse error message
|
498
|
-
raise_command_error "Failed to parse config as YAML or JSON. Error: #{parse_result[:
|
498
|
+
raise_command_error "Failed to parse config as YAML or JSON. Error: #{parse_result[:error]}"
|
499
499
|
#raise_command_error "Failed to parse config as valid YAML or JSON."
|
500
500
|
else
|
501
501
|
params['config'] = config_map
|
@@ -564,7 +564,7 @@ EOT
|
|
564
564
|
logo_file = 'null' # clear it
|
565
565
|
else
|
566
566
|
filename = File.expand_path(filename)
|
567
|
-
if !File.
|
567
|
+
if !File.exist?(filename)
|
568
568
|
raise_command_error "File not found: #{filename}"
|
569
569
|
end
|
570
570
|
logo_file = File.new(filename, 'rb')
|
@@ -603,7 +603,7 @@ EOT
|
|
603
603
|
dark_logo_file = 'null' # clear it
|
604
604
|
else
|
605
605
|
filename = File.expand_path(filename)
|
606
|
-
if !File.
|
606
|
+
if !File.exist?(filename)
|
607
607
|
raise_command_error "File not found: #{filename}"
|
608
608
|
end
|
609
609
|
dark_logo_file = File.new(filename, 'rb')
|
@@ -660,6 +660,8 @@ EOT
|
|
660
660
|
"Labels" => lambda {|it| format_list(it['labels'], '', 3) },
|
661
661
|
"Description" => 'description',
|
662
662
|
"Type" => lambda {|it| format_catalog_type(it) },
|
663
|
+
"Visibility" => 'visibility',
|
664
|
+
"Layout Code" => 'layoutCode',
|
663
665
|
"Blueprint" => lambda {|it| it['blueprint'] ? it['blueprint']['name'] : nil },
|
664
666
|
"Workflow" => lambda {|it| it['workflow'] ? it['workflow']['name'] : nil },
|
665
667
|
"Context" => lambda {|it| it['context'] },
|
@@ -679,6 +681,8 @@ EOT
|
|
679
681
|
"Labels" => lambda {|it| format_list(it['labels']) },
|
680
682
|
"Description" => 'description',
|
681
683
|
"Type" => lambda {|it| format_catalog_type(it) },
|
684
|
+
"Visibility" => 'visibility',
|
685
|
+
"Layout Code" => 'layoutCode',
|
682
686
|
"Blueprint" => lambda {|it| it['blueprint'] ? it['blueprint']['name'] : nil },
|
683
687
|
"Workflow" => lambda {|it| it['workflow'] ? it['workflow']['name'] : nil },
|
684
688
|
"Context" => lambda {|it| it['context'] },
|
@@ -725,7 +729,8 @@ EOT
|
|
725
729
|
{'fieldName' => 'enabled', 'fieldLabel' => 'Enabled', 'type' => 'checkbox', 'defaultValue' => true, 'displayOrder' => 4},
|
726
730
|
{'fieldName' => 'featured', 'fieldLabel' => 'Featured', 'type' => 'checkbox', 'defaultValue' => false, 'displayOrder' => 5},
|
727
731
|
{'fieldName' => 'visibility', 'fieldLabel' => 'Visibility', 'type' => 'select', 'selectOptions' => [{'name' => 'Private', 'value' => 'private'}, {'name' => 'Public', 'value' => 'public'}], 'defaultValue' => 'private', 'required' => true, 'displayOrder' => 6},
|
728
|
-
{'fieldName' => '
|
732
|
+
{'fieldName' => 'layoutCode', 'fieldLabel' => 'Layout Code', 'type' => 'text', 'required' => false, 'displayOrder' => 7},
|
733
|
+
{'fieldName' => 'iconPath', 'fieldLabel' => 'Logo', 'type' => 'select', 'optionSource' => 'iconList', 'displayOrder' => 8},
|
729
734
|
#{'fieldName' => 'optionTypes', 'fieldLabel' => 'Option Types', 'type' => 'text', 'description' => 'Option Types to include, comma separated list of names or IDs.', 'displayOrder' => 8},
|
730
735
|
{'dependsOnCode' => 'catalogItemType.type:instance', 'fieldName' => 'config', 'fieldLabel' => 'Config', 'type' => 'code-editor', 'description' => 'JSON or YAML', 'required' => true, 'displayOrder' => 9},
|
731
736
|
{'dependsOnCode' => 'catalogItemType.type:blueprint', 'fieldName' => 'blueprint', 'fieldLabel' => 'Blueprint', 'type' => 'select', 'optionSource' => 'blueprints', 'description' => 'Choose a blueprint to apply to the catalog item.', 'required' => true, 'noParams' => true, 'displayOrder' => 10},
|
@@ -891,7 +891,7 @@ class Morpheus::Cli::Clouds
|
|
891
891
|
build_option_type_options(opts, options, update_wiki_page_option_types)
|
892
892
|
opts.on('--file FILE', "File containing the wiki content. This can be used instead of --content") do |filename|
|
893
893
|
full_filename = File.expand_path(filename)
|
894
|
-
if File.
|
894
|
+
if File.exist?(full_filename)
|
895
895
|
params['content'] = File.read(full_filename)
|
896
896
|
else
|
897
897
|
print_red_alert "File not found: #{full_filename}"
|
@@ -987,7 +987,7 @@ EOT
|
|
987
987
|
logo_file = 'null' # clear it
|
988
988
|
else
|
989
989
|
filename = File.expand_path(filename)
|
990
|
-
if !File.
|
990
|
+
if !File.exist?(filename)
|
991
991
|
print_red_alert "File not found: #{filename}"
|
992
992
|
exit 1
|
993
993
|
end
|
@@ -1037,7 +1037,7 @@ EOT
|
|
1037
1037
|
dark_logo_file = 'null' # clear it
|
1038
1038
|
else
|
1039
1039
|
filename = File.expand_path(filename)
|
1040
|
-
if !File.
|
1040
|
+
if !File.exist?(filename)
|
1041
1041
|
print_red_alert "File not found: #{filename}"
|
1042
1042
|
exit 1
|
1043
1043
|
end
|