morpheus-cli 3.6.38 → 4.0.0
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 +8 -0
- data/lib/morpheus/api/network_domain_records_interface.rb +47 -0
- data/lib/morpheus/api/network_pool_ips_interface.rb +47 -0
- data/lib/morpheus/cli/apps.rb +70 -15
- data/lib/morpheus/cli/cli_command.rb +36 -24
- data/lib/morpheus/cli/containers_command.rb +4 -3
- data/lib/morpheus/cli/execution_request_command.rb +3 -2
- data/lib/morpheus/cli/file_copy_request_command.rb +3 -3
- data/lib/morpheus/cli/hosts.rb +154 -30
- data/lib/morpheus/cli/instances.rb +16 -8
- data/lib/morpheus/cli/mixins/print_helper.rb +84 -26
- data/lib/morpheus/cli/mixins/provisioning_helper.rb +99 -33
- data/lib/morpheus/cli/network_domains_command.rb +338 -0
- data/lib/morpheus/cli/network_pools_command.rb +376 -4
- data/lib/morpheus/cli/option_parser.rb +2 -2
- data/lib/morpheus/cli/reports_command.rb +3 -3
- data/lib/morpheus/cli/version.rb +1 -1
- data/lib/morpheus/cli/wiki_command.rb +0 -3
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bca59b88ea028739f7cb9d7484a2c48c23603bbd804fb72226297c976cc498e3
|
4
|
+
data.tar.gz: 843cf1f628ddc9f1c090243edccc5c43bd978c2df802be2a3fbea4a395919ff2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4ae8a45df624e4a89d0c29cd12649e2d3c752e243aff2bb919c3542fa70ba4d144a8da403e77d050c1b41885aa254901ebe6e99a2c69753d6d826e8e49be104
|
7
|
+
data.tar.gz: c69d3d7b235e1ca9178fb583858a317b6a64ea66bba115df28a1527aa3c45b75ba0318cd42c5fcd528c920e06773fe6fc7d5a55cf086cad2e3e977e6f7ecae77
|
@@ -390,6 +390,10 @@ class Morpheus::APIClient
|
|
390
390
|
Morpheus::NetworkPoolsInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
|
391
391
|
end
|
392
392
|
|
393
|
+
def network_pool_ips
|
394
|
+
Morpheus::NetworkPoolIpsInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
|
395
|
+
end
|
396
|
+
|
393
397
|
def network_services
|
394
398
|
Morpheus::NetworkServicesInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
|
395
399
|
end
|
@@ -402,6 +406,10 @@ class Morpheus::APIClient
|
|
402
406
|
Morpheus::NetworkDomainsInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
|
403
407
|
end
|
404
408
|
|
409
|
+
def network_domain_records
|
410
|
+
Morpheus::NetworkDomainRecordsInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
|
411
|
+
end
|
412
|
+
|
405
413
|
def network_proxies
|
406
414
|
Morpheus::NetworkProxiesInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
|
407
415
|
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'morpheus/api/api_client'
|
2
|
+
|
3
|
+
class Morpheus::NetworkDomainRecordsInterface < Morpheus::APIClient
|
4
|
+
def initialize(access_token, refresh_token,expires_at = nil, base_url=nil)
|
5
|
+
@access_token = access_token
|
6
|
+
@refresh_token = refresh_token
|
7
|
+
@base_url = base_url
|
8
|
+
@expires_at = expires_at
|
9
|
+
end
|
10
|
+
|
11
|
+
def get(domain_id, id, params={})
|
12
|
+
raise "#{self.class}.get() passed a blank id!" if id.to_s == ''
|
13
|
+
url = "#{@base_url}/api/networks/domains/#{domain_id}/records/#{id}"
|
14
|
+
headers = { params: params, authorization: "Bearer #{@access_token}" }
|
15
|
+
opts = {method: :get, url: url, headers: headers}
|
16
|
+
execute(opts)
|
17
|
+
end
|
18
|
+
|
19
|
+
def list(domain_id, params={})
|
20
|
+
url = "#{@base_url}/api/networks/domains/#{domain_id}/records"
|
21
|
+
headers = { params: params, authorization: "Bearer #{@access_token}" }
|
22
|
+
opts = {method: :get, url: url, headers: headers}
|
23
|
+
execute(opts)
|
24
|
+
end
|
25
|
+
|
26
|
+
def create(domain_id, payload)
|
27
|
+
url = "#{@base_url}/api/networks/domains/#{domain_id}/records"
|
28
|
+
headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
|
29
|
+
opts = {method: :post, url: url, headers: headers, payload: payload.to_json}
|
30
|
+
execute(opts)
|
31
|
+
end
|
32
|
+
|
33
|
+
def update(domain_id, id, payload)
|
34
|
+
url = "#{@base_url}/api/networks/domains/#{domain_id}/records/#{id}"
|
35
|
+
headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
|
36
|
+
opts = {method: :put, url: url, headers: headers, payload: payload.to_json}
|
37
|
+
execute(opts)
|
38
|
+
end
|
39
|
+
|
40
|
+
def destroy(domain_id, id, params={})
|
41
|
+
url = "#{@base_url}/api/networks/domains/#{domain_id}/records/#{id}"
|
42
|
+
headers = { :params => params, :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
|
43
|
+
opts = {method: :delete, url: url, headers: headers}
|
44
|
+
execute(opts)
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'morpheus/api/api_client'
|
2
|
+
|
3
|
+
class Morpheus::NetworkPoolIpsInterface < Morpheus::APIClient
|
4
|
+
def initialize(access_token, refresh_token,expires_at = nil, base_url=nil)
|
5
|
+
@access_token = access_token
|
6
|
+
@refresh_token = refresh_token
|
7
|
+
@base_url = base_url
|
8
|
+
@expires_at = expires_at
|
9
|
+
end
|
10
|
+
|
11
|
+
def get(pool_id, id, params={})
|
12
|
+
raise "#{self.class}.get() passed a blank id!" if id.to_s == ''
|
13
|
+
url = "#{@base_url}/api/networks/pools/#{pool_id}/ips/#{id}"
|
14
|
+
headers = { params: params, authorization: "Bearer #{@access_token}" }
|
15
|
+
opts = {method: :get, url: url, headers: headers}
|
16
|
+
execute(opts)
|
17
|
+
end
|
18
|
+
|
19
|
+
def list(pool_id, params={})
|
20
|
+
url = "#{@base_url}/api/networks/pools/#{pool_id}/ips"
|
21
|
+
headers = { params: params, authorization: "Bearer #{@access_token}" }
|
22
|
+
opts = {method: :get, url: url, headers: headers}
|
23
|
+
execute(opts)
|
24
|
+
end
|
25
|
+
|
26
|
+
def create(pool_id, payload)
|
27
|
+
url = "#{@base_url}/api/networks/pools/#{pool_id}/ips"
|
28
|
+
headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
|
29
|
+
opts = {method: :post, url: url, headers: headers, payload: payload.to_json}
|
30
|
+
execute(opts)
|
31
|
+
end
|
32
|
+
|
33
|
+
def update(pool_id, id, payload)
|
34
|
+
url = "#{@base_url}/api/networks/pools/#{pool_id}/ips/#{id}"
|
35
|
+
headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
|
36
|
+
opts = {method: :put, url: url, headers: headers, payload: payload.to_json}
|
37
|
+
execute(opts)
|
38
|
+
end
|
39
|
+
|
40
|
+
def destroy(pool_id, id, params={})
|
41
|
+
url = "#{@base_url}/api/networks/pools/#{pool_id}/ips/#{id}"
|
42
|
+
headers = { :params => params, :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
|
43
|
+
opts = {method: :delete, url: url, headers: headers}
|
44
|
+
execute(opts)
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
data/lib/morpheus/cli/apps.rb
CHANGED
@@ -15,14 +15,14 @@ class Morpheus::Cli::Apps
|
|
15
15
|
include Morpheus::Cli::ProcessesHelper
|
16
16
|
set_command_name :apps
|
17
17
|
set_command_description "View and manage apps."
|
18
|
-
register_subcommands :list, :count, :get, :add, :update, :remove, :add_instance, :remove_instance, :logs, :security_groups, :apply_security_groups, :history
|
18
|
+
register_subcommands :list, :count, :get, :view, :add, :update, :remove, :add_instance, :remove_instance, :logs, :security_groups, :apply_security_groups, :history
|
19
19
|
register_subcommands :stop, :start, :restart
|
20
20
|
register_subcommands :wiki, :update_wiki
|
21
21
|
#register_subcommands :firewall_disable, :firewall_enable
|
22
22
|
#register_subcommands :validate # add --validate instead
|
23
23
|
alias_subcommand :details, :get
|
24
24
|
set_default_subcommand :list
|
25
|
-
|
25
|
+
|
26
26
|
def initialize()
|
27
27
|
# @appliance_name, @appliance_url = Morpheus::Cli::Remote.active_appliance
|
28
28
|
end
|
@@ -184,8 +184,8 @@ class Morpheus::Cli::Apps
|
|
184
184
|
opts.on('--validate','--validate', "Validate Only. Validates the configuration and skips creating it.") do
|
185
185
|
options[:validate_only] = true
|
186
186
|
end
|
187
|
-
opts.on('--refresh [SECONDS]', String, "Refresh until status is running,failed. Default interval is
|
188
|
-
options[:refresh_interval] = val.to_s.empty? ?
|
187
|
+
opts.on('--refresh [SECONDS]', String, "Refresh until status is running,failed. Default interval is #{default_refresh_interval} seconds.") do |val|
|
188
|
+
options[:refresh_interval] = val.to_s.empty? ? default_refresh_interval : val.to_f
|
189
189
|
end
|
190
190
|
build_common_options(opts, options, [:options, :payload, :json, :yaml, :dry_run, :quiet])
|
191
191
|
opts.footer = "Create a new app.\n" +
|
@@ -506,11 +506,8 @@ class Morpheus::Cli::Apps
|
|
506
506
|
end
|
507
507
|
end
|
508
508
|
# print details
|
509
|
-
|
510
|
-
|
511
|
-
else
|
512
|
-
get([app['id']])
|
513
|
-
end
|
509
|
+
get_args = [app['id']] + (options[:remote] ? ["-r",options[:remote]] : []) + (options[:refresh_interval] ? ['--refresh', options[:refresh_interval].to_s] : [])
|
510
|
+
get(get_args)
|
514
511
|
end
|
515
512
|
return 0
|
516
513
|
rescue RestClient::Exception => e
|
@@ -551,7 +548,7 @@ class Morpheus::Cli::Apps
|
|
551
548
|
options = {}
|
552
549
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
553
550
|
opts.banner = subcommand_usage("[app]")
|
554
|
-
opts.on('--refresh [SECONDS]', String, "Refresh until status is running,failed. Default interval is
|
551
|
+
opts.on('--refresh [SECONDS]', String, "Refresh until status is running,failed. Default interval is #{default_refresh_interval} seconds.") do |val|
|
555
552
|
options[:refresh_until_status] ||= "running,failed"
|
556
553
|
if !val.to_s.empty?
|
557
554
|
options[:refresh_interval] = val.to_f
|
@@ -694,11 +691,11 @@ class Morpheus::Cli::Apps
|
|
694
691
|
# refresh until a status is reached
|
695
692
|
if options[:refresh_until_status]
|
696
693
|
if options[:refresh_interval].nil? || options[:refresh_interval].to_f < 0
|
697
|
-
options[:refresh_interval] =
|
694
|
+
options[:refresh_interval] = default_refresh_interval
|
698
695
|
end
|
699
696
|
statuses = options[:refresh_until_status].to_s.downcase.split(",").collect {|s| s.strip }.select {|s| !s.to_s.empty? }
|
700
697
|
if !statuses.include?(app['status'])
|
701
|
-
print cyan, "Refreshing in #{options[:refresh_interval]} seconds"
|
698
|
+
print cyan, "Refreshing in #{options[:refresh_interval] > 1 ? options[:refresh_interval].to_i : options[:refresh_interval]} seconds"
|
702
699
|
sleep_with_dots(options[:refresh_interval])
|
703
700
|
print "\n"
|
704
701
|
_get(arg, options)
|
@@ -790,9 +787,9 @@ class Morpheus::Cli::Apps
|
|
790
787
|
print "\n"
|
791
788
|
else
|
792
789
|
print_green_success "Updated app #{app['name']}"
|
793
|
-
|
794
|
-
|
795
|
-
|
790
|
+
# print details
|
791
|
+
get_args = [app['id']] + (options[:remote] ? ["-r",options[:remote]] : [])
|
792
|
+
get(get_args)
|
796
793
|
end
|
797
794
|
|
798
795
|
rescue RestClient::Exception => e
|
@@ -1489,6 +1486,64 @@ class Morpheus::Cli::Apps
|
|
1489
1486
|
end
|
1490
1487
|
end
|
1491
1488
|
|
1489
|
+
def view(args)
|
1490
|
+
options = {}
|
1491
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
1492
|
+
opts.banner = subcommand_usage("[app]")
|
1493
|
+
opts.on('-w','--wiki', "Open the wiki tab for this app") do
|
1494
|
+
options[:link_tab] = "wiki"
|
1495
|
+
end
|
1496
|
+
opts.on('--tab VALUE', String, "Open a specific tab") do |val|
|
1497
|
+
options[:link_tab] = val.to_s
|
1498
|
+
end
|
1499
|
+
build_common_options(opts, options, [:dry_run, :remote])
|
1500
|
+
opts.footer = "View an app in a web browser" + "\n" +
|
1501
|
+
"[app] is required. This is the name or id of an app. Supports 1-N [app] arguments."
|
1502
|
+
end
|
1503
|
+
optparse.parse!(args)
|
1504
|
+
if args.count != 1
|
1505
|
+
raise_command_error "wrong number of arguments, expected 1 and got (#{args.count}) #{args.join(' ')}\n#{optparse}"
|
1506
|
+
end
|
1507
|
+
connect(options)
|
1508
|
+
id_list = parse_id_list(args)
|
1509
|
+
return run_command_for_each_arg(id_list) do |arg|
|
1510
|
+
_view(arg, options)
|
1511
|
+
end
|
1512
|
+
end
|
1513
|
+
|
1514
|
+
def _view(arg, options={})
|
1515
|
+
begin
|
1516
|
+
app = find_app_by_name_or_id(arg)
|
1517
|
+
return 1 if app.nil?
|
1518
|
+
|
1519
|
+
link = "#{@appliance_url}/login/oauth-redirect?access_token=#{@access_token}\\&redirectUri=/provisioning/apps/#{app['id']}"
|
1520
|
+
if options[:link_tab]
|
1521
|
+
link << "#!#{options[:link_tab]}"
|
1522
|
+
end
|
1523
|
+
|
1524
|
+
open_command = nil
|
1525
|
+
if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
|
1526
|
+
open_command = "start #{link}"
|
1527
|
+
elsif RbConfig::CONFIG['host_os'] =~ /darwin/
|
1528
|
+
open_command = "open #{link}"
|
1529
|
+
elsif RbConfig::CONFIG['host_os'] =~ /linux|bsd/
|
1530
|
+
open_command = "xdg-open #{link}"
|
1531
|
+
end
|
1532
|
+
|
1533
|
+
if options[:dry_run]
|
1534
|
+
puts "system: #{open_command}"
|
1535
|
+
return 0
|
1536
|
+
end
|
1537
|
+
|
1538
|
+
system(open_command)
|
1539
|
+
|
1540
|
+
return 0
|
1541
|
+
rescue RestClient::Exception => e
|
1542
|
+
print_rest_exception(e, options)
|
1543
|
+
exit 1
|
1544
|
+
end
|
1545
|
+
end
|
1546
|
+
|
1492
1547
|
def wiki(args)
|
1493
1548
|
options = {}
|
1494
1549
|
params = {}
|
@@ -556,11 +556,7 @@ module Morpheus
|
|
556
556
|
options[:border_style] = :thin
|
557
557
|
end
|
558
558
|
|
559
|
-
|
560
|
-
opts.on('--out FILE', String, "Write standard output to a file instead of the terminal.") do |val|
|
561
|
-
# could validate directory is writable..
|
562
|
-
options[:outfile] = val
|
563
|
-
end
|
559
|
+
|
564
560
|
|
565
561
|
when :dry_run
|
566
562
|
opts.on('-d','--dry-run', "Dry Run, print the API request instead of executing it") do
|
@@ -586,7 +582,25 @@ module Morpheus
|
|
586
582
|
opts.on(nil,'--scrub', "Mask secrets in output, such as the Authorization header. For use with --curl and --dry-run.") do
|
587
583
|
options[:scrub] = true
|
588
584
|
end
|
585
|
+
# dry run comes with hidden outfile options
|
589
586
|
#opts.add_hidden_option('--scrub') if opts.is_a?(Morpheus::Cli::OptionParser)
|
587
|
+
opts.on('--out FILE', String, "Write standard output to a file instead of the terminal.") do |val|
|
588
|
+
# could validate directory is writable..
|
589
|
+
options[:outfile] = val
|
590
|
+
end
|
591
|
+
opts.add_hidden_option('--out') if opts.is_a?(Morpheus::Cli::OptionParser)
|
592
|
+
opts.on('--overwrite', '--overwrite', "Overwrite output file if it already exists.") do
|
593
|
+
options[:overwrite] = true
|
594
|
+
end
|
595
|
+
opts.add_hidden_option('--overwrite') if opts.is_a?(Morpheus::Cli::OptionParser)
|
596
|
+
|
597
|
+
when :outfile
|
598
|
+
opts.on('--out FILE', String, "Write standard output to a file instead of the terminal.") do |val|
|
599
|
+
options[:outfile] = val
|
600
|
+
end
|
601
|
+
opts.on('--overwrite', '--overwrite', "Overwrite output file if it already exists.") do |val|
|
602
|
+
options[:overwrite] = true
|
603
|
+
end
|
590
604
|
when :quiet
|
591
605
|
opts.on('-q','--quiet', "No Output, do not print to stdout") do
|
592
606
|
options[:quiet] = true
|
@@ -662,6 +676,10 @@ module Morpheus
|
|
662
676
|
self.class.default_subcommand
|
663
677
|
end
|
664
678
|
|
679
|
+
def default_refresh_interval
|
680
|
+
self.class.default_refresh_interval
|
681
|
+
end
|
682
|
+
|
665
683
|
def usage
|
666
684
|
if !subcommands.empty?
|
667
685
|
"Usage: morpheus #{command_name} [command] [options]"
|
@@ -909,21 +927,6 @@ module Morpheus
|
|
909
927
|
return subtitles
|
910
928
|
end
|
911
929
|
|
912
|
-
def print_to_file(txt, filename)
|
913
|
-
Morpheus::Logging::DarkPrinter.puts "Writing #{txt.to_s.bytesize} bytes to file #{filename}" if Morpheus::Logging.debug?
|
914
|
-
outfile = nil
|
915
|
-
begin
|
916
|
-
outfile = File.open(File.expand_path(filename), 'w')
|
917
|
-
outfile.print(txt)
|
918
|
-
return 0
|
919
|
-
rescue => ex
|
920
|
-
puts_error "Error printing to outfile '#{filename}'. Error: #{ex}"
|
921
|
-
return 1
|
922
|
-
ensure
|
923
|
-
outfile.close if outfile
|
924
|
-
end
|
925
|
-
end
|
926
|
-
|
927
930
|
# basic rendering for options :json, :yaml, :csv, :fields, and :outfile
|
928
931
|
# returns the string rendered, or nil if nothing was rendered.
|
929
932
|
def render_with_format(json_response, options, object_key=nil)
|
@@ -938,7 +941,7 @@ module Morpheus
|
|
938
941
|
end
|
939
942
|
if output
|
940
943
|
if options[:outfile]
|
941
|
-
print_to_file(output, options[:outfile])
|
944
|
+
print_to_file(output, options[:outfile], options[:overwrite])
|
942
945
|
else
|
943
946
|
puts output
|
944
947
|
end
|
@@ -967,7 +970,8 @@ module Morpheus
|
|
967
970
|
def set_command_hidden(val=true)
|
968
971
|
@hidden_command = val
|
969
972
|
end
|
970
|
-
|
973
|
+
# alias :command_name= :set_command_name
|
974
|
+
|
971
975
|
def hidden_command
|
972
976
|
!!@hidden_command
|
973
977
|
end
|
@@ -979,10 +983,18 @@ module Morpheus
|
|
979
983
|
def set_command_description(val)
|
980
984
|
@command_description = val
|
981
985
|
end
|
982
|
-
|
983
|
-
# alias :command_name= :set_command_name
|
984
986
|
# alias :command_description= :set_command_description
|
985
987
|
|
988
|
+
def default_refresh_interval
|
989
|
+
@default_refresh_interval ||= 30
|
990
|
+
end
|
991
|
+
|
992
|
+
def set_default_refresh_interval(seconds)
|
993
|
+
@default_refresh_interval = seconds
|
994
|
+
end
|
995
|
+
#alias :default_refresh_interval= :set_default_refresh_interval
|
996
|
+
|
997
|
+
|
986
998
|
# construct map of command name => instance method
|
987
999
|
def register_subcommands(*cmds)
|
988
1000
|
@subcommands ||= {}
|
@@ -32,7 +32,7 @@ class Morpheus::Cli::ContainersCommand
|
|
32
32
|
opts.on( nil, '--actions', "Display Available Actions" ) do
|
33
33
|
options[:include_available_actions] = true
|
34
34
|
end
|
35
|
-
opts.on('--refresh [SECONDS]', String, "Refresh until status is running,failed. Default interval is
|
35
|
+
opts.on('--refresh [SECONDS]', String, "Refresh until status is running,failed. Default interval is #{default_refresh_interval} seconds.") do |val|
|
36
36
|
options[:refresh_until_status] ||= "running,failed"
|
37
37
|
if !val.to_s.empty?
|
38
38
|
options[:refresh_interval] = val.to_f
|
@@ -97,6 +97,7 @@ class Morpheus::Cli::ContainersCommand
|
|
97
97
|
"Type" => lambda {|it| it['containerType'] ? it['containerType']['name'] : '' },
|
98
98
|
"Plan" => lambda {|it| it['plan'] ? it['plan']['name'] : '' },
|
99
99
|
"Instance" => lambda {|it| it['instance'] ? it['instance']['name'] : '' },
|
100
|
+
"Host" => lambda {|it| it['server'] ? it['server']['name'] : '' },
|
100
101
|
"Cloud" => lambda {|it| it['cloud'] ? it['cloud']['name'] : '' },
|
101
102
|
"Location" => lambda {|it| format_container_connection_string(it) },
|
102
103
|
# "Description" => 'description',
|
@@ -134,12 +135,12 @@ class Morpheus::Cli::ContainersCommand
|
|
134
135
|
# refresh until a status is reached
|
135
136
|
if options[:refresh_until_status]
|
136
137
|
if options[:refresh_interval].nil? || options[:refresh_interval].to_f < 0
|
137
|
-
options[:refresh_interval] =
|
138
|
+
options[:refresh_interval] = default_refresh_interval
|
138
139
|
end
|
139
140
|
statuses = options[:refresh_until_status].to_s.downcase.split(",").collect {|s| s.strip }.select {|s| !s.to_s.empty? }
|
140
141
|
if !statuses.include?(container['status'])
|
141
142
|
print cyan
|
142
|
-
print cyan, "Refreshing in #{options[:refresh_interval]} seconds"
|
143
|
+
print cyan, "Refreshing in #{options[:refresh_interval] > 1 ? options[:refresh_interval].to_i : options[:refresh_interval]} seconds"
|
143
144
|
sleep_with_dots(options[:refresh_interval])
|
144
145
|
print "\n"
|
145
146
|
_get(arg, options)
|
@@ -13,6 +13,7 @@ class Morpheus::Cli::ExecutionRequestCommand
|
|
13
13
|
#register_subcommands :'execute-against-lease' => :execute_against_lease
|
14
14
|
|
15
15
|
# set_default_subcommand :list
|
16
|
+
|
16
17
|
|
17
18
|
def initialize()
|
18
19
|
# @appliance_name, @appliance_url = Morpheus::Cli::Remote.active_appliance
|
@@ -37,7 +38,7 @@ class Morpheus::Cli::ExecutionRequestCommand
|
|
37
38
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
38
39
|
opts.banner = subcommand_usage("[uid]")
|
39
40
|
build_common_options(opts, options, [:query, :json, :yaml, :csv, :fields, :dry_run, :remote])
|
40
|
-
opts.on('--refresh [SECONDS]', String, "Refresh until execution is finished. Default interval is
|
41
|
+
opts.on('--refresh [SECONDS]', String, "Refresh until execution is finished. Default interval is #{default_refresh_interval} seconds.") do |val|
|
41
42
|
options[:refresh_until_finished] = true
|
42
43
|
if !val.to_s.empty?
|
43
44
|
options[:refresh_interval] = val.to_f
|
@@ -78,7 +79,7 @@ class Morpheus::Cli::ExecutionRequestCommand
|
|
78
79
|
# refresh until a status is reached
|
79
80
|
if options[:refresh_until_finished]
|
80
81
|
if options[:refresh_interval].nil? || options[:refresh_interval].to_f < 0
|
81
|
-
options[:refresh_interval] =
|
82
|
+
options[:refresh_interval] = default_refresh_interval
|
82
83
|
end
|
83
84
|
if execution_request['exitCode'] || ['complete','failed','expired'].include?(execution_request['status'])
|
84
85
|
# it is finished
|
@@ -13,7 +13,7 @@ class Morpheus::Cli::FileCopyRequestCommand
|
|
13
13
|
#register_subcommands :'execute-against-lease' => :execute_against_lease
|
14
14
|
|
15
15
|
# set_default_subcommand :list
|
16
|
-
|
16
|
+
|
17
17
|
def initialize()
|
18
18
|
# @appliance_name, @appliance_url = Morpheus::Cli::Remote.active_appliance
|
19
19
|
end
|
@@ -37,7 +37,7 @@ class Morpheus::Cli::FileCopyRequestCommand
|
|
37
37
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
38
38
|
opts.banner = subcommand_usage("[uid]")
|
39
39
|
build_common_options(opts, options, [:query, :json, :yaml, :csv, :fields, :dry_run, :remote])
|
40
|
-
opts.on('--refresh [SECONDS]', String, "Refresh until execution is finished. Default interval is
|
40
|
+
opts.on('--refresh [SECONDS]', String, "Refresh until execution is finished. Default interval is #{default_refresh_interval} seconds.") do |val|
|
41
41
|
options[:refresh_until_finished] = true
|
42
42
|
if !val.to_s.empty?
|
43
43
|
options[:refresh_interval] = val.to_f
|
@@ -78,7 +78,7 @@ class Morpheus::Cli::FileCopyRequestCommand
|
|
78
78
|
# refresh until a status is reached
|
79
79
|
if options[:refresh_until_finished]
|
80
80
|
if options[:refresh_interval].nil? || options[:refresh_interval].to_f < 0
|
81
|
-
options[:refresh_interval] =
|
81
|
+
options[:refresh_interval] = default_refresh_interval
|
82
82
|
end
|
83
83
|
if ['complete','failed','expired'].include?(file_copy_request['status'])
|
84
84
|
# it is finished
|