[yast-commit] <web-client> master : force UTC hardware clock only if time is set via NTP(bnc#557205) release 0.0.13
ref: refs/heads/master commit 4315c30a11cb4485b3849f6ba66a6cded5fc5f8c Author: Josef Reidinger <jreidinger@suse.cz> Date: Mon Nov 23 11:24:42 2009 +0100 force UTC hardware clock only if time is set via NTP(bnc#557205) release 0.0.13 --- .../app/controllers/systemtime_controller.rb | 1 + plugins/systemtime/lib/systemtime.rb | 2 - .../package/yast2-webclient-systemtime.changes | 6 +++ .../package/yast2-webclient-systemtime.spec | 2 +- .../test/functional/systemtime_controller_test.rb | 36 ++++++++++++++++++-- 5 files changed, 41 insertions(+), 6 deletions(-) diff --git a/plugins/systemtime/app/controllers/systemtime_controller.rb b/plugins/systemtime/app/controllers/systemtime_controller.rb index 20275d1..1ad1e38 100644 --- a/plugins/systemtime/app/controllers/systemtime_controller.rb +++ b/plugins/systemtime/app/controllers/systemtime_controller.rb @@ -96,6 +96,7 @@ class SystemtimeController < ApplicationController when "manual" fill_proxy_with_time t,params when "ntp_sync" + t.utcstatus = "UTC" #ntp implementation force utc in hardware clock (bnc#556467) ntp = load_proxy 'org.opensuse.yast.modules.yapi.ntp' return false unless ntp ntp.synchronize = true diff --git a/plugins/systemtime/lib/systemtime.rb b/plugins/systemtime/lib/systemtime.rb index 94b3191..fd95c52 100644 --- a/plugins/systemtime/lib/systemtime.rb +++ b/plugins/systemtime/lib/systemtime.rb @@ -12,6 +12,4 @@ def fill_proxy_with_timezone(proxy,params,timezones) tmz = region.entries.find { |e| e.name == params[:timezone]} proxy.timezone = tmz.id if tmz - - proxy.utcstatus = "UTC" #allways UTC see bnc#556467 end diff --git a/plugins/systemtime/package/yast2-webclient-systemtime.changes b/plugins/systemtime/package/yast2-webclient-systemtime.changes index 2d06ac9..805aefa 100644 --- a/plugins/systemtime/package/yast2-webclient-systemtime.changes +++ b/plugins/systemtime/package/yast2-webclient-systemtime.changes @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Mon Nov 23 10:17:40 UTC 2009 - jreidinger@novell.com + +- force setting hardware clock to UTC only if used NTP (bnc#557205) +- 0.0.13 + +------------------------------------------------------------------- Fri Nov 20 10:27:20 UTC 2009 - jreidinger@novell.com - always set hardware clock to UTC (bnc#556467) diff --git a/plugins/systemtime/package/yast2-webclient-systemtime.spec b/plugins/systemtime/package/yast2-webclient-systemtime.spec index e3f3c26..d4a535a 100644 --- a/plugins/systemtime/package/yast2-webclient-systemtime.spec +++ b/plugins/systemtime/package/yast2-webclient-systemtime.spec @@ -14,7 +14,7 @@ PreReq: yast2-webclient >= 0.0.2 License: GPL v2 only Group: Productivity/Networking/Web/Utilities Autoreqprov: on -Version: 0.0.12 +Version: 0.0.13 Release: 0 Summary: YaST2 - Webclient - SystemTime Source: www.tar.bz2 diff --git a/plugins/systemtime/test/functional/systemtime_controller_test.rb b/plugins/systemtime/test/functional/systemtime_controller_test.rb index 815daa0..2ce2a9a 100644 --- a/plugins/systemtime/test/functional/systemtime_controller_test.rb +++ b/plugins/systemtime/test/functional/systemtime_controller_test.rb @@ -12,6 +12,24 @@ class SystemtimeControllerTest < ActionController::TestCase end end + class NtpProxy + attr_accessor :result, :permissions, :timeout + def find + return result + end + end + + class Ntp + attr_accessor :synchronize + + def initialize + @synchronize = false + end + + def save + end + end + class Region attr_accessor :name, :central, :entries def initialize (name, central, entries) @@ -40,7 +58,7 @@ class SystemtimeControllerTest < ActionController::TestCase ] @time = "12:18:00" @date = "07/02/2009" - @utcstatus = "UTC" + @utcstatus = "localtime" @timezone = "Europe/Prague" end @@ -99,7 +117,7 @@ class SystemtimeControllerTest < ActionController::TestCase assert_redirected_to :action => "index" assert @result.saved - assert_equal @result.utcstatus, "UTC" + assert_equal "localtime",@result.utcstatus end def test_commit_wizard @@ -113,7 +131,19 @@ class SystemtimeControllerTest < ActionController::TestCase assert_redirected_to :controller => "controlpanel", :action => "nextstep" assert @result.saved - assert_equal @result.utcstatus, "UTC" + assert_equal "localtime",@result.utcstatus + end + + def test_ntp_force_utc + YaST::ServiceResource.stubs(:proxy_for).with('org.opensuse.yast.modules.yapi.time').returns(@proxy) + ntpproxy = NtpProxy.new + ntpproxy.result = Ntp.new + YaST::ServiceResource.stubs(:proxy_for).with('org.opensuse.yast.modules.yapi.ntp').returns(ntpproxy) + post :update, { :timeconfig => "ntp_sync" } + assert_response :redirect + assert_redirected_to :action => "index" + assert ntpproxy.result.synchronize + assert_equal "UTC", @result.utcstatus end end -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
Josef Reidinger