aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-installer/anaconda/files/0027-disable-ntp-support.patch
blob: 977c22016c8df38354fc4d12fc98e4cb0a1c8c62 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
From 0fad2179c0b760157abcf2ae5ceca7c8f396fadd Mon Sep 17 00:00:00 2001
From: Hongxu Jia <hongxu.jia@windriver.com>
Date: Sat, 29 Jun 2019 12:13:28 +0800
Subject: [PATCH] disable ntp support

The upstream RHEL7 use chrony.service to support ntp,
it did not exist in oe-core, so remove it.

Do not support NTP, here are the reasons:
- For systemd based, it already had NTP supported,
  another ntp will cause confliction.

- We also need to consider the situation of sysvinit
  based system, it requires a ntp package to be
  installed.

Upstream-Status: Inappropriate [oe specific]

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
 pyanaconda/kickstart.py                       | 54 +---------------
 pyanaconda/ui/gui/spokes/datetime_spoke.glade | 74 ----------------------
 pyanaconda/ui/gui/spokes/datetime_spoke.py    | 89 ---------------------------
 3 files changed, 1 insertion(+), 216 deletions(-)

diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
index 88d552d..5b69ebb 100644
--- a/pyanaconda/kickstart.py
+++ b/pyanaconda/kickstart.py
@@ -760,35 +760,7 @@ class Timezone(RemovedCommand):
         return timezone_proxy.GenerateKickstart()
 
     def setup(self, ksdata):
-        timezone_proxy = TIMEZONE.get_proxy()
-        services_proxy = SERVICES.get_proxy()
-
-        enabled_services = services_proxy.EnabledServices
-        disabled_services = services_proxy.DisabledServices
-
-        # do not install and use NTP package
-        if not timezone_proxy.NTPEnabled or NTP_PACKAGE in ksdata.packages.excludedList:
-            if util.service_running(NTP_SERVICE) and conf.system.can_set_time_synchronization:
-                ret = util.stop_service(NTP_SERVICE)
-                if ret != 0:
-                    timezone_log.error("Failed to stop NTP service")
-
-            if NTP_SERVICE not in disabled_services:
-                disabled_services.append(NTP_SERVICE)
-                services_proxy.SetDisabledServices(disabled_services)
-        # install and use NTP package
-        else:
-            if not util.service_running(NTP_SERVICE) and conf.system.can_set_time_synchronization:
-                ret = util.start_service(NTP_SERVICE)
-                if ret != 0:
-                    timezone_log.error("Failed to start NTP service")
-
-            self.packages.append(NTP_PACKAGE)
-
-            if not NTP_SERVICE in enabled_services and \
-                    not NTP_SERVICE in disabled_services:
-                enabled_services.append(NTP_SERVICE)
-                services_proxy.SetEnabledServices(enabled_services)
+        pass
 
     def execute(self):
         # get the DBus proxies
@@ -805,30 +777,6 @@ class Timezone(RemovedCommand):
 
         timezone.write_timezone_config(timezone_proxy, util.getSysroot())
 
-        # write out NTP configuration (if set) and --nontp is not used
-        kickstart_ntp_servers = timezone_proxy.NTPServers
-
-        if timezone_proxy.NTPEnabled and kickstart_ntp_servers:
-            chronyd_conf_path = os.path.normpath(util.getSysroot() + ntp.NTP_CONFIG_FILE)
-            pools, servers = ntp.internal_to_pools_and_servers(kickstart_ntp_servers)
-            if os.path.exists(chronyd_conf_path):
-                timezone_log.debug("Modifying installed chrony configuration")
-                try:
-                    ntp.save_servers_to_config(pools, servers, conf_file_path=chronyd_conf_path)
-                except ntp.NTPconfigError as ntperr:
-                    timezone_log.warning("Failed to save NTP configuration: %s", ntperr)
-            # use chrony conf file from installation environment when
-            # chrony is not installed (chrony conf file is missing)
-            else:
-                timezone_log.debug("Creating chrony configuration based on the "
-                                   "configuration from installation environment")
-                try:
-                    ntp.save_servers_to_config(pools, servers,
-                                               conf_file_path=ntp.NTP_CONFIG_FILE,
-                                               out_file_path=chronyd_conf_path)
-                except ntp.NTPconfigError as ntperr:
-                    timezone_log.warning("Failed to save NTP configuration without chrony package: %s", ntperr)
-
 class User(COMMANDS.User):
     def execute(self, storage, ksdata, users):
 
