ref: refs/heads/backgroud_patches_bnc550934
commit 4ac64a5d0fa96d40ceb46a304004f08edb9bcfcb
Author: Josef Reidinger
Date: Wed Nov 18 10:35:28 2009 +0100
avoid timeout error for time move by ntp (bnc#553980), avoid catching all exception, catch only expected one
---
.../app/controllers/systemtime_controller.rb | 13 ++++++-------
1 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/plugins/systemtime/app/controllers/systemtime_controller.rb b/plugins/systemtime/app/controllers/systemtime_controller.rb
index 86bb535..2deecde 100644
--- a/plugins/systemtime/app/controllers/systemtime_controller.rb
+++ b/plugins/systemtime/app/controllers/systemtime_controller.rb
@@ -101,7 +101,12 @@ class SystemtimeController < ApplicationController
ntp = load_proxy 'org.opensuse.yast.modules.yapi.ntp'
return false unless ntp
ntp.synchronize = true
- ntp.save #FIXME check return value
+ begin
+ ntp.save #FIXME check return value
+ rescue Timeout::Error => e
+ #do nothing as if you move time to future it throws this exception
+ log.info "Time moved to future by NTP"
+ end
else
logger.error "Unknown value for timeconfig #{params[:timeconfig]}"
end
@@ -116,12 +121,6 @@ class SystemtimeController < ApplicationController
#do nothing as if you move time to future it throws this exception
log.debug "Time moved to future"
flash[:notice] = _('Time settings have been written.')
- rescue ActiveResource::ClientError => e
- flash[:error] = YaST::ServiceResource.error(e)
- logger.warn e
- rescue Exception => e
- flash[:error] = e.message
- logger.warn e
end
redirect_success
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org