diff options
author | Austin S. Hemmelgarn <austin@netdata.cloud> | 2023-02-28 09:03:30 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-28 16:03:30 +0200 |
commit | 533b98d44d9954d35e90b41ba5b5f1110e804ec3 (patch) | |
tree | e320010c41b85addc7f7344227236671f42fb23e /.github/scripts | |
parent | 45981cb7347a5fed7ebbabba0fe193d0d9471eff (diff) |
Fix handling of no data in platform EOL checks. (#14617)
Also, re-enable EOL checking for Debian.
Diffstat (limited to '.github/scripts')
-rwxr-xr-x | .github/scripts/platform-impending-eol.py | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/.github/scripts/platform-impending-eol.py b/.github/scripts/platform-impending-eol.py index eec9b1abee..8b0e7624b4 100755 --- a/.github/scripts/platform-impending-eol.py +++ b/.github/scripts/platform-impending-eol.py @@ -17,18 +17,25 @@ LEAD_DAYS = datetime.timedelta(days=30) DISTRO = sys.argv[1] RELEASE = sys.argv[2] +EXIT_NOT_IMPENDING = 0 +EXIT_IMPENDING = 1 +EXIT_NO_DATA = 2 +EXIT_FAILURE = 3 with urllib.request.urlopen(f'{ URL_BASE }/{ DISTRO }/{ RELEASE }.json') as response: match response.status: case 200: data = json.load(response) case 404: - sys.exit(f'No data available for { DISTRO } { RELEASE }.') + print(f'No data available for { DISTRO } { RELEASE }.', file=sys.stderr) + sys.exit(EXIT_NO_DATA) case _: - sys.exit( + print( f'Failed to retrieve data for { DISTRO } { RELEASE } ' + - f'(status: { response.status }).' + f'(status: { response.status }).', + file=sys.stderr ) + sys.exit(EXIT_FAILURE) eol = datetime.date.fromisoformat(data['eol']) @@ -36,6 +43,6 @@ offset = abs(eol - NOW) if offset <= LEAD_DAYS: print(data['eol']) - sys.exit(2) + sys.exit(EXIT_IMPENDING) else: - sys.exit(0) + sys.exit(EXIT_NOT_IMPENDING) |