mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-25 02:50:08 +03:00
feature #1383: Check if item key exists in describe* commands
This commit is contained in:
parent
d5aa8b1fd9
commit
db7326bc0f
@ -74,7 +74,13 @@ CommandParser::CmdParser.new(ARGV) do
|
||||
if CloudClient::is_error?(rc)
|
||||
exit_with_code -1, "#{cmd_name}: #{rc.message}"
|
||||
else
|
||||
TABLE.show(rc['addressesSet']['item'] || [])
|
||||
if rc.empty? || rc['addressesSet'].nil? || rc['addressesSet']['item'].nil?
|
||||
addrs = []
|
||||
else
|
||||
addrs = rc['addressesSet']['item']
|
||||
end
|
||||
|
||||
TABLE.show(addrs)
|
||||
exit_with_code 0
|
||||
end
|
||||
end
|
||||
|
@ -86,7 +86,13 @@ used with an OpenNebula Cloud."
|
||||
if CloudClient::is_error?(rc)
|
||||
exit_with_code -1, "#{cmd_name}: #{rc.message}"
|
||||
else
|
||||
TABLE.show(rc['imagesSet']['item'] || [])
|
||||
if rc.empty? || rc['imagesSet'].nil? || rc['imagesSet']['item'].nil?
|
||||
imgs = []
|
||||
else
|
||||
imgs = rc['imagesSet']['item']
|
||||
end
|
||||
|
||||
TABLE.show(imgs)
|
||||
exit_with_code 0
|
||||
end
|
||||
end
|
||||
|
@ -84,7 +84,15 @@ CommandParser::CmdParser.new(ARGV) do
|
||||
if CloudClient::is_error?(rc)
|
||||
exit_with_code -1, "#{cmd_name}: #{rc.message}"
|
||||
else
|
||||
TABLE.show(rc['reservationSet']['item'][0]['instancesSet']['item'] || [])
|
||||
if rc.empty? ||
|
||||
rc['reservationSet']['item'][0]['instancesSet'].nil? ||
|
||||
rc['reservationSet']['item'][0]['instancesSet']['item'].nil?
|
||||
insts = []
|
||||
else
|
||||
insts = rc['reservationSet']['item'][0]['instancesSet']['item']
|
||||
end
|
||||
|
||||
TABLE.show(insts)
|
||||
exit_with_code 0
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user