[Git][NTPsec/ntpsec][master] Catch ntp.packet.ControlException in ntpwait

Matt Selsky gitlab at mg.gitlab.com
Mon May 22 06:22:59 UTC 2017


Matt Selsky pushed to branch master at NTPsec / ntpsec


Commits:
3a4bf863 by Matt Selsky at 2017-05-22T02:13:27-04:00
Catch ntp.packet.ControlException in ntpwait

Mimic error messages from ntp Classic's ntp-wait when ntpwait encounters an
access control problem

Also, ensure that 'msg' is declared outside of the try/except block so that it
exists later when we test for existence, even if we have exceptions raised

Fixes GitLab issue #309

- - - - -


1 changed file:

- ntpclients/ntpwait


Changes:

=====================================
ntpclients/ntpwait
=====================================
--- a/ntpclients/ntpwait
+++ b/ntpclients/ntpwait
@@ -163,8 +163,12 @@ if __name__ == "__main__":
                 sys.stdout.write("\bntpd is not running!\n")
             continue
 
+        msg = None
         try:
             msg = session.doquery(2)     # Request system variables
+        except ntp.packet.ControlException as e:
+            sys.stderr.write("localhost: timed out, nothing received\n")
+            sys.stderr.write(e.message)
         except socket.error:
             if verbose:
                 sys.stdout.write("\b" + "*+:."[i % 4])



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/3a4bf8638b18b62394da2bac1a4b7fe412dd266f

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/3a4bf8638b18b62394da2bac1a4b7fe412dd266f
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170522/11446c1f/attachment.html>


More information about the vc mailing list