On Fri, 2012-05-18 at 11:32 -0700, Brian C. Lane wrote: > On Fri, May 18, 2012 at 05:18:04PM +0200, Vratislav Podzimek wrote: > > When the NTP switch is turned ON/OFF we want to start/stop the chronyd.service > > and make the date/time setting widgets (in)active. > > --- > > pyanaconda/iutil.py | 25 +++++++++++++ > > pyanaconda/ui/gui/spokes/datetime_spoke.py | 53 ++++++++++++++++++++++++++- > > pyanaconda/ui/gui/spokes/datetime_spoke.ui | 1 + > > 3 files changed, 77 insertions(+), 2 deletions(-) > > > > diff --git a/pyanaconda/iutil.py b/pyanaconda/iutil.py > > index e7a4574..d4c5857 100644 > > --- a/pyanaconda/iutil.py > > +++ b/pyanaconda/iutil.py > > @@ -1015,3 +1015,28 @@ def lsmod(): > > with open("/proc/modules") as f: > > lines = f.readlines() > > return [l.split()[0] for l in lines] > > + > > +def _run_systemctl(command, service): > > + """ > > + Runs 'systemctl command service.service' > > + > > + @return: exit status of the systemctl > > + > > + """ > > + > > + service_name = service + ".service" > > + ret = execWithRedirect("systemctl", [command, service_name], stdin=None, > > + stdout="/dev/null") > > We echo commands and their output to tty5, and stdin defaults to None > so this should be: > > stdout = "/dev/tty5", stderr = "/dev/tty5" > > > + ntp_working = iutil.service_running("chronyd") and has_active_network > > It may be better to reverse them so that you don't make a call to > service_running unless has_active_network is True > > ntp_working = has_active_network and iutil.service_running("chronyd") Good points, I will change both before pushing. > > > + def _show_no_network_warning(self): > > + self.window.set_info(Gtk.MessageType.WARNING, > > + _("You need to set up network first if you "\ > > + "want to use NTP")) > > If I'm reading this right, you call this only when on is attempted with > no networking. It would be better if this was shown to the user as soon > as they entered the spoke so that they aren't surprised, or even disable > the spoke with a note about networking needed for it. It is also called in the refresh method. There is no need to disable the whole spoke just because network is not set up. If somebody doesn't want to use NTP, they can set time and date manually without network. -- Vratislav Podzimek <vpodzime@xxxxxxxxxx> _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list