Commit c24734a8 authored by Christian Jung's avatar Christian Jung

fixed cluster selection

parent f98a9a8e
Pipeline #57274828 passed with stage
in 3 seconds
......@@ -2,30 +2,29 @@ begin
lans = {}
# get currently selected tags
current_tag = $evm.root["dialog_cluster"]
if current_tag == [] then
lans['!'] = '-- select tag first --'
current_cluster = $evm.root["dialog_cluster"]
$evm.log("info", "Current Cluster is: #{current_cluster}")
if current_cluster.nil? then
lans['!'] = '-- select cluster first --'
else
$evm.log("info", "Current Tag is: #{current_tag}")
tag_name = current_tag
$evm.vmdb(:ems_cluster).all.each do |cluster|
tags = cluster.tags
$evm.log("info", "Current cluster #{cluster.name} tags: #{tags}")
$evm.log("info", "Checking if current tag matches department/#{tag_name}")
cluster.tags.each do |tag|
if tag == "department/#{tag_name}" then
$evm.log("info", "Tag matches")
cluster = $evm.vmdb(:ems_cluster).find_by_name(current_cluster)
tags = cluster.tags
$evm.log("info", "Current cluster #{cluster.name} tags: #{tags}")
$evm.log("info", "Checking if current tag matches department/#{tag_name}")
cluster.tags.each do |tag|
if tag == "security_zone/#{tag_name}" then
$evm.log("info", "Tag matches")
cluster.hosts.each do |host|
lans['!'] = '-- select from list --'
host.lans.each do |lan|
lans[lan.id] = "#{lan.name} (tag: #{lan.tag})"
end
cluster.hosts.each do |host|
lans['!'] = '-- select from list --'
host.lans.each do |lan|
lans[lan.id] = "#{lan.name} (tag: #{lan.tag})"
end
else
$evm.log("info", "Tag does not match")
end
else
$evm.log("info", "Tag does not match")
end
end
end
......
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