#50851 Issue 50850 - Fix dsctl healthcheck for python36
Closed 3 years ago by spichugi. Opened 4 years ago by mreynolds.
mreynolds/389-ds-base issue50850  into  master

file modified
+5 -3
@@ -79,13 +79,15 @@ 

              cert_list.append(self.get_cert_details(cert[0]))

  

          for cert in cert_list:

-             if date.fromisoformat(cert[3].split()[0]) - date.today() < timedelta(days=0):

+             cert_date = cert[3].split()[0]

+             diff_date = datetime.strptime(cert_date, '%Y-%m-%d').date() - datetime.today().date()

+             if diff_date < timedelta(days=0):

                  # Expired

                  report = copy.deepcopy(DSCERTLE0002)

                  report['detail'] = report['detail'].replace('CERT', cert[0])

                  yield report

-             elif date.fromisoformat(cert[3].split()[0]) - date.today() < timedelta(days=30):

-                 # Expiring

+             elif diff_date < timedelta(days=30):

+                 # Expiring within 30 days

                  report = copy.deepcopy(DSCERTLE0001)

                  report['detail'] = report['detail'].replace('CERT', cert[0])

                  yield report

Description:

dsctl health check, specifically the certificate expiring checks, were using python37 specific functions, but these do not work on python36. Needed to replace fromisoformat() with something more portable.

relates: https://pagure.io/389-ds-base/issue/50850

Seems fine to me :) ack

rebased onto 1004e5c

4 years ago

Pull-Request has been merged by mreynolds

4 years ago

389-ds-base is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in 389-ds-base's github repository.

This pull request has been cloned to Github as issue and is available here:
- https://github.com/389ds/389-ds-base/issues/3905

If you want to continue to work on the PR, please navigate to the github issue,
download the patch from the attachments and file a new pull request.

Thank you for understanding. We apologize for all inconvenience.

Pull-Request has been closed by spichugi

3 years ago
Metadata