From 5a81924d84b3d2e0494e05d707142a28cd1fa9ad Mon Sep 17 00:00:00 2001 From: Vlastimil Holer Date: Tue, 7 May 2019 14:42:13 +0200 Subject: [PATCH] B #3229: Retry onehost sync on IOError (#3309) (cherry picked from commit 4a0b133cd23dbe4c2c3a764030c910a10563bcec) --- src/cli/one_helper/onehost_helper.rb | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/cli/one_helper/onehost_helper.rb b/src/cli/one_helper/onehost_helper.rb index 6b1cb3b4ec..0ca43c4452 100644 --- a/src/cli/one_helper/onehost_helper.rb +++ b/src/cli/one_helper/onehost_helper.rb @@ -369,9 +369,20 @@ class OneHostHelper < OpenNebulaHelper::OneHelper " #{host['NAME']}:#{remote_dir} 2> /dev/null" end - `#{sync_cmd} 2>/dev/null` + retries = 3 - if !$CHILD_STATUS.success? + begin + `#{sync_cmd} 2>/dev/null` + rescue IOError + # Workaround for broken Ruby 2.5 + # https://github.com/OpenNebula/one/issues/3229 + if (retries -= 1) > 0 + sleep 1 + retry + end + end + + if $CHILD_STATUS.nil? || !$CHILD_STATUS.success? error_lock.synchronize do host_errors << host['NAME'] end