diff --git a/pyanaconda/ui/gui/spokes/datetime_spoke.glade b/pyanaconda/ui/gui/spokes/datetime_spoke.glade
index 37c7c6e..875cfea 100644
--- a/pyanaconda/ui/gui/spokes/datetime_spoke.glade
+++ b/pyanaconda/ui/gui/spokes/datetime_spoke.glade
@@ -460,80 +460,6 @@
                                 <property name="position">3</property>
                               </packing>
                             </child>
-                            <child>
-                              <object class="GtkAlignment" id="alignment4">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="xalign">1</property>
-                                <property name="xscale">0.20000000298023224</property>
-                                <property name="right_padding">24</property>
-                                <child>
-                                  <object class="GtkBox" id="box6">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">False</property>
-                                    <property name="halign">end</property>
-                                    <child>
-                                      <object class="GtkLabel" id="networkTimeLabel">
-                                        <property name="visible">True</property>
-                                        <property name="can_focus">False</property>
-                                        <property name="label" translatable="yes" context="GUI|Date and Time">_Network Time</property>
-                                        <property name="use_underline">True</property>
-                                        <property name="mnemonic_widget">networkTimeSwitch</property>
-                                      </object>
-                                      <packing>
-                                        <property name="expand">False</property>
-                                        <property name="fill">True</property>
-                                        <property name="padding">3</property>
-                                        <property name="position">0</property>
-                                      </packing>
-                                    </child>
-                                    <child>
-                                      <object class="GtkSwitch" id="networkTimeSwitch">
-                                        <property name="visible">True</property>
-                                        <property name="can_focus">True</property>
-                                        <signal name="notify::active" handler="on_ntp_switched" swapped="no"/>
-                                        <child internal-child="accessible">
-                                          <object class="AtkObject" id="networkTimeSwitch-atkobject">
-                                            <property name="AtkObject::accessible-name" translatable="yes">Use Network Time</property>
-                                          </object>
-                                        </child>
-                                      </object>
-                                      <packing>
-                                        <property name="expand">False</property>
-                                        <property name="fill">True</property>
-                                        <property name="padding">1</property>
-                                        <property name="position">1</property>
-                                      </packing>
-                                    </child>
-                                    <child>
-                                      <object class="GtkButton" id="ntpConfigButton">
-                                        <property name="visible">True</property>
-                                        <property name="can_focus">True</property>
-                                        <property name="receives_default">True</property>
-                                        <property name="image">configImage</property>
-                                        <signal name="clicked" handler="on_ntp_config_clicked" swapped="no"/>
-                                        <child internal-child="accessible">
-                                          <object class="AtkObject" id="ntpConfigButton-atkobject">
-                                            <property name="AtkObject::accessible-name" translatable="yes">Configure NTP</property>
-                                          </object>
-                                        </child>
-                                      </object>
-                                      <packing>
-                                        <property name="expand">False</property>
-                                        <property name="fill">True</property>
-                                        <property name="padding">1</property>
-                                        <property name="position">2</property>
-                                      </packing>
-                                    </child>
-                                  </object>
-                                </child>
-                              </object>
-                              <packing>
-                                <property name="expand">True</property>
-                                <property name="fill">True</property>
-                                <property name="position">4</property>
-                              </packing>
-                            </child>
                           </object>
                         </child>
                       </object>
diff --git a/pyanaconda/ui/gui/spokes/datetime_spoke.py b/pyanaconda/ui/gui/spokes/datetime_spoke.py
index 9ce853d..a83c2c9 100644
--- a/pyanaconda/ui/gui/spokes/datetime_spoke.py
+++ b/pyanaconda/ui/gui/spokes/datetime_spoke.py
@@ -500,8 +500,6 @@ class DatetimeSpoke(FirstbootSpokeMixIn, NormalSpoke):
         self._year_format, suffix = formats[widgets.index(year_box)]
         year_label.set_text(suffix)
 
-        self._ntpSwitch = self.builder.get_object("networkTimeSwitch")
-
         self._regions_zones = get_all_regions_and_timezones()
 
         # Set the initial sensitivity of the AM/PM toggle based on the time-type selected
