From 2d1f2da7947287b8010397f869b1b78bb17530e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Tue, 23 Aug 2016 18:01:13 +0200 Subject: [PATCH] Bug #4695: Fsck fixes vnet IPs with whitespaces --- src/onedb/fsck.rb | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/onedb/fsck.rb b/src/onedb/fsck.rb index 6a11699664..5b85052fc5 100644 --- a/src/onedb/fsck.rb +++ b/src/onedb/fsck.rb @@ -1613,7 +1613,7 @@ EOT # IP first_ip = nil if (!ar.at_xpath("IP").nil?) - first_ip = IPAddr.new(ar.at_xpath("IP").text, Socket::AF_INET) + first_ip = IPAddr.new(ar.at_xpath("IP").text.strip, Socket::AF_INET) end # IP6 @@ -1715,7 +1715,18 @@ EOT # IP first_ip = nil if !net_ar.at_xpath("IP").nil? - first_ip = IPAddr.new(net_ar.at_xpath("IP").text, Socket::AF_INET) + first_ip_st = net_ar.at_xpath("IP").text + + if (first_ip_st != first_ip_st.strip) + log_error("VNet #{oid} AR #{ar_id} "<< + "IP \"#{first_ip_st}\" contains whitespaces") + + first_ip_st.strip! + + net_ar.at_xpath("IP").content = first_ip_st + end + + first_ip = IPAddr.new(first_ip_st, Socket::AF_INET) end # IP6