Skip to content

Version 0.37. See CHANGELOG.md #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 2023/04/15
## Version 0.37
### Feature additions
* [Adding time to output when error occurs](https://github.com/TheScriptGuy/certificateChecker/issues/11)

# 2023/03/25
## Version 0.36
### Feature additions
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Certificate Checker

Version: 0.36
Version: 0.37

Author: TheScriptGuy

Expand Down Expand Up @@ -30,7 +30,7 @@ usage: certCheck.py [-h] [--hostname HOSTNAME] [--displayCertificate] [--display
[--sendEmail] [--retryAmount RETRYAMOUNT] [--timeBetweenRetries TIMEBETWEENRETRIES] [--contextVariables] [--setTag SETTAG] [--delTag] [--getTag] [--renewDeviceId] [--getDeviceId] [--deleteDeviceId]
[--setTenantId SETTENANTID] [--getTenantId] [--delTenantId] [--createBlankConfiguration]

Certificate Checker v0.35
Certificate Checker v0.37

optional arguments:
-h, --help show this help message and exit
Expand Down
6 changes: 3 additions & 3 deletions certCheck.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Program: Certificate Checker
# Author: Nolan Rumble
# Date: 2023/03/25
# Version: 0.36
# Date: 2023/04/15
# Version: 0.37

import argparse
import datetime
Expand All @@ -17,7 +17,7 @@
from data import emailTemplateBuilder
from data import sendDataEmail

scriptVersion = "0.36"
scriptVersion = "0.37"

# Global Variables
args = None
Expand Down
23 changes: 15 additions & 8 deletions data/sendDataMongoDB.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Class: sendDataMongoDB
# Last updated: 2023/03/25
# Author: TheScriptGuy (https://github.com/TheScriptGuy
# Version: 0.09
# Last updated: 2023/04/15
# Author: TheScriptGuy (https://github.com/TheScriptGuy)
# Version: 0.10
# Description: Send json list to mongoDB based on configuration in mongo.cfg

import pymongo
Expand Down Expand Up @@ -107,13 +107,20 @@ def sendResults(self, __results, __destCollection):
__mongoResult = __destCollection.insert_one(__results)
__uploadResult.append(__mongoResult)
except pymongo.errors.ServerSelectionTimeoutError:
print("Server connection timeout error when uploading data.")
print("Saving to certificateData.json")
# Get time of error
errTime = str(datetime.datetime.utcnow())
print(f"{errTime} - Server connection timeout error when uploading data. Saving to certificateData.json")

# Save test data to file.
self.sendJsonScriptDataToFile("certificateData.json", [__results])
sys.exit(1)

except pymongo.errors.OperationFailure as e:
print(f"Mongo operation error - {e}")
print("Saving to certificateData.json")
# Get time of error
errTime = str(datetime.datetime.utcnow())
print(f"{errTime} - Mongo operation error - {e}. Saving to certificateData.json")

# Save test data to file.
self.sendJsonScriptDataToFile("certificateData.json", [__results])
sys.exit(1)

Expand Down Expand Up @@ -233,4 +240,4 @@ def uploadDataToMongoDB(self, __jsonScriptData):
def __init__(self):
"""Initialize the sendDataMongoDB class."""
self.initialized = True
self.version = "0.09"
self.version = "0.10"