@@ -510,9 +508,6 @@ class DatetimeSpoke(FirstbootSpokeMixIn, NormalSpoke):
         if not conf.system.can_set_system_clock:
             self._hide_date_time_setting()
 
-        self._config_dialog = NTPconfigDialog(self.data, self._timezone_module)
-        self._config_dialog.initialize()
-
         threadMgr.add(AnacondaThread(name=constants.THREAD_DATE_TIME,
                                      target=self._initialize))
 
@@ -600,8 +595,6 @@ class DatetimeSpoke(FirstbootSpokeMixIn, NormalSpoke):
             # TODO: seen should be set from the module
             self._kickstarted = False
 
-        self._timezone_module.proxy.SetNTPEnabled(self._ntpSwitch.get_active())
-
     def execute(self):
         if self._update_datetime_timer is not None:
             self._update_datetime_timer.cancel()
@@ -639,20 +632,6 @@ class DatetimeSpoke(FirstbootSpokeMixIn, NormalSpoke):
 
         self._update_datetime()
 
-        has_active_network = self._network_module.proxy.Connected
-        if not has_active_network:
-            self._show_no_network_warning()
-        else:
-            self.clear_info()
-            gtk_call_once(self._config_dialog.refresh_servers_state)
-
-        if conf.system.can_set_time_synchronization:
-            ntp_working = has_active_network and util.service_running(NTP_SERVICE)
-        else:
-            ntp_working = self._timezone_module.proxy.NTPEnabled
-
-        self._ntpSwitch.set_active(ntp_working)
-
     @async_action_wait
     def _set_timezone(self, timezone):
         """
@@ -1111,71 +1090,3 @@ class DatetimeSpoke(FirstbootSpokeMixIn, NormalSpoke):
         #contains all date/time setting widgets
         footer_alignment = self.builder.get_object("footerAlignment")
         footer_alignment.set_sensitive(sensitive)
-
-    def _show_no_network_warning(self):
-        self.set_warning(_("You need to set up networking first if you "\
-                           "want to use NTP"))
-
-    def _show_no_ntp_server_warning(self):
-        self.set_warning(_("You have no working NTP server configured"))
-
-    def on_ntp_switched(self, switch, *args):
-        if switch.get_active():
-            #turned ON
-            if not conf.system.can_set_time_synchronization:
-                #cannot touch runtime system, not much to do here
-                return
-
-            if not self._network_module.proxy.Connected:
-                self._show_no_network_warning()
-                switch.set_active(False)
-                return
-            else:
-                self.clear_info()
-
-                working_server = self._config_dialog.working_server
-                if working_server is None:
-                    self._show_no_ntp_server_warning()
-                else:
-                    #we need a one-time sync here, because chronyd would not change
-                    #the time as drastically as we need
-                    ntp.one_time_sync_async(working_server)
-
-            ret = util.start_service(NTP_SERVICE)
-            self._set_date_time_setting_sensitive(False)
-
-            #if starting chronyd failed and chronyd is not running,
-            #set switch back to OFF
-            if (ret != 0) and not util.service_running(NTP_SERVICE):
-                switch.set_active(False)
-
-        else:
-            #turned OFF
-            if not conf.system.can_set_time_synchronization:
-                #cannot touch runtime system, nothing to do here
-                return
-
-            self._set_date_time_setting_sensitive(True)
-            ret = util.stop_service(NTP_SERVICE)
-
-            #if stopping chronyd failed and chronyd is running,
-            #set switch back to ON
-            if (ret != 0) and util.service_running(NTP_SERVICE):
-                switch.set_active(True)
-
-            self.clear_info()
-
-    def on_ntp_config_clicked(self, *args):
-        self._config_dialog.refresh()
-
-        with self.main_window.enlightbox(self._config_dialog.window):
-            response = self._config_dialog.run()
-
-        if response == 1:
-            pools, servers = self._config_dialog.pools_servers
-            self._timezone_module.proxy.SetNTPServers(ntp.pools_servers_to_internal(pools, servers))
-
-            if self._config_dialog.working_server is None:
-                self._show_no_ntp_server_warning()
-            else:
-                self.clear_info()
-- 
2.7.4