Re: [PATCH 1/2] NTP switch functionality (DatetimeSpoke)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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")

> +    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.

-- 
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)

Attachment: pgpwkKStsc7Wq.pgp
Description: PGP signature

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux