Skip to content

Commit fcc61e9

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "Replace use of deprecated cert.not_valid_after"
2 parents c310815 + 310cf31 commit fcc61e9

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

octavia/common/tls_utils/cert_parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ def get_cert_expiration(certificate_pem):
300300
try:
301301
cert = x509.load_pem_x509_certificate(certificate_pem,
302302
backends.default_backend())
303-
return cert.not_valid_after
303+
return cert.not_valid_after_utc
304304
except Exception as e:
305305
LOG.exception('Unreadable Certificate.')
306306
raise exceptions.UnreadableCert from e

octavia/tests/unit/common/tls_utils/test_cert_parser.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,10 @@ def test_get_primary_cn(self):
246246

247247
def test_get_cert_expiration(self):
248248
exp_date = cert_parser.get_cert_expiration(sample_certs.X509_EXPIRED)
249-
self.assertEqual(datetime.datetime(2016, 9, 25, 18, 1, 54), exp_date)
249+
self.assertEqual(
250+
datetime.datetime(2016, 9, 25, 18, 1, 54,
251+
tzinfo=datetime.timezone.utc),
252+
exp_date)
250253

251254
# test the exception
252255
self.assertRaises(exceptions.UnreadableCert,

0 commit comments

Comments
 (0)