Author: varkoly
Date: Fri Apr 9 17:20:47 2010
New Revision: 61637
URL: http://svn.opensuse.org/viewcvs/yast?rev=61637&view=rev
Log:
* New maintainer
* NTP configuration is possible in first stage even no network is
configured.
* In the NTP proposal now it is possible to select if the NTP service
will be started as deamon or not
Modified:
trunk/ntp-client/MAINTAINER
trunk/ntp-client/src/ntp-client_finish.ycp
trunk/ntp-client/src/ntp-client_proposal.ycp
trunk/ntp-client/testsuite/tests/Read.out
trunk/ntp-client/testsuite/tests/Write.out
Modified: trunk/ntp-client/MAINTAINER
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ntp-client/MAINTAINER?rev=61637&r1=61636&r2=61637&view=diff
==============================================================================
--- trunk/ntp-client/MAINTAINER (original)
+++ trunk/ntp-client/MAINTAINER Fri Apr 9 17:20:47 2010
@@ -1 +1 @@
-Martin Vidner
+Peter Varkoly
Modified: trunk/ntp-client/src/ntp-client_finish.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ntp-client/src/ntp-client_finish.ycp?rev=61637&r1=61636&r2=61637&view=diff
==============================================================================
--- trunk/ntp-client/src/ntp-client_finish.ycp (original)
+++ trunk/ntp-client/src/ntp-client_finish.ycp Fri Apr 9 17:20:47 2010
@@ -43,7 +43,7 @@
list<string> ss = NtpClient::GetUsedNtpServers();
// ntp.conf from the RPM
- NtpClient::Read();
+ NtpClient::ProcessNtpConf();
// put users server(s) back
foreach (string server, ss, {
Modified: trunk/ntp-client/src/ntp-client_proposal.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ntp-client/src/ntp-client_proposal.ycp?rev=61637&r1=61636&r2=61637&view=diff
==============================================================================
--- trunk/ntp-client/src/ntp-client_proposal.ycp (original)
+++ trunk/ntp-client/src/ntp-client_proposal.ycp Fri Apr 9 17:20:47 2010
@@ -45,13 +45,17 @@
string ui_help_text() {
// help text
- return _("<p>Press <b>Synchronize Now</b>, to get your system time set correctly using the selected NTP server. If you want to make use of NTP permanently, enable the <b>Save NTP Configuration</b> option</p>") +
+ string tmp = _("<p>Press <b>Synchronize Now</b>, to get your system time set correctly using the selected NTP server. If you want to make use of NTP permanently, enable the <b>Save NTP Configuration</b> option</p>");
+
+ tmp = tmp + _("<p>Enabling <b>Run NTP as daemon</b> option, the NTP service will be started as deamon. Otherwise the system time will be synchronized periodicaly. The default interval is 15 min. You can change it after installation with the <b>yast2 ntp-client module</b>.</p>");
// help text, cont.
- _("<p>Using the <b>Configure</b> button, open the advanced NTP configuration.</p>") +
+ if( ! Stage::initial() )
+ tmp = tmp + _("<p>Using the <b>Configure</b> button, open the advanced NTP configuration.</p>");
// help text, cont.
- _("<p>Synchronization with the NTP server can be done only when the network is configured.</p>");
+ tmp = tmp + _("<p>Synchronization with the NTP server can be done only when the network is configured.</p>");
+ return tmp;
}
// FIXME must go to module to preserve value
@@ -59,6 +63,7 @@
void ui_enable_disable_widgets (boolean enabled) {
UI::ChangeWidget (`id (`ntp_address), `Enabled, enabled);
+ UI::ChangeWidget (`id (`run_service), `Enabled, enabled);
UI::ChangeWidget (`id (`ntp_now), `Enabled, enabled);
UI::ChangeWidget (`id (`ntp_save), `Enabled, enabled);
if (UI::WidgetExists (`id (`ntp_configure))) // bnc#483787
@@ -162,6 +167,11 @@
`HBox (
`HSpacing (0.5),
// check box label
+ `Left (`CheckBox (`id (`run_service), _("&Run NTP as daemon")))
+ ),
+ `HBox (
+ `HSpacing (0.5),
+ // check box label
`Left (`CheckBox (`id (`ntp_save), _("&Save NTP Configuration")))
)
)),
@@ -173,7 +183,8 @@
`VSpacing (0.3),
// push button label
// bnc#449615: only simple config for inst-sys
- Stage::initial() ? `Label("") : `Left (`PushButton (`id (`ntp_configure), _("&Configure...")))
+ Stage::initial() ? `Label("") : `Left (`PushButton (`id (`ntp_configure), _("&Configure..."))),
+ `Label("")
))
));
@@ -182,7 +193,8 @@
if (!NetworkService::isNetworkRunning())
{
y2warning("Network is not running, NTP synchronization will not be available");
- UI::ChangeWidget(`id(`ntp_content), `Enabled, false); // FIXME it is outside
+// If network not running we have to be able to configure ntp nevertheless
+// UI::ChangeWidget(`id(`ntp_content), `Enabled, false); // FIXME it is outside
}
// ^ createui0
@@ -219,10 +231,16 @@
return ret;
}
-boolean WriteNtpSettings (string ntp_server) {
+boolean WriteNtpSettings (string ntp_server,boolean run_service) {
NtpClient::modified = true;
AddSingleServer(ntp_server);
+ if( ! run_service )
+ {
+ NtpClient::synchronize_time=true;
+ NtpClient::run_service=false;
+ NtpClient::sync_interval=15;
+ }
//OK, so we stored the server address
//In inst-sys we don't need to care further
@@ -249,6 +267,7 @@
symbol Write(map param) {
symbol ret = nil;
string ntp_server = param["server"]:"";
+ boolean run_service = param["run_service"]:true;
if (ntp_server == "")
// get the value from UI only when it wasn't given as a parameter
ntp_server = (string) UI::QueryWidget(`id(`ntp_address), `Value);
@@ -257,7 +276,7 @@
if (param["write_only"]:false)
{
- WriteNtpSettings (ntp_server);
+ WriteNtpSettings (ntp_server,run_service);
return `success;
}
@@ -307,7 +326,7 @@
// User wants to more than running sntp (synchronize on boot)
if (!ntpdate_only)
{
- WriteNtpSettings (ntp_server);
+ WriteNtpSettings (ntp_server,run_service);
}
return `success;
@@ -349,8 +368,12 @@
boolean ui_try_save() {
map argmap = $[];
+ argmap["ntpdate_only"] = false;
+ argmap["run_service"] = false;
if (UI::QueryWidget (`id (`ntp_save), `Value) == false)
argmap["ntpdate_only"] = true;
+ if (UI::QueryWidget (`id (`run_service), `Value) == true)
+ argmap["run_service"] = true;
symbol rv = Write (argmap);
@@ -369,6 +392,10 @@
{
return false; // loop on
}
+ else if (!argmap["ntpdate_only"]:false)
+ {
+ WriteNtpSettings (server,argmap["run_service"]:false); //may be the server is realy not accessable
+ }
}
// success, exit
return true;
Modified: trunk/ntp-client/testsuite/tests/Read.out
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ntp-client/testsuite/tests/Read.out?rev=61637&r1=61636&r2=61637&view=diff
==============================================================================
--- trunk/ntp-client/testsuite/tests/Read.out (original)
+++ trunk/ntp-client/testsuite/tests/Read.out Fri Apr 9 17:20:47 2010
@@ -6,6 +6,7 @@
Log Failed to read country names
Read .target.ycp "/var/lib/YaST2/ad_ntp_data.ycp" nil
Read .etc.ntp_conf.all $["comment":"", "file":-1, "kind":"section", "name":"", "type":-1, "value":[$["comment":"", "kind":"value", "name":"server", "type":0, "value":"ntp1 options1"], $["comment":"", "kind":"value", "name":"server", "type":0, "value":"127.127.1.2 options_clock"], $["comment":"", "kind":"value", "name":"fudge", "type":0, "value":"127.127.1.2fudge_clock"], $["comment":"", "kind":"value", "name":"server", "type":0, "value":"ntp2 options2"], $["comment":"", "kind":"value", "name":"peer", "type":0, "value":"peer1 options_peer"]]]
+Read .cron "/etc/cron.d/novell.ntp-synchronize" nil
Read .sysconfig.ntp.NTPD_RUN_CHROOTED "yes"
Return true
-Return $["ntp_policy":"", "peers":[$["address":"ntp1", "comment":"", "options":" options1", "type":"server"], $["address":"127.127.1.2", "comment":"", "options":" options_clock", "type":"__clock"], $["address":"ntp2", "comment":"", "options":" options2", "type":"server"], $["address":"peer1", "comment":"", "options":" options_peer", "type":"peer"]], "start_at_boot":false, "start_in_chroot":true]
+Return $["ntp_policy":"", "peers":[$["address":"ntp1", "comment":"", "options":" options1", "type":"server"], $["address":"127.127.1.2", "comment":"", "options":" options_clock", "type":"__clock"], $["address":"ntp2", "comment":"", "options":" options2", "type":"server"], $["address":"peer1", "comment":"", "options":" options_peer", "type":"peer"]], "start_at_boot":false, "start_in_chroot":true, "sync_interval":nil, "synchronize_time":false]
Modified: trunk/ntp-client/testsuite/tests/Write.out
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ntp-client/testsuite/tests/Write.out?rev=61637&r1=61636&r2=61637&view=diff
==============================================================================
--- trunk/ntp-client/testsuite/tests/Write.out (original)
+++ trunk/ntp-client/testsuite/tests/Write.out Fri Apr 9 17:20:47 2010
@@ -7,4 +7,5 @@
Execute .target.bash "/sbin/netconfig update" 0
Write .sysconfig.ntp.NTPD_RUN_CHROOTED "yes" true
Write .sysconfig.ntp nil true
+Execute .target.bash "test -e /etc/cron.d/novell.ntp-synchronize && rm /etc/cron.d/novell.ntp-synchronize;" 0
Return true
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org