From 7a291125f227c9380c76ac031810a546c3572ac9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Wed, 24 Aug 2016 17:37:09 +0200 Subject: [PATCH] Bug #4737: Add VN_MAD to vnet template when missing --- src/onedb/fsck.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/onedb/fsck.rb b/src/onedb/fsck.rb index 9e742eff56..3d4861c365 100644 --- a/src/onedb/fsck.rb +++ b/src/onedb/fsck.rb @@ -1960,6 +1960,21 @@ EOT "VNet #{oid}, but it could not be matched to any AR", false) end + vn_mad_e = doc.root.at_xpath("VN_MAD") + if vn_mad_e.nil? + log_error("VNet #{oid} VN_MAD element is missing", false) + else + vn_mad = vn_mad_e.text + vn_mad_tmpl_e = doc.root.at_xpath("TEMPLATE/VN_MAD") + + if (vn_mad_tmpl_e.nil? || vn_mad_tmpl_e.text != vn_mad) + log_error("VNet #{oid} VN_MAD element is missing from the TEMPLATE") + + doc.root.at_xpath("TEMPLATE").add_child( + doc.create_element("VN_MAD")).content = vn_mad + end + end + row[:body] = doc.root.to_s # commit