morpheus-cli 8.0.4.1 → 8.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Dockerfile +1 -1
- data/lib/morpheus/api/api_client.rb +4 -0
- data/lib/morpheus/api/backup_results_interface.rb +4 -0
- data/lib/morpheus/api/server_devices_interface.rb +30 -0
- data/lib/morpheus/cli/commands/backups_command.rb +16 -2
- data/lib/morpheus/cli/commands/clusters.rb +1 -1
- data/lib/morpheus/cli/commands/hosts.rb +25 -4
- data/lib/morpheus/cli/commands/license.rb +12 -2
- data/lib/morpheus/cli/commands/server_devices_command.rb +207 -0
- data/lib/morpheus/cli/mixins/provisioning_helper.rb +3 -1
- data/lib/morpheus/cli/version.rb +1 -1
- 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: 36e5150354f68d0d1bf97da71cfc98e20bd78e68ab59a919d464b8d453a06ed3
|
4
|
+
data.tar.gz: 7bf57c87149c0eb357886fccafe0c1b8ead22b289c23127d5b6a6b0947ae12e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3d3be35646cafaf52af86eeef145350af72995ee762b5b958e2d49a10f263eb2803a4223b286f4358bf0d2904e2a1694a5282520ade5941184b7628bcc379d0
|
7
|
+
data.tar.gz: b744429719628a8048759e8844f3687f1800e5e3bb45b5369c87efc76d577a0fa626821b8ff468f3f4166d12f6bef40ee4381a6e208cd9ea6c5f7836896edf3c
|
data/Dockerfile
CHANGED
@@ -412,6 +412,10 @@ class Morpheus::APIClient
|
|
412
412
|
Morpheus::ServersInterface.new(common_interface_options).setopts(@options)
|
413
413
|
end
|
414
414
|
|
415
|
+
def server_devices
|
416
|
+
Morpheus::ServerDevicesInterface.new(common_interface_options).setopts(@options)
|
417
|
+
end
|
418
|
+
|
415
419
|
def instances
|
416
420
|
Morpheus::InstancesInterface.new(common_interface_options).setopts(@options)
|
417
421
|
end
|
@@ -25,4 +25,8 @@ class Morpheus::BackupResultsInterface < Morpheus::APIClient
|
|
25
25
|
execute(method: :delete, url: "#{base_path}/#{CGI::escape(id.to_s)}", params: params, headers: headers)
|
26
26
|
end
|
27
27
|
|
28
|
+
def create_options(id, payload={}, params={}, headers={})
|
29
|
+
validate_id!(id)
|
30
|
+
execute(method: :post, url: "#{base_path}/#{CGI::escape(id.to_s)}/create-restore", params: params, payload: payload, headers: headers)
|
31
|
+
end
|
28
32
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'morpheus/api/api_client'
|
2
|
+
|
3
|
+
class Morpheus::ServerDevicesInterface < Morpheus::APIClient
|
4
|
+
|
5
|
+
def base_path(server_id)
|
6
|
+
"#{@base_url}/api/servers/#{server_id}"
|
7
|
+
end
|
8
|
+
|
9
|
+
# def get(server_id, id, params={})
|
10
|
+
# raise "#{self.class}.get() passed a blank id!" if id.to_s == ''
|
11
|
+
# execute({method: :get, url: "#{base_path(server_id)}/devices/#{id}", params: params})
|
12
|
+
# end
|
13
|
+
|
14
|
+
def list(server_id, params={})
|
15
|
+
execute({method: :get, url: "#{base_path(server_id)}/devices", params: params})
|
16
|
+
end
|
17
|
+
|
18
|
+
def assign(server_id, id, payload)
|
19
|
+
execute({method: :put, url: "#{base_path(server_id)}/devices/#{id}/assign", payload: payload.to_json})
|
20
|
+
end
|
21
|
+
|
22
|
+
def attach(server_id, id, payload)
|
23
|
+
execute({method: :put, url: "#{base_path(server_id)}/devices/#{id}/attach", payload: payload.to_json})
|
24
|
+
end
|
25
|
+
|
26
|
+
def detach(server_id, id, payload)
|
27
|
+
execute({method: :put, url: "#{base_path(server_id)}/devices/#{id}/detach", payload: payload.to_json})
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
@@ -373,10 +373,21 @@ EOT
|
|
373
373
|
# could actually fetch the instance.., only need name and id right now though.
|
374
374
|
raise_command_error "Backup instance not found" if instance.nil?
|
375
375
|
params['restoreInstance'] = prompt_value({'fieldName' => 'restoreInstance', 'fieldLabel' => 'Restore Instance', 'type' => 'select', 'selectOptions' => [{'name' => 'Current Instance', 'value' => 'existing'}, {'name' => 'New Instance', 'value' => 'new'}], 'defaultValue' => 'existing', 'required' => true, 'description' => 'Restore the current instance or a new instance?'}, options)
|
376
|
+
restore_options = @backup_results_interface.create_options(backup_result['id'])
|
376
377
|
if params['restoreInstance'] == 'new'
|
377
378
|
# new instance
|
378
|
-
|
379
|
-
|
379
|
+
if restore_options['vmRestore']
|
380
|
+
group_id = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'group', 'type' => 'select', 'fieldLabel' => 'Group', 'selectOptions' => get_available_groups(), 'required' => true, 'description' => 'Select Group.'}],options[:options],@api_client,{'serverTypeId' => restore_options['servierTypeId']})['group']
|
381
|
+
name = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'name', 'fieldLabel' => 'Name', 'type' => 'text', 'required' => true, 'description' => 'Instance Name', 'defaultValue' => "#{backup['name']}-restore"}], options[:options], @api_client)['name']
|
382
|
+
params['groupId'] = group_id
|
383
|
+
params['name'] = name
|
384
|
+
v_prompt = Morpheus::Cli::OptionTypes.prompt(restore_options['restoreNewOptionTypes'], options[:options], @api_client, {'zoneId' => backup_result['zoneId'], 'siteId' => group_id})
|
385
|
+
v_prompt.deep_compact!.booleanize! # remove empty values and convert checkbox "on" and "off" to true and false
|
386
|
+
params.deep_merge!(v_prompt)
|
387
|
+
else
|
388
|
+
config_map = prompt_restore_instance_config(options)
|
389
|
+
params['instanceConfig'] = config_map
|
390
|
+
end
|
380
391
|
else
|
381
392
|
# existing instance
|
382
393
|
# confirm the instance
|
@@ -393,6 +404,9 @@ EOT
|
|
393
404
|
print_red_alert "The value '#{instance_id}' does not match the existing instance #{instance['name']} [#{instance['id'] rescue ''}]. Please try again."
|
394
405
|
end
|
395
406
|
end
|
407
|
+
v_prompt = Morpheus::Cli::OptionTypes.prompt(restore_options['restoreExistingOptionTypes'], options[:options], @api_client, {'zoneId' => backup_result['zoneId'], 'siteId' => group_id})
|
408
|
+
v_prompt.deep_compact!.booleanize! # remove empty values and convert checkbox "on" and "off" to true and false
|
409
|
+
params.deep_merge!(v_prompt)
|
396
410
|
end
|
397
411
|
elsif backup['locationType'] == 'server'
|
398
412
|
# prompt for server type backup restore
|
@@ -4248,7 +4248,7 @@ class Morpheus::Cli::Clusters
|
|
4248
4248
|
end
|
4249
4249
|
|
4250
4250
|
def find_layout_by_name(name)
|
4251
|
-
@cluster_layouts_interface.list({phrase:name}).find { it['name'].downcase == name.downcase || it['code'].downcase == name.downcase }
|
4251
|
+
@cluster_layouts_interface.list({phrase:name}).find { |it| it['name'].downcase == name.downcase || it['code'].downcase == name.downcase }
|
4252
4252
|
end
|
4253
4253
|
|
4254
4254
|
def layouts_for_dropdown(zone_id, group_type_id)
|
@@ -12,7 +12,8 @@ class Morpheus::Cli::Hosts
|
|
12
12
|
{:'types' => :list_types},
|
13
13
|
{:exec => :execution_request},
|
14
14
|
:wiki, :update_wiki,
|
15
|
-
:maintenance, :leave_maintenance, :placement
|
15
|
+
:maintenance, :leave_maintenance, :placement,
|
16
|
+
:list_devices, :assign_device, :detach_device, :attach_device
|
16
17
|
alias_subcommand :details, :get
|
17
18
|
set_default_subcommand :list
|
18
19
|
|
@@ -2281,7 +2282,7 @@ EOT
|
|
2281
2282
|
end
|
2282
2283
|
payload[:server][:deleteLocalData] = options.fetch(:deleteLocalData) do
|
2283
2284
|
prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'deleteLocalData', 'fieldLabel' => 'Delete Local Data', 'type' => 'checkbox', 'defaultValue' => false, 'required' => false}], options, @api_client, {})
|
2284
|
-
prompt['
|
2285
|
+
prompt['deleteLocalData'] == 'on'
|
2285
2286
|
end
|
2286
2287
|
end
|
2287
2288
|
|
@@ -2354,7 +2355,7 @@ EOT
|
|
2354
2355
|
end
|
2355
2356
|
json_response = @servers_interface.leave_maintenance(server['id'], payload, params)
|
2356
2357
|
render_response(json_response, options) do
|
2357
|
-
print_green_success "Maintenance
|
2358
|
+
print_green_success "Left Maintenance Mode for host #{server['name']}"
|
2358
2359
|
#get([server['id']])
|
2359
2360
|
end
|
2360
2361
|
return 0, nil
|
@@ -2418,6 +2419,24 @@ EOT
|
|
2418
2419
|
return 0, nil
|
2419
2420
|
end
|
2420
2421
|
|
2422
|
+
## Server Devices
|
2423
|
+
|
2424
|
+
def list_devices(args)
|
2425
|
+
Morpheus::Cli::ServerDevicesCommand.new.list(args)
|
2426
|
+
end
|
2427
|
+
|
2428
|
+
def assign_device(args)
|
2429
|
+
Morpheus::Cli::ServerDevicesCommand.new.assign(args)
|
2430
|
+
end
|
2431
|
+
|
2432
|
+
def attach_device(args)
|
2433
|
+
Morpheus::Cli::ServerDevicesCommand.new.attach(args)
|
2434
|
+
end
|
2435
|
+
|
2436
|
+
def detach_device(args)
|
2437
|
+
Morpheus::Cli::ServerDevicesCommand.new.detach(args)
|
2438
|
+
end
|
2439
|
+
|
2421
2440
|
private
|
2422
2441
|
|
2423
2442
|
def find_host_by_id(id)
|
@@ -2440,7 +2459,9 @@ EOT
|
|
2440
2459
|
print_red_alert "Server not found by name #{name}"
|
2441
2460
|
exit 1
|
2442
2461
|
elsif results['servers'].size > 1
|
2443
|
-
print_red_alert "Multiple Servers exist with the name #{name}
|
2462
|
+
print_red_alert "Multiple Servers exist with the name '#{name}'"
|
2463
|
+
puts_error as_pretty_table(results['servers'], [:id, :name], {color:red})
|
2464
|
+
print_red_alert "Try using ID instead"
|
2444
2465
|
exit 1
|
2445
2466
|
end
|
2446
2467
|
return results['servers'][0]
|
@@ -316,7 +316,12 @@ class Morpheus::Cli::License
|
|
316
316
|
"Start Date" => lambda {|it| format_local_dt(it['startDate']) },
|
317
317
|
"End Date" => lambda {|it|
|
318
318
|
if it['endDate']
|
319
|
-
|
319
|
+
end_date = parse_time(it['endDate']) rescue nil
|
320
|
+
if end_date && Time.now > end_date
|
321
|
+
format_local_dt(it['endDate']).to_s + red + ' (expired)' + cyan
|
322
|
+
else
|
323
|
+
format_local_dt(it['endDate']).to_s + ' (' + format_duration(Time.now, it['endDate']).to_s + ')'
|
324
|
+
end
|
320
325
|
else
|
321
326
|
'Never'
|
322
327
|
end
|
@@ -424,7 +429,12 @@ class Morpheus::Cli::License
|
|
424
429
|
"Start Date" => lambda {|it| format_local_dt(it['startDate']) },
|
425
430
|
"End Date" => lambda {|it|
|
426
431
|
if it['endDate']
|
427
|
-
|
432
|
+
end_date = parse_time(it['endDate']) rescue nil
|
433
|
+
if end_date && Time.now > end_date
|
434
|
+
format_local_dt(it['endDate']).to_s + red + ' (expired)' + cyan
|
435
|
+
else
|
436
|
+
format_local_dt(it['endDate']).to_s + ' (' + format_duration(Time.now, it['endDate']).to_s + ')'
|
437
|
+
end
|
428
438
|
else
|
429
439
|
'Never'
|
430
440
|
end
|
@@ -0,0 +1,207 @@
|
|
1
|
+
require 'morpheus/cli/cli_command'
|
2
|
+
|
3
|
+
class Morpheus::Cli::ServerDevicesCommand
|
4
|
+
include Morpheus::Cli::CliCommand
|
5
|
+
include Morpheus::Cli::ProvisioningHelper
|
6
|
+
# include Morpheus::Cli::OptionSourceHelper
|
7
|
+
|
8
|
+
set_command_hidden # hide and prefer `hosts list-devices, get-device, assign-device. for now
|
9
|
+
|
10
|
+
set_command_name :'host-devices'
|
11
|
+
|
12
|
+
register_subcommands :list, :assign, :attach, :detach
|
13
|
+
|
14
|
+
def connect(opts)
|
15
|
+
@api_client = establish_remote_appliance_connection(opts)
|
16
|
+
@servers_interface = @api_client.servers
|
17
|
+
@server_devices_interface = @api_client.server_devices
|
18
|
+
end
|
19
|
+
|
20
|
+
def handle(args)
|
21
|
+
handle_subcommand(args)
|
22
|
+
end
|
23
|
+
|
24
|
+
def list(args)
|
25
|
+
options = {}
|
26
|
+
params = {}
|
27
|
+
ref_ids = []
|
28
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
29
|
+
opts.banner = "Usage: #{prog_name} hosts [host] list-devices"
|
30
|
+
build_standard_list_options(opts, options)
|
31
|
+
opts.footer = <<-EOT
|
32
|
+
List host devices.
|
33
|
+
[host] is required. This is the id of the host.
|
34
|
+
EOT
|
35
|
+
end
|
36
|
+
optparse.parse!(args)
|
37
|
+
connect(options)
|
38
|
+
verify_args!(args:args, optparse:optparse, count:1)
|
39
|
+
server_id = args[0] =~ /\A\d{1,}\Z/ ? args[0].to_i : find_server_by_name(args[0])['id']
|
40
|
+
@server_devices_interface.setopts(options)
|
41
|
+
if options[:dry_run]
|
42
|
+
print_dry_run @server_devices_interface.dry.list(server_id, params)
|
43
|
+
return
|
44
|
+
end
|
45
|
+
json_response = @server_devices_interface.list(server_id, params)
|
46
|
+
render_response(json_response, options, 'devices') do
|
47
|
+
server_devices = json_response['devices']
|
48
|
+
print_h1 "Host Devices: #{server_id}", parse_list_subtitles(options), options
|
49
|
+
if server_devices.empty?
|
50
|
+
print cyan,"No host devices found.",reset,"\n"
|
51
|
+
else
|
52
|
+
print as_pretty_table(server_devices, server_device_list_column_definitions.upcase_keys!, options)
|
53
|
+
print_results_pagination(json_response)
|
54
|
+
end
|
55
|
+
print reset,"\n"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
|
60
|
+
def assign(args)
|
61
|
+
options = {}
|
62
|
+
params = {}
|
63
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
64
|
+
opts.banner = "Usage: #{prog_name} hosts assign [host] [device] [target]"
|
65
|
+
build_standard_update_options(opts, options)
|
66
|
+
opts.footer = <<-EOT
|
67
|
+
Assign a host device to a target server.
|
68
|
+
[host] is required. This is the id of the host.
|
69
|
+
[device] is required. This is the id of the device.
|
70
|
+
[target] is required. This is the id of the target server.
|
71
|
+
EOT
|
72
|
+
end
|
73
|
+
optparse.parse!(args)
|
74
|
+
verify_args!(args:args, optparse:optparse, min:1, max:3)
|
75
|
+
connect(options)
|
76
|
+
server_id = args[0] =~ /\A\d{1,}\Z/ ? args[0].to_i : find_server_by_name(args[0])['id']
|
77
|
+
device_id = args[1] ? args[1].to_i : nil
|
78
|
+
if device_id.nil?
|
79
|
+
avail_devices = @server_devices_interface.list(server_id)['devices'].collect {|it| {'name' => it['name'], 'value' => it['id']}}
|
80
|
+
device_id = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'deviceId', 'fieldLabel' => 'Device', 'type' => 'select', 'selectOptions' => avail_devices, 'required' => true}], options[:options], @api_client)['deviceId']
|
81
|
+
end
|
82
|
+
target_server_id = args[2] ? args[2].to_i : nil
|
83
|
+
parse_payload(options) do |payload|
|
84
|
+
if target_server_id.nil?
|
85
|
+
# avail_servers = @servers_interface.list({max:10000, 'parentId' => server_id})['servers'].collect {|it| {'name' => it['name'], 'value' => it['id']}}
|
86
|
+
# target_server_id = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'targetServerId', 'fieldLabel' => 'Target Server', 'type' => 'select', 'selectOptions' => avail_servers, 'required' => true}], options[:options], @api_client)['targetServerId']
|
87
|
+
target_server_id = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'targetServerId', 'fieldLabel' => 'Target Server', 'type' => 'select', 'optionSource' => 'hostVms', 'required' => true}], options[:options], @api_client, {'parentId' => server_id})['targetServerId']
|
88
|
+
end
|
89
|
+
payload['targetServerId'] = target_server_id
|
90
|
+
end
|
91
|
+
execute_api(@server_devices_interface, :assign, [server_id, device_id], options) do |json_response|
|
92
|
+
print_green_success "Assigned host device to target server"
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
def attach(args)
|
97
|
+
options = {}
|
98
|
+
params = {}
|
99
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
100
|
+
opts.banner = "Usage: #{prog_name} hosts attach [host] [device]"
|
101
|
+
build_standard_update_options(opts, options)
|
102
|
+
opts.footer = <<-EOT
|
103
|
+
Attach a host device.
|
104
|
+
[host] is required. This is the id of the host.
|
105
|
+
[device] is required. This is the id of the device.
|
106
|
+
EOT
|
107
|
+
end
|
108
|
+
optparse.parse!(args)
|
109
|
+
verify_args!(args:args, optparse:optparse, min:1, max:3)
|
110
|
+
connect(options)
|
111
|
+
server_id = args[0] =~ /\A\d{1,}\Z/ ? args[0].to_i : find_server_by_name(args[0])['id']
|
112
|
+
device_id = args[1] ? args[1].to_i : nil
|
113
|
+
if device_id.nil?
|
114
|
+
avail_devices = @server_devices_interface.list(server_id)['devices'].collect {|it| {'name' => it['name'], 'value' => it['id']}}
|
115
|
+
device_id = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'deviceId', 'fieldLabel' => 'Device', 'type' => 'select', 'selectOptions' => avail_devices, 'required' => true}], options[:options], @api_client)['deviceId']
|
116
|
+
end
|
117
|
+
parse_payload(options) do |payload|
|
118
|
+
|
119
|
+
end
|
120
|
+
execute_api(@server_devices_interface, :attach, [server_id, device_id], options) do |json_response|
|
121
|
+
print_green_success "Attached host device"
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
def detach(args)
|
126
|
+
options = {}
|
127
|
+
params = {}
|
128
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
129
|
+
opts.banner = "Usage: #{prog_name} hosts detach [host] [device]"
|
130
|
+
build_standard_update_options(opts, options)
|
131
|
+
opts.footer = <<-EOT
|
132
|
+
Detach a host device.
|
133
|
+
[host] is required. This is the id of the host.
|
134
|
+
[device] is required. This is the id of the device.
|
135
|
+
EOT
|
136
|
+
end
|
137
|
+
optparse.parse!(args)
|
138
|
+
verify_args!(args:args, optparse:optparse, min:1, max:3)
|
139
|
+
connect(options)
|
140
|
+
server_id = args[0] =~ /\A\d{1,}\Z/ ? args[0].to_i : find_server_by_name(args[0])['id']
|
141
|
+
device_id = args[1] ? args[1].to_i : nil
|
142
|
+
if device_id.nil?
|
143
|
+
avail_devices = @server_devices_interface.list(server_id)['devices'].collect {|it| {'name' => it['name'], 'value' => it['id']}}
|
144
|
+
device_id = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'deviceId', 'fieldLabel' => 'Device', 'type' => 'select', 'selectOptions' => avail_devices, 'required' => true}], options[:options], @api_client)['deviceId']
|
145
|
+
end
|
146
|
+
parse_payload(options) do |payload|
|
147
|
+
|
148
|
+
end
|
149
|
+
execute_api(@server_devices_interface, :detach, [server_id, device_id], options) do |json_response|
|
150
|
+
print_green_success "Detached host device"
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
private
|
155
|
+
|
156
|
+
# helper methods
|
157
|
+
|
158
|
+
def server_device_list_column_definitions()
|
159
|
+
# {
|
160
|
+
# "ID" => 'id',
|
161
|
+
# "Name" => 'name',
|
162
|
+
# "Ref" => lambda {|it| "#{it['refType']} #{it['refId']}" },
|
163
|
+
# "Type" => lambda {|it| it['type']['name'] rescue '' },
|
164
|
+
# "Status" => lambda {|it| format_server_device_status(it) },
|
165
|
+
# "External ID" => 'externalId',
|
166
|
+
# "Domain ID" => 'domainId',
|
167
|
+
# "Bus" => 'bus',
|
168
|
+
# "Slot" => 'slot',
|
169
|
+
# "Device" => 'device',
|
170
|
+
# "Vendor ID" => 'vendorId',
|
171
|
+
# "Product ID" => 'productId',
|
172
|
+
# "Function ID" => 'functionId',
|
173
|
+
# "Unique ID" => 'uniqueId',
|
174
|
+
# "IOMMU Group" => 'iommuGroup',
|
175
|
+
# "IOMMU Device Count" => 'iommuDeviceCount',
|
176
|
+
# }
|
177
|
+
{
|
178
|
+
"ID" => 'id',
|
179
|
+
"Name" => 'name',
|
180
|
+
"Type" => lambda {|it| it['type']['name'] rescue '' },
|
181
|
+
"Bus" => 'bus',
|
182
|
+
"Slot" => 'slot',
|
183
|
+
"Status" => lambda {|it| format_server_device_status(it) },
|
184
|
+
"Assignee" => lambda {|it| "#{it['refType']} #{it['refId']}" },
|
185
|
+
}
|
186
|
+
end
|
187
|
+
|
188
|
+
def server_device_column_definitions()
|
189
|
+
server_device_list_column_definitions()
|
190
|
+
end
|
191
|
+
|
192
|
+
def format_server_device_status(server_device, return_color=cyan)
|
193
|
+
out = ""
|
194
|
+
status_string = server_device['status'].to_s.upcase
|
195
|
+
if status_string == 'ATTACHED' # || status_string == 'ASSIGNED'
|
196
|
+
out << "#{green}#{status_string.upcase}#{return_color}"
|
197
|
+
elsif status_string == "PENDING"
|
198
|
+
out << "#{yellow}#{status_string.upcase}#{return_color}"
|
199
|
+
elsif status_string
|
200
|
+
out << "#{cyan}#{status_string.upcase}#{return_color}"
|
201
|
+
else
|
202
|
+
out << ""
|
203
|
+
end
|
204
|
+
out
|
205
|
+
end
|
206
|
+
|
207
|
+
end
|
@@ -329,7 +329,9 @@ module Morpheus::Cli::ProvisioningHelper
|
|
329
329
|
print_red_alert "Server not found by name #{name}"
|
330
330
|
exit 1
|
331
331
|
elsif results['servers'].size > 1
|
332
|
-
print_red_alert "Multiple
|
332
|
+
print_red_alert "Multiple Servers exist with the name '#{name}'"
|
333
|
+
puts_error as_pretty_table(results['servers'], [:id, :name], {color:red})
|
334
|
+
print_red_alert "Try using ID instead"
|
333
335
|
exit 1
|
334
336
|
end
|
335
337
|
return results['servers'][0]
|
data/lib/morpheus/cli/version.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.5
|
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-04-10 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: public_suffix
|
@@ -365,6 +365,7 @@ files:
|
|
365
365
|
- lib/morpheus/api/security_package_types_interface.rb
|
366
366
|
- lib/morpheus/api/security_packages_interface.rb
|
367
367
|
- lib/morpheus/api/security_scans_interface.rb
|
368
|
+
- lib/morpheus/api/server_devices_interface.rb
|
368
369
|
- lib/morpheus/api/server_types_interface.rb
|
369
370
|
- lib/morpheus/api/servers_interface.rb
|
370
371
|
- lib/morpheus/api/service_catalog_interface.rb
|
@@ -548,6 +549,7 @@ files:
|
|
548
549
|
- lib/morpheus/cli/commands/security_packages.rb
|
549
550
|
- lib/morpheus/cli/commands/security_scans.rb
|
550
551
|
- lib/morpheus/cli/commands/self_service_command.rb
|
552
|
+
- lib/morpheus/cli/commands/server_devices_command.rb
|
551
553
|
- lib/morpheus/cli/commands/service_catalog_command.rb
|
552
554
|
- lib/morpheus/cli/commands/service_plans_command.rb
|
553
555
|
- lib/morpheus/cli/commands/set_prompt_command.rb
|