Commit 9cc29163 authored by Christian Jung's avatar Christian Jung

better error handling

parent 1a22ea83
Pipeline #57263821 passed with stage
in 4 seconds
...@@ -4,26 +4,28 @@ begin ...@@ -4,26 +4,28 @@ begin
# get currently selected tags # get currently selected tags
current_tag = $evm.root["dialog_tag_control_1"] current_tag = $evm.root["dialog_tag_control_1"]
$evm.log("info", "Current Tag is: #{current_tag}") $evm.log("info", "Current Tag is: #{current_tag}")
tag_name = current_tag[0].name if current_tag[0].name.nil? then
lans['!'] = '-- select tag first --'
$evm.vmdb(:ems_cluster).all.each do |cluster| else
tags = cluster.tags $evm.vmdb(:ems_cluster).all.each do |cluster|
$evm.log("info", "Current cluster #{cluster.name} tags: #{tags}") tags = cluster.tags
$evm.log("info", "Checking if current tag matches department/#{tag_name}") $evm.log("info", "Current cluster #{cluster.name} tags: #{tags}")
cluster.tags.each do |tag| $evm.log("info", "Checking if current tag matches department/#{tag_name}")
if tag == "department/#{tag_name}" then cluster.tags.each do |tag|
$evm.log("info", "Tag matches") if tag == "department/#{tag_name}" then
$evm.log("info", "Tag matches")
cluster.hosts.each do |host| cluster.hosts.each do |host|
lans['!'] = '-- select from list --' lans['!'] = '-- select from list --'
host.lans.each do |lan| host.lans.each do |lan|
lans[lan.id] = "#{lan.name} (tag: #{lan.tag})" lans[lan.id] = "#{lan.name} (tag: #{lan.tag})"
end
end end
else
$evm.log("info", "Tag does not match")
end end
else end
$evm.log("info", "Tag does not match") end
end
end
end end
if lan = {} then if lan = {} then
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment