Compare commits

..

No commits in common. "master" and "issue-4" have entirely different histories.

2 changed files with 14 additions and 18 deletions

View File

@ -45,9 +45,6 @@ warning_t = datetime.timedelta(days=7)
unixtime = False unixtime = False
timeout = 20 # Seconds timeout = 20 # Seconds
# Cannot be changed on the command-line (yet)
server = None
def usage(msg=None): def usage(msg=None):
print("Usage: %s -H domain-name [-c critical -w warning -u -t timeout]" % sys.argv[0], end="") print("Usage: %s -H domain-name [-c critical -w warning -u -t timeout]" % sys.argv[0], end="")
if msg is not None and msg != "": if msg is not None and msg != "":
@ -106,7 +103,7 @@ try:
elif option == "--hostname" or option == "-H": elif option == "--hostname" or option == "-H":
domain = value domain = value
elif option == "--timeout" or option == "-t": elif option == "--timeout" or option == "-t":
timeout = float(value) timeout = int(value)
elif option == "--unixtime" or option == "-u": elif option == "--unixtime" or option == "-u":
unixtime = True unixtime = True
elif option == "--verbose" or option == "-v": elif option == "--verbose" or option == "-v":
@ -147,7 +144,6 @@ for server in servers:
response = requests.get("%s/domain/%s" % (server, domain), timeout=timeout) response = requests.get("%s/domain/%s" % (server, domain), timeout=timeout)
except requests.exceptions.Timeout: except requests.exceptions.Timeout:
unknowns += "Timeout when trying to reach %s " % server unknowns += "Timeout when trying to reach %s " % server
continue
if response.status_code != 200: if response.status_code != 200:
errors += "Invalid RDAP return code at %s: %s " % \ errors += "Invalid RDAP return code at %s: %s " % \
(server, response.status_code) (server, response.status_code)

View File

@ -28,11 +28,11 @@ tests:
retcode: 1 retcode: 1
partstderr: 'ValueError' partstderr: 'ValueError'
# No RDAP server for this TLD # 2021-07-05: no RDAP server for this TLD
- exe: './check_expire' - exe: './check_expire'
args: args:
- '-H' - '-H'
- 'welcome.this-is-not-a-tld' - 'bie.re'
retcode: 3 retcode: 3
partstdout: 'No RDAP server' partstdout: 'No RDAP server'
@ -45,13 +45,13 @@ tests:
retcode: 2 retcode: 2
partstdout: 'No expiration found' partstdout: 'No expiration found'
# With a timeout of 1µs, a timeout is expected # Far away and slow, timeout is expected
- exe: './check_expire' - exe: './check_expire'
args: args:
- '-t' - '-t'
- '0.000001' - '1'
- '-H' - '-H'
- 'bortzmeyer.org' - 'nic.ar'
retcode: 3 retcode: 3
partstdout: 'Timeout' partstdout: 'Timeout'
@ -143,14 +143,14 @@ tests:
retcode: 0 retcode: 0
stderr: '' stderr: ''
# Iran, expiration date in the past. But down (2024-06-16) # Iran, expiration date in the past
#- exe: './check_expire' - exe: './check_expire'
# args: args:
# - '-H' - '-H'
# - 'nic.pars' - 'nic.pars'
# retcode: 2 retcode: 2
# partstdout: "already expired" partstdout: "already expired"
# stderr: '' stderr: ''
# Brazil # Brazil
- exe: './check_expire' - exe: './check_expire'