Skip to content
This repository was archived by the owner on Jun 8, 2020. It is now read-only.
This repository was archived by the owner on Jun 8, 2020. It is now read-only.

bad return code on 404 #8

@yoshi314

Description

@yoshi314

If i get a 404 on crl, plugin is expected to throw a critical, but it throws a warning because the temporary crl file is not on the disk and the os.remove(tmpcrl) fails.

So the exception to handle 404 gets overridden by exception due to attempting to delete a file that no longer exists.

A quick fix:

         urllib.request.urlretrieve(url, tmpcrl)
     except:
         print ("CRITICAL: CRL could not be retrieved: %s" % url)
-        os.remove(tmpcrl)
+        if os.path.exists(tmpcrl):
+            os.remove(tmpcrl)
         sys.exit(2)
 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions