morpheus-cli 3.3.2.2 → 3.3.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/morpheus/cli.rb +16 -0
- data/lib/morpheus/cli/alias_command.rb +1 -1
- data/lib/morpheus/cli/cli_command.rb +3 -0
- data/lib/morpheus/cli/edit_profile_command.rb +46 -0
- data/lib/morpheus/cli/edit_rc_command.rb +61 -0
- data/lib/morpheus/cli/instances.rb +34 -32
- data/lib/morpheus/cli/library_container_scripts_command.rb +4 -4
- data/lib/morpheus/cli/library_container_templates_command.rb +2 -2
- data/lib/morpheus/cli/login.rb +1 -1
- data/lib/morpheus/cli/logout.rb +1 -1
- data/lib/morpheus/cli/man_command.rb +2 -7
- data/lib/morpheus/cli/option_parser.rb +28 -2
- data/lib/morpheus/cli/power_scheduling_command.rb +12 -13
- data/lib/morpheus/cli/remote.rb +3 -3
- data/lib/morpheus/cli/shell.rb +146 -52
- data/lib/morpheus/cli/tasks.rb +124 -36
- data/lib/morpheus/cli/version.rb +1 -1
- data/lib/morpheus/cli/workflows.rb +79 -45
- data/lib/morpheus/formatters.rb +2 -2
- data/lib/morpheus/terminal.rb +18 -5
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8701d670a60da80458ef5dc574852c5dc070c7e
|
4
|
+
data.tar.gz: 8b7f01e73bcdc238668b4d643c5976ded6956c2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31882e7b1280de15565ca180788d404dafbfe2b811a42c03c3006466d3f0d25b5ec24fb4cab5ec978b9e78eec2c4c6835463b059e57c957cf308d96f6c0ee3e3
|
7
|
+
data.tar.gz: 5bfc0364301f53166c3e70f56b9fa16304bf44aa69b75ac750c9a908520fff6f035386799327c06af998cdcd2593b746901aed28e35c284ab4ec8d7a4e6b955b
|
data/lib/morpheus/cli.rb
CHANGED
@@ -25,6 +25,20 @@ module Morpheus
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
+
def self.windows?
|
29
|
+
if defined?(@@is_windows)
|
30
|
+
return @@is_windows
|
31
|
+
end
|
32
|
+
@@is_windows = false
|
33
|
+
begin
|
34
|
+
require 'rbconfig'
|
35
|
+
@@is_windows = (RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/)
|
36
|
+
rescue => ex
|
37
|
+
# $stderr.puts "unable to determine if this is a Windows machine."
|
38
|
+
end
|
39
|
+
return @@is_windows
|
40
|
+
end
|
41
|
+
|
28
42
|
# load all the well known commands and utilties they need
|
29
43
|
def self.load!()
|
30
44
|
# load interfaces
|
@@ -53,6 +67,8 @@ module Morpheus
|
|
53
67
|
load 'morpheus/cli/coloring_command.rb'
|
54
68
|
load 'morpheus/cli/log_level_command.rb'
|
55
69
|
load 'morpheus/cli/ssl_verification_command.rb'
|
70
|
+
load 'morpheus/cli/edit_profile_command.rb'
|
71
|
+
load 'morpheus/cli/edit_rc_command.rb'
|
56
72
|
|
57
73
|
# all the known commands
|
58
74
|
load 'morpheus/cli/remote.rb'
|
@@ -389,6 +389,8 @@ module Morpheus
|
|
389
389
|
options[:format] = :json
|
390
390
|
options[:pretty_json] = false
|
391
391
|
end
|
392
|
+
|
393
|
+
opts.add_hidden_option('json-raw') if opts.is_a?(Morpheus::Cli::OptionParser)
|
392
394
|
|
393
395
|
when :yaml
|
394
396
|
opts.on(nil, '--yaml', "YAML Output") do
|
@@ -477,6 +479,7 @@ module Morpheus
|
|
477
479
|
puts opts
|
478
480
|
exit
|
479
481
|
end
|
482
|
+
|
480
483
|
opts
|
481
484
|
end
|
482
485
|
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'morpheus/cli/cli_command'
|
2
|
+
require 'term/ansicolor'
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
# Command for editing the .morpheus_profile initalization script
|
6
|
+
class Morpheus::Cli::EditProfileCommand
|
7
|
+
include Morpheus::Cli::CliCommand
|
8
|
+
set_command_name :'edit-profile'
|
9
|
+
#set_command_hidden
|
10
|
+
|
11
|
+
def handle(args)
|
12
|
+
options = {}
|
13
|
+
editor = ENV['EDITOR'] || 'nano'
|
14
|
+
filename = Morpheus::Cli::DotFile.morpheus_profile_filename
|
15
|
+
optparse = Morpheus::Cli::OptionParser.new do|opts|
|
16
|
+
opts.banner = "Usage: morpheus #{command_name}"
|
17
|
+
opts.on( '-e', '--editor PROGRAM', "Editor program to use. The default is $EDITOR." ) do |val|
|
18
|
+
editor = val
|
19
|
+
end
|
20
|
+
build_common_options(opts, options, [])
|
21
|
+
opts.footer = "Edit your interactive shell script at #{filename}"
|
22
|
+
end
|
23
|
+
optparse.parse!(args)
|
24
|
+
|
25
|
+
if !editor
|
26
|
+
print_error Morpheus::Terminal.angry_prompt
|
27
|
+
puts_error "You have not defined an EDITOR."
|
28
|
+
puts_error "Try export EDITOR=emacs"
|
29
|
+
#puts "Trying nano..."
|
30
|
+
#editor = "nano"
|
31
|
+
return 1
|
32
|
+
end
|
33
|
+
puts "opening #{filename} for editing"
|
34
|
+
system(editor, filename)
|
35
|
+
if !$?.success?
|
36
|
+
print_error Morpheus::Terminal.angry_prompt
|
37
|
+
puts_error "edit command failed with #{$?.exitstatus}: #{editor} #{filename}"
|
38
|
+
return $?.exitstatus
|
39
|
+
end
|
40
|
+
if Morpheus::Cli::Shell.has_instance?
|
41
|
+
puts "use 'reload' to re-execute your startup script"
|
42
|
+
end
|
43
|
+
return 0 # $?
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'morpheus/cli/cli_command'
|
2
|
+
require 'term/ansicolor'
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
# Command for editing the .morpheus_profile initalization script
|
6
|
+
class Morpheus::Cli::EditRcCommand
|
7
|
+
include Morpheus::Cli::CliCommand
|
8
|
+
set_command_name :'edit-rc'
|
9
|
+
#set_command_hidden
|
10
|
+
|
11
|
+
def handle(args)
|
12
|
+
options = {}
|
13
|
+
editor = nil
|
14
|
+
filename = Morpheus::Cli::DotFile.morpheusrc_filename
|
15
|
+
optparse = Morpheus::Cli::OptionParser.new do|opts|
|
16
|
+
opts.banner = "Usage: morpheus #{command_name}"
|
17
|
+
opts.on( '-e', '--editor PROGRAM', "Editor program to use. The default is $EDITOR." ) do |val|
|
18
|
+
editor = val.gsub("'",'')
|
19
|
+
end
|
20
|
+
build_common_options(opts, options, [])
|
21
|
+
opts.footer = "Edit your morpheus initialization script at #{filename}"
|
22
|
+
end
|
23
|
+
optparse.parse!(args)
|
24
|
+
|
25
|
+
|
26
|
+
if !editor
|
27
|
+
editor = ENV['EDITOR']
|
28
|
+
end
|
29
|
+
|
30
|
+
# try something...
|
31
|
+
if !editor
|
32
|
+
if Morpheus::Cli.windows?
|
33
|
+
editor = "notepad"
|
34
|
+
else
|
35
|
+
editor = "nano"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
if !editor
|
40
|
+
print_error Morpheus::Terminal.angry_prompt
|
41
|
+
puts_error "You have not defined an EDITOR."
|
42
|
+
puts_error "Try export EDITOR=emacs"
|
43
|
+
#puts "Trying nano..."
|
44
|
+
#editor = "nano"
|
45
|
+
return 1
|
46
|
+
end
|
47
|
+
has_editor = true
|
48
|
+
puts "opening #{filename} for editing"
|
49
|
+
system(editor, filename)
|
50
|
+
if !$?.success?
|
51
|
+
print_error Morpheus::Terminal.angry_prompt
|
52
|
+
puts_error "edit command failed with #{$?.exitstatus}: #{editor} #{filename}"
|
53
|
+
return $?.exitstatus
|
54
|
+
end
|
55
|
+
if Morpheus::Cli::Shell.has_instance?
|
56
|
+
puts "use 'reload' to re-execute your startup script"
|
57
|
+
end
|
58
|
+
return 0 # $?
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
@@ -208,7 +208,7 @@ class Morpheus::Cli::Instances
|
|
208
208
|
|
209
209
|
def add(args)
|
210
210
|
options = {}
|
211
|
-
optparse = OptionParser.new do|opts|
|
211
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
212
212
|
# opts.banner = subcommand_usage("[type] [name]")
|
213
213
|
opts.banner = subcommand_usage("[name] -c CLOUD -t TYPE")
|
214
214
|
opts.on( '-g', '--group GROUP', "Group Name or ID" ) do |val|
|
@@ -323,7 +323,7 @@ class Morpheus::Cli::Instances
|
|
323
323
|
def update(args)
|
324
324
|
usage = "Usage: morpheus instances update [name] [options]"
|
325
325
|
options = {}
|
326
|
-
optparse = OptionParser.new do|opts|
|
326
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
327
327
|
opts.banner = subcommand_usage("[name]")
|
328
328
|
build_common_options(opts, options, [:options, :json, :dry_run, :remote])
|
329
329
|
end
|
@@ -384,7 +384,7 @@ class Morpheus::Cli::Instances
|
|
384
384
|
def status_check(args)
|
385
385
|
out = ""
|
386
386
|
options = {}
|
387
|
-
optparse = OptionParser.new do|opts|
|
387
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
388
388
|
opts.banner = subcommand_usage("[name]")
|
389
389
|
build_common_options(opts, options, [:quiet, :json, :remote]) # no :dry_run, just do it man
|
390
390
|
end
|
@@ -416,7 +416,7 @@ class Morpheus::Cli::Instances
|
|
416
416
|
|
417
417
|
def stats(args)
|
418
418
|
options = {}
|
419
|
-
optparse = OptionParser.new do|opts|
|
419
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
420
420
|
opts.banner = subcommand_usage("[name]")
|
421
421
|
build_common_options(opts, options, [:json, :yaml, :csv, :fields, :dry_run, :remote])
|
422
422
|
end
|
@@ -469,7 +469,7 @@ class Morpheus::Cli::Instances
|
|
469
469
|
|
470
470
|
def console(args)
|
471
471
|
options = {}
|
472
|
-
optparse = OptionParser.new do|opts|
|
472
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
473
473
|
opts.banner = subcommand_usage("[name]")
|
474
474
|
opts.on( '-n', '--node NODE_ID', "Scope console to specific Container or VM" ) do |node_id|
|
475
475
|
options[:node_id] = node_id.to_i
|
@@ -506,7 +506,7 @@ class Morpheus::Cli::Instances
|
|
506
506
|
|
507
507
|
def logs(args)
|
508
508
|
options = {}
|
509
|
-
optparse = OptionParser.new do|opts|
|
509
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
510
510
|
opts.banner = subcommand_usage("[name]")
|
511
511
|
opts.on( '-n', '--node NODE_ID', "Scope logs to specific Container or VM" ) do |node_id|
|
512
512
|
options[:node_id] = node_id.to_i
|
@@ -576,7 +576,7 @@ class Morpheus::Cli::Instances
|
|
576
576
|
|
577
577
|
def get(args)
|
578
578
|
options = {}
|
579
|
-
optparse = OptionParser.new do|opts|
|
579
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
580
580
|
opts.banner = subcommand_usage("[name]")
|
581
581
|
opts.on( nil, '--containers', "Display Instance Containers" ) do
|
582
582
|
options[:include_containers] = true
|
@@ -788,7 +788,7 @@ class Morpheus::Cli::Instances
|
|
788
788
|
|
789
789
|
def list_containers(args)
|
790
790
|
options = {}
|
791
|
-
optparse = OptionParser.new do|opts|
|
791
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
792
792
|
opts.banner = subcommand_usage("[name]")
|
793
793
|
build_common_options(opts, options, [:json, :yaml, :csv, :fields, :dry_run, :remote])
|
794
794
|
end
|
@@ -883,7 +883,7 @@ class Morpheus::Cli::Instances
|
|
883
883
|
|
884
884
|
def backups(args)
|
885
885
|
options = {}
|
886
|
-
optparse = OptionParser.new do|opts|
|
886
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
887
887
|
opts.banner = subcommand_usage("[name]")
|
888
888
|
build_common_options(opts, options, [:auto_confirm, :json, :dry_run, :remote])
|
889
889
|
end
|
@@ -927,7 +927,7 @@ class Morpheus::Cli::Instances
|
|
927
927
|
|
928
928
|
def clone(args)
|
929
929
|
options = {}
|
930
|
-
optparse = OptionParser.new do|opts|
|
930
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
931
931
|
opts.banner = subcommand_usage("[name] -g GROUP")
|
932
932
|
build_option_type_options(opts, options, clone_instance_option_types(false))
|
933
933
|
opts.on( '-g', '--group GROUP', "Group Name or ID for the new instance" ) do |val|
|
@@ -987,7 +987,7 @@ class Morpheus::Cli::Instances
|
|
987
987
|
|
988
988
|
def envs(args)
|
989
989
|
options = {}
|
990
|
-
optparse = OptionParser.new do|opts|
|
990
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
991
991
|
opts.banner = subcommand_usage("[name]")
|
992
992
|
build_common_options(opts, options, [:json, :dry_run, :remote])
|
993
993
|
end
|
@@ -1028,7 +1028,7 @@ class Morpheus::Cli::Instances
|
|
1028
1028
|
def setenv(args)
|
1029
1029
|
options = {}
|
1030
1030
|
|
1031
|
-
optparse = OptionParser.new do|opts|
|
1031
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
1032
1032
|
opts.banner = subcommand_usage("[name] VAR VALUE [-e]")
|
1033
1033
|
opts.on( '-e', "Exportable" ) do |exportable|
|
1034
1034
|
options[:export] = exportable
|
@@ -1068,7 +1068,7 @@ class Morpheus::Cli::Instances
|
|
1068
1068
|
|
1069
1069
|
def delenv(args)
|
1070
1070
|
options = {}
|
1071
|
-
optparse = OptionParser.new do|opts|
|
1071
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
1072
1072
|
opts.banner = subcommand_usage("[name] VAR")
|
1073
1073
|
build_common_options(opts, options, [:json, :dry_run, :remote])
|
1074
1074
|
end
|
@@ -1101,7 +1101,7 @@ class Morpheus::Cli::Instances
|
|
1101
1101
|
def stop(args)
|
1102
1102
|
params = {'server' => true, 'muteMonitoring' => false}
|
1103
1103
|
options = {}
|
1104
|
-
optparse = OptionParser.new do|opts|
|
1104
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
1105
1105
|
opts.banner = subcommand_usage("[name]")
|
1106
1106
|
opts.on('--muteMonitoring [on|off]', String, "Mute monitoring. Default is off.") do |val|
|
1107
1107
|
params['muteMonitoring'] = val.nil? || val.to_s == 'on' || val.to_s == 'true'
|
@@ -1139,7 +1139,7 @@ class Morpheus::Cli::Instances
|
|
1139
1139
|
def start(args)
|
1140
1140
|
params = {'server' => true}
|
1141
1141
|
options = {}
|
1142
|
-
optparse = OptionParser.new do|opts|
|
1142
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
1143
1143
|
opts.banner = subcommand_usage("[name]")
|
1144
1144
|
build_common_options(opts, options, [:json, :dry_run, :remote])
|
1145
1145
|
end
|
@@ -1172,7 +1172,7 @@ class Morpheus::Cli::Instances
|
|
1172
1172
|
def restart(args)
|
1173
1173
|
params = {'server' => true, 'muteMonitoring' => true}
|
1174
1174
|
options = {}
|
1175
|
-
optparse = OptionParser.new do|opts|
|
1175
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
1176
1176
|
opts.banner = subcommand_usage("[name]")
|
1177
1177
|
opts.on('--muteMonitoring [on|off]', String, "Mute monitoring. Default is on.") do |val|
|
1178
1178
|
params['muteMonitoring'] = val.nil? || val.to_s == 'on' || val.to_s == 'true'
|
@@ -1210,7 +1210,7 @@ class Morpheus::Cli::Instances
|
|
1210
1210
|
def suspend(args)
|
1211
1211
|
params = {'server' => true, 'muteMonitoring' => false}
|
1212
1212
|
options = {}
|
1213
|
-
optparse = OptionParser.new do|opts|
|
1213
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
1214
1214
|
opts.banner = subcommand_usage("[name]")
|
1215
1215
|
opts.on('--muteMonitoring [on|off]', String, "Mute monitoring. Default is off.") do |val|
|
1216
1216
|
params['muteMonitoring'] = val.nil? || val.to_s == 'on' || val.to_s == 'true'
|
@@ -1246,7 +1246,7 @@ class Morpheus::Cli::Instances
|
|
1246
1246
|
def eject(args)
|
1247
1247
|
params = {'server' => true}
|
1248
1248
|
options = {}
|
1249
|
-
optparse = OptionParser.new do|opts|
|
1249
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
1250
1250
|
opts.banner = subcommand_usage("[name]")
|
1251
1251
|
build_common_options(opts, options, [:auto_confirm, :quiet, :json, :dry_run, :remote])
|
1252
1252
|
end
|
@@ -1279,7 +1279,7 @@ class Morpheus::Cli::Instances
|
|
1279
1279
|
def stop_service(args)
|
1280
1280
|
params = {'server' => false, 'muteMonitoring' => false}
|
1281
1281
|
options = {}
|
1282
|
-
optparse = OptionParser.new do|opts|
|
1282
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
1283
1283
|
opts.banner = subcommand_usage("[name]")
|
1284
1284
|
opts.on('--muteMonitoring [on|off]', String, "Mute monitoring. Default is off.") do |val|
|
1285
1285
|
params['muteMonitoring'] = val.nil? || val.to_s == 'on' || val.to_s == 'true'
|
@@ -1317,7 +1317,7 @@ class Morpheus::Cli::Instances
|
|
1317
1317
|
def start_service(args)
|
1318
1318
|
params = {'server' => true}
|
1319
1319
|
options = {}
|
1320
|
-
optparse = OptionParser.new do|opts|
|
1320
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
1321
1321
|
opts.banner = subcommand_usage("[name]")
|
1322
1322
|
build_common_options(opts, options, [:quiet, :json, :dry_run, :remote])
|
1323
1323
|
end
|
@@ -1348,7 +1348,7 @@ class Morpheus::Cli::Instances
|
|
1348
1348
|
def restart_service(args)
|
1349
1349
|
params = {'server' => false, 'muteMonitoring' => true}
|
1350
1350
|
options = {}
|
1351
|
-
optparse = OptionParser.new do|opts|
|
1351
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
1352
1352
|
opts.banner = subcommand_usage("[name]")
|
1353
1353
|
opts.on('--muteMonitoring [on|off]', String, "Mute monitoring. Default is on.") do |val|
|
1354
1354
|
params['muteMonitoring'] = val.nil? || val.to_s == 'on' || val.to_s == 'true'
|
@@ -1527,7 +1527,7 @@ class Morpheus::Cli::Instances
|
|
1527
1527
|
|
1528
1528
|
def resize(args)
|
1529
1529
|
options = {}
|
1530
|
-
optparse = OptionParser.new do|opts|
|
1530
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
1531
1531
|
opts.banner = subcommand_usage("[name]")
|
1532
1532
|
build_common_options(opts, options, [:options, :json, :dry_run, :remote])
|
1533
1533
|
end
|
@@ -1603,7 +1603,7 @@ class Morpheus::Cli::Instances
|
|
1603
1603
|
|
1604
1604
|
def backup(args)
|
1605
1605
|
options = {}
|
1606
|
-
optparse = OptionParser.new do|opts|
|
1606
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
1607
1607
|
opts.banner = subcommand_usage("[name]")
|
1608
1608
|
build_common_options(opts, options, [:auto_confirm, :json, :dry_run, :remote])
|
1609
1609
|
end
|
@@ -1639,7 +1639,7 @@ class Morpheus::Cli::Instances
|
|
1639
1639
|
def remove(args)
|
1640
1640
|
options = {}
|
1641
1641
|
query_params = {keepBackups: 'off', force: 'off'}
|
1642
|
-
optparse = OptionParser.new do|opts|
|
1642
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
1643
1643
|
opts.banner = subcommand_usage("[name] [-fB]")
|
1644
1644
|
opts.on( '-f', '--force', "Force Delete" ) do
|
1645
1645
|
query_params[:force] = 'on'
|
@@ -1687,7 +1687,7 @@ class Morpheus::Cli::Instances
|
|
1687
1687
|
|
1688
1688
|
def firewall_disable(args)
|
1689
1689
|
options = {}
|
1690
|
-
optparse = OptionParser.new do|opts|
|
1690
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
1691
1691
|
opts.banner = subcommand_usage("[name]")
|
1692
1692
|
build_common_options(opts, options, [:json, :dry_run, :quiet, :remote])
|
1693
1693
|
end
|
@@ -1718,7 +1718,7 @@ class Morpheus::Cli::Instances
|
|
1718
1718
|
|
1719
1719
|
def firewall_enable(args)
|
1720
1720
|
options = {}
|
1721
|
-
optparse = OptionParser.new do|opts|
|
1721
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
1722
1722
|
opts.banner = subcommand_usage("[name]")
|
1723
1723
|
build_common_options(opts, options, [:json, :dry_run, :quiet, :remote])
|
1724
1724
|
end
|
@@ -1749,7 +1749,7 @@ class Morpheus::Cli::Instances
|
|
1749
1749
|
|
1750
1750
|
def security_groups(args)
|
1751
1751
|
options = {}
|
1752
|
-
optparse = OptionParser.new do|opts|
|
1752
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
1753
1753
|
opts.banner = subcommand_usage("[name]")
|
1754
1754
|
build_common_options(opts, options, [:json, :dry_run, :remote])
|
1755
1755
|
end
|
@@ -1796,7 +1796,7 @@ class Morpheus::Cli::Instances
|
|
1796
1796
|
options = {}
|
1797
1797
|
security_group_ids = nil
|
1798
1798
|
clear_or_secgroups_specified = false
|
1799
|
-
optparse = OptionParser.new do|opts|
|
1799
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
1800
1800
|
opts.banner = subcommand_usage("[name] [-S] [-c]")
|
1801
1801
|
opts.on( '-S', '--secgroups SECGROUPS', "Apply the specified comma separated security group ids" ) do |secgroups|
|
1802
1802
|
security_group_ids = secgroups.split(",")
|
@@ -1842,7 +1842,7 @@ class Morpheus::Cli::Instances
|
|
1842
1842
|
|
1843
1843
|
def run_workflow(args)
|
1844
1844
|
options = {}
|
1845
|
-
optparse = OptionParser.new do|opts|
|
1845
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
1846
1846
|
opts.banner = subcommand_usage("[name] [workflow] [options]")
|
1847
1847
|
build_common_options(opts, options, [:options, :json, :dry_run, :remote])
|
1848
1848
|
end
|
@@ -1867,7 +1867,8 @@ class Morpheus::Cli::Instances
|
|
1867
1867
|
end
|
1868
1868
|
end
|
1869
1869
|
end
|
1870
|
-
params =
|
1870
|
+
params = {}
|
1871
|
+
params.deep_merge!(options[:options].reject {|k,v| k.is_a?(Symbol) }) if options[:options]
|
1871
1872
|
|
1872
1873
|
if params.empty? && !editable_options.empty?
|
1873
1874
|
puts optparse
|
@@ -1887,8 +1888,9 @@ class Morpheus::Cli::Instances
|
|
1887
1888
|
print as_json(json_response, options), "\n"
|
1888
1889
|
return
|
1889
1890
|
else
|
1890
|
-
|
1891
|
+
print_green_success "Running workflow #{workflow['name']} on instance #{instance['name']} ..."
|
1891
1892
|
end
|
1893
|
+
return 0
|
1892
1894
|
rescue RestClient::Exception => e
|
1893
1895
|
print_rest_exception(e, options)
|
1894
1896
|
exit 1
|
@@ -1898,7 +1900,7 @@ class Morpheus::Cli::Instances
|
|
1898
1900
|
def import_snapshot(args)
|
1899
1901
|
options = {}
|
1900
1902
|
storage_provider_id = nil
|
1901
|
-
optparse = OptionParser.new do|opts|
|
1903
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
1902
1904
|
opts.banner = subcommand_usage("[name]")
|
1903
1905
|
opts.on("--storage-provider ID", String, "Optional storage provider") do |val|
|
1904
1906
|
storage_provider_id = val
|