morpheus-cli 8.0.2 → 8.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Dockerfile +1 -1
- data/lib/morpheus/cli/commands/clusters.rb +2 -33
- data/lib/morpheus/cli/commands/instances.rb +20 -63
- data/lib/morpheus/cli/commands/processes_command.rb +2 -2
- data/lib/morpheus/cli/commands/snapshots.rb +24 -8
- data/lib/morpheus/cli/mixins/processes_helper.rb +34 -4
- data/lib/morpheus/cli/version.rb +1 -1
- data/lib/morpheus/formatters.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b071ad7a069db88e11023de144dad8ad640f49b6a18becdfa60cd1e04312397f
|
4
|
+
data.tar.gz: b1deba83d4decb51b824fabfca0d8a615dbd17e6df7e07296de3a8dc3606f945
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '04509b5731b2f5713189498b3a166b62735911c7c178d6480c5d54d4fd68827ef16f21431d5b7c49ce2209dca14dc402c65dc59e90268979b310855a08705598'
|
7
|
+
data.tar.gz: 179f4442f70f2f634746a11211f435ae119abd9dc0839e06c16142018afa3809bcdc995cc96ca3967734d06e578b80f7a6a680dbe3ba7c4bf643cc6318cb03d2
|
data/Dockerfile
CHANGED
@@ -3784,7 +3784,7 @@ class Morpheus::Cli::Clusters
|
|
3784
3784
|
subtitles << " Process ID: #{process_id}"
|
3785
3785
|
subtitles += parse_list_subtitles(options)
|
3786
3786
|
print_h1 title, subtitles, options
|
3787
|
-
print_process_details(process)
|
3787
|
+
print_process_details(process, options)
|
3788
3788
|
|
3789
3789
|
print_h2 "Process Events", options
|
3790
3790
|
process_events = process['events'] || process['processEvents'] || []
|
@@ -4003,7 +4003,7 @@ class Morpheus::Cli::Clusters
|
|
4003
4003
|
subtitles = []
|
4004
4004
|
subtitles += parse_list_subtitles(options)
|
4005
4005
|
print_h1 title, subtitles, options
|
4006
|
-
print_process_event_details(process_event)
|
4006
|
+
print_process_event_details(process_event, options)
|
4007
4007
|
print reset, "\n"
|
4008
4008
|
return 0
|
4009
4009
|
end
|
@@ -4015,37 +4015,6 @@ class Morpheus::Cli::Clusters
|
|
4015
4015
|
|
4016
4016
|
private
|
4017
4017
|
|
4018
|
-
def print_process_event_details(process_event, options={})
|
4019
|
-
# process_event =~ process
|
4020
|
-
description_cols = {
|
4021
|
-
"Process ID" => lambda {|it| it['processId'] },
|
4022
|
-
"Event ID" => lambda {|it| it['id'] },
|
4023
|
-
"Name" => lambda {|it| it['displayName'] },
|
4024
|
-
"Description" => lambda {|it| it['description'] },
|
4025
|
-
"Process Type" => lambda {|it| it['processType'] ? (it['processType']['name'] || it['processType']['code']) : it['processTypeName'] },
|
4026
|
-
"Created By" => lambda {|it| it['createdBy'] ? (it['createdBy']['displayName'] || it['createdBy']['username']) : '' },
|
4027
|
-
"Start Date" => lambda {|it| format_local_dt(it['startDate']) },
|
4028
|
-
"End Date" => lambda {|it| format_local_dt(it['endDate']) },
|
4029
|
-
"Duration" => lambda {|it| format_process_duration(it) },
|
4030
|
-
"Status" => lambda {|it| format_process_status(it) },
|
4031
|
-
}
|
4032
|
-
print_description_list(description_cols, process_event)
|
4033
|
-
|
4034
|
-
if process_event['error']
|
4035
|
-
print_h2 "Error", options
|
4036
|
-
print reset
|
4037
|
-
#puts format_process_error(process_event)
|
4038
|
-
puts process_event['error'].to_s.strip
|
4039
|
-
end
|
4040
|
-
|
4041
|
-
if process_event['output']
|
4042
|
-
print_h2 "Output", options
|
4043
|
-
print reset
|
4044
|
-
#puts format_process_error(process_event)
|
4045
|
-
puts process_event['output'].to_s.strip
|
4046
|
-
end
|
4047
|
-
end
|
4048
|
-
|
4049
4018
|
def print_clusters_table(clusters, opts={})
|
4050
4019
|
table_color = opts[:color] || cyan
|
4051
4020
|
rows = clusters.collect do |cluster|
|
@@ -2921,6 +2921,12 @@ class Morpheus::Cli::Instances
|
|
2921
2921
|
opts.on( '--description VALUE', String, "Snapshot Description." ) do |val|
|
2922
2922
|
options[:options]['description'] = val
|
2923
2923
|
end
|
2924
|
+
opts.on('--refresh [SECONDS]', String, "Refresh until execution is complete. Default interval is #{default_refresh_interval} seconds.") do |val|
|
2925
|
+
options[:refresh_interval] = val.to_s.empty? ? default_refresh_interval : val.to_f
|
2926
|
+
end
|
2927
|
+
opts.on(nil, '--no-refresh', "Do not refresh" ) do
|
2928
|
+
options[:no_refresh] = true
|
2929
|
+
end
|
2924
2930
|
build_standard_add_options(opts, options, [:auto_confirm])
|
2925
2931
|
opts.footer = <<-EOT
|
2926
2932
|
Create a snapshot for an instance.
|
@@ -2949,6 +2955,18 @@ EOT
|
|
2949
2955
|
json_response = @instances_interface.snapshot(instance['id'], payload)
|
2950
2956
|
render_response(json_response, options, 'snapshots') do
|
2951
2957
|
print_green_success "Snapshot initiated."
|
2958
|
+
process_id = json_response['processIds'][0] rescue nil
|
2959
|
+
if process_id
|
2960
|
+
unless options[:no_refresh]
|
2961
|
+
process = wait_for_process_execution(process_id, options)
|
2962
|
+
snapshot_id = process['resultId']
|
2963
|
+
if snapshot_id
|
2964
|
+
Morpheus::Cli::Snapshots.new.handle(["get", snapshot_id] + (options[:remote] ? ["-r",options[:remote]] : []))
|
2965
|
+
end
|
2966
|
+
end
|
2967
|
+
else
|
2968
|
+
# puts "No process returned"
|
2969
|
+
end
|
2952
2970
|
end
|
2953
2971
|
return 0, nil
|
2954
2972
|
end
|
@@ -3707,7 +3725,7 @@ EOT
|
|
3707
3725
|
if options[:json]
|
3708
3726
|
puts as_json(json_response, options)
|
3709
3727
|
else
|
3710
|
-
print_green_success "Snapshots
|
3728
|
+
print_green_success "Snapshots attached to instance #{instance['name']} queued for deletion."
|
3711
3729
|
end
|
3712
3730
|
return 0
|
3713
3731
|
|
@@ -4496,7 +4514,7 @@ EOT
|
|
4496
4514
|
subtitles << " Process ID: #{process_id}"
|
4497
4515
|
subtitles += parse_list_subtitles(options)
|
4498
4516
|
print_h1 title, subtitles, options
|
4499
|
-
print_process_details(process)
|
4517
|
+
print_process_details(process, options)
|
4500
4518
|
|
4501
4519
|
print_h2 "Process Events", options
|
4502
4520
|
process_events = process['events'] || process['processEvents'] || []
|
@@ -5502,67 +5520,6 @@ private
|
|
5502
5520
|
{'fieldName' => 'maxDisk', 'fieldLabel' => 'Max Disk', 'type' => 'number', 'description' => 'Maximum storage percent (0-100)'},
|
5503
5521
|
]
|
5504
5522
|
end
|
5505
|
-
|
5506
|
-
def print_process_details(process)
|
5507
|
-
description_cols = {
|
5508
|
-
"Process ID" => lambda {|it| it['id'] },
|
5509
|
-
"Name" => lambda {|it| it['displayName'] },
|
5510
|
-
"Description" => lambda {|it| it['description'] },
|
5511
|
-
"Process Type" => lambda {|it| it['processType'] ? (it['processType']['name'] || it['processType']['code']) : it['processTypeName'] },
|
5512
|
-
"Created By" => lambda {|it| it['createdBy'] ? (it['createdBy']['displayName'] || it['createdBy']['username']) : '' },
|
5513
|
-
"Start Date" => lambda {|it| format_local_dt(it['startDate']) },
|
5514
|
-
"End Date" => lambda {|it| format_local_dt(it['endDate']) },
|
5515
|
-
"Duration" => lambda {|it| format_process_duration(it) },
|
5516
|
-
"Status" => lambda {|it| format_process_status(it) },
|
5517
|
-
# "# Events" => lambda {|it| (it['events'] || []).size() },
|
5518
|
-
}
|
5519
|
-
print_description_list(description_cols, process)
|
5520
|
-
|
5521
|
-
if process['error']
|
5522
|
-
print_h2 "Error", options
|
5523
|
-
print reset
|
5524
|
-
#puts format_process_error(process_event)
|
5525
|
-
puts process['error'].to_s.strip
|
5526
|
-
end
|
5527
|
-
|
5528
|
-
if process['output']
|
5529
|
-
print_h2 "Output", options
|
5530
|
-
print reset
|
5531
|
-
#puts format_process_error(process_event)
|
5532
|
-
puts process['output'].to_s.strip
|
5533
|
-
end
|
5534
|
-
end
|
5535
|
-
|
5536
|
-
def print_process_event_details(process_event, options={})
|
5537
|
-
# process_event =~ process
|
5538
|
-
description_cols = {
|
5539
|
-
"Process ID" => lambda {|it| it['processId'] },
|
5540
|
-
"Event ID" => lambda {|it| it['id'] },
|
5541
|
-
"Name" => lambda {|it| it['displayName'] },
|
5542
|
-
"Description" => lambda {|it| it['description'] },
|
5543
|
-
"Process Type" => lambda {|it| it['processType'] ? (it['processType']['name'] || it['processType']['code']) : it['processTypeName'] },
|
5544
|
-
"Created By" => lambda {|it| it['createdBy'] ? (it['createdBy']['displayName'] || it['createdBy']['username']) : '' },
|
5545
|
-
"Start Date" => lambda {|it| format_local_dt(it['startDate']) },
|
5546
|
-
"End Date" => lambda {|it| format_local_dt(it['endDate']) },
|
5547
|
-
"Duration" => lambda {|it| format_process_duration(it) },
|
5548
|
-
"Status" => lambda {|it| format_process_status(it) },
|
5549
|
-
}
|
5550
|
-
print_description_list(description_cols, process_event)
|
5551
|
-
|
5552
|
-
if process_event['error']
|
5553
|
-
print_h2 "Error", options
|
5554
|
-
print reset
|
5555
|
-
#puts format_process_error(process_event)
|
5556
|
-
puts process_event['error'].to_s.strip
|
5557
|
-
end
|
5558
|
-
|
5559
|
-
if process_event['output']
|
5560
|
-
print_h2 "Output", options
|
5561
|
-
print reset
|
5562
|
-
#puts format_process_error(process_event)
|
5563
|
-
puts process_event['output'].to_s.strip
|
5564
|
-
end
|
5565
|
-
end
|
5566
5523
|
|
5567
5524
|
def update_wiki_page_option_types
|
5568
5525
|
[
|
@@ -295,7 +295,7 @@ class Morpheus::Cli::Processes
|
|
295
295
|
subtitles << " Process ID: #{process_id}"
|
296
296
|
subtitles += parse_list_subtitles(options)
|
297
297
|
print_h1 title, subtitles
|
298
|
-
print_process_details(process)
|
298
|
+
print_process_details(process, options)
|
299
299
|
|
300
300
|
print_h2 "Process Events"
|
301
301
|
process_events = process['events'] || process['processEvents'] || []
|
@@ -456,7 +456,7 @@ EOT
|
|
456
456
|
subtitles = []
|
457
457
|
subtitles += parse_list_subtitles(options)
|
458
458
|
print_h1 title, subtitles
|
459
|
-
print_process_event_details(process_event)
|
459
|
+
print_process_event_details(process_event, options)
|
460
460
|
print reset, "\n"
|
461
461
|
return 0
|
462
462
|
end
|
@@ -73,15 +73,15 @@ class Morpheus::Cli::Snapshots
|
|
73
73
|
"Name" => 'name',
|
74
74
|
"Description" => 'description',
|
75
75
|
"External Id" => 'externalId',
|
76
|
-
"
|
77
|
-
"State" => 'state',
|
76
|
+
# "State" => 'state',
|
78
77
|
"Snapshot Type" => 'snapshotType',
|
79
|
-
"
|
80
|
-
"Cloud" => 'zone
|
81
|
-
"Datastore" => 'datastore',
|
82
|
-
"Parent Snapshot" => 'parentSnapshot',
|
83
|
-
"Active" => 'currentlyActive',
|
84
|
-
"Date Created" => 'dateCreated'
|
78
|
+
"Date Created" => lambda {|it| format_local_dt(it['snapshotCreated']) },
|
79
|
+
"Cloud" => lambda {|it| format_name_and_id(it['zone']) },
|
80
|
+
"Datastore" => lambda {|it| format_name_and_id(it['datastore']) },
|
81
|
+
"Parent Snapshot" => lambda {|it| format_name_and_id(it['parentSnapshot']) },
|
82
|
+
"Active" => lambda {|it| format_boolean(it['currentlyActive']) },
|
83
|
+
"Date Created" => lambda {|it| format_local_dt(it['dateCreated']) },
|
84
|
+
"Status" => lambda {|it| format_snapshot_status(it) }
|
85
85
|
}
|
86
86
|
print_description_list(description_cols, snapshot)
|
87
87
|
|
@@ -134,4 +134,20 @@ class Morpheus::Cli::Snapshots
|
|
134
134
|
exit 1
|
135
135
|
end
|
136
136
|
end
|
137
|
+
|
138
|
+
protected
|
139
|
+
|
140
|
+
def format_snapshot_status(snapshot, return_color=cyan)
|
141
|
+
out = ""
|
142
|
+
status_string = snapshot['status'].to_s
|
143
|
+
if status_string == 'complete'
|
144
|
+
out << "#{green}#{status_string.upcase}#{return_color}"
|
145
|
+
elsif status_string == 'failed'
|
146
|
+
out << "#{red}#{status_string.upcase}#{return_color}"
|
147
|
+
else
|
148
|
+
out << "#{cyan}#{status_string.upcase}#{return_color}"
|
149
|
+
end
|
150
|
+
out
|
151
|
+
end
|
152
|
+
|
137
153
|
end
|
@@ -8,8 +8,17 @@ module Morpheus::Cli::ProcessesHelper
|
|
8
8
|
klass.send :include, Morpheus::Cli::PrintHelper
|
9
9
|
end
|
10
10
|
|
11
|
+
def api_client
|
12
|
+
raise "#{self.class} has not defined @api_client" if @api_client.nil?
|
13
|
+
@api_client
|
14
|
+
end
|
15
|
+
|
16
|
+
def processes_interface
|
17
|
+
# get_interface('processes')
|
18
|
+
api_client.processes
|
19
|
+
end
|
11
20
|
|
12
|
-
def print_process_details(process)
|
21
|
+
def print_process_details(process, options={})
|
13
22
|
description_cols = {
|
14
23
|
"Process ID" => lambda {|it| it['id'] },
|
15
24
|
"Name" => lambda {|it| it['displayName'] },
|
@@ -22,7 +31,7 @@ module Morpheus::Cli::ProcessesHelper
|
|
22
31
|
"Status" => lambda {|it| format_process_status(it) },
|
23
32
|
# "# Events" => lambda {|it| (it['events'] || []).size() },
|
24
33
|
}
|
25
|
-
print_description_list(description_cols, process)
|
34
|
+
print_description_list(description_cols, process, options)
|
26
35
|
|
27
36
|
if process['error']
|
28
37
|
print_h2 "Error"
|
@@ -39,7 +48,7 @@ module Morpheus::Cli::ProcessesHelper
|
|
39
48
|
end
|
40
49
|
end
|
41
50
|
|
42
|
-
def print_process_event_details(process_event)
|
51
|
+
def print_process_event_details(process_event, options={})
|
43
52
|
# process_event =~ process
|
44
53
|
description_cols = {
|
45
54
|
"Process ID" => lambda {|it| it['processId'] },
|
@@ -53,7 +62,7 @@ module Morpheus::Cli::ProcessesHelper
|
|
53
62
|
"Duration" => lambda {|it| format_process_duration(it) },
|
54
63
|
"Status" => lambda {|it| format_process_status(it) },
|
55
64
|
}
|
56
|
-
print_description_list(description_cols, process_event)
|
65
|
+
print_description_list(description_cols, process_event, options)
|
57
66
|
|
58
67
|
if process_event['error']
|
59
68
|
print_h2 "Error"
|
@@ -111,4 +120,25 @@ module Morpheus::Cli::ProcessesHelper
|
|
111
120
|
out
|
112
121
|
end
|
113
122
|
|
123
|
+
def wait_for_process_execution(process_id, options={}, print_output = true)
|
124
|
+
refresh_interval = 10
|
125
|
+
if options[:refresh_interval].to_i > 0
|
126
|
+
refresh_interval = options[:refresh_interval]
|
127
|
+
end
|
128
|
+
refresh_display_seconds = refresh_interval % 1.0 == 0 ? refresh_interval.to_i : refresh_interval
|
129
|
+
unless options[:quiet]
|
130
|
+
print cyan, "Refreshing every #{refresh_display_seconds} seconds until process is complete...", "\n", reset
|
131
|
+
end
|
132
|
+
process = processes_interface.get(process_id)['process']
|
133
|
+
while ['new','queued','pending','running'].include?(process['status']) do
|
134
|
+
sleep(refresh_interval)
|
135
|
+
process = processes_interface.get(process_id)['process']
|
136
|
+
end
|
137
|
+
if print_output && options[:quiet] != true
|
138
|
+
print_h1 "Process Details", [], options
|
139
|
+
print_process_details(process, options)
|
140
|
+
end
|
141
|
+
return process
|
142
|
+
end
|
143
|
+
|
114
144
|
end
|
data/lib/morpheus/cli/version.rb
CHANGED
data/lib/morpheus/formatters.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: morpheus-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 8.0.
|
4
|
+
version: 8.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Estes
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2025-
|
14
|
+
date: 2025-02-10 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: public_suffix
|