Skip to content

Commit

Permalink
Version 0.51. See CHANGELOG.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Git committed Oct 15, 2023
1 parent 59ed0cd commit c0c9b63
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# 2023/10/14
## Version 0.51
### Fixes
* [Timeout errors do not indicate the time](https://github.com/TheScriptGuy/certificateChecker/issues/23)

## Version 0.50
### Fixes
* Fixing bug introduced with version's 0.49 and 0.48
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.50
Version: 0.51

Author: TheScriptGuy

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

Certificate Checker v0.50
Certificate Checker v0.51

optional arguments:
-h, --help show this help message and exit
Expand Down
4 changes: 2 additions & 2 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/10/14
# Version: 0.50
# Version: 0.51

import argparse
import datetime
Expand All @@ -18,7 +18,7 @@
from data import sendDataEmail
from mongo import mongo_connection

scriptVersion = "0.50"
scriptVersion = "0.51"

# Global Variables
args = None
Expand Down
13 changes: 8 additions & 5 deletions certificate/certificateModule.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ def getCertificate(self, __hostinfo: dict) -> dict:
}

try:
# Lets get a timestamp for this attempt
timeNow = datetime.datetime.utcnow().replace(microsecond=0)

# Create a new socket.
with socket.socket() as sock:
# Set timeout value for socket to 10 seconds.
Expand All @@ -105,35 +108,35 @@ def getCertificate(self, __hostinfo: dict) -> dict:
f"{__hostinfo['hostname']}:{__hostinfo['port']}, "
f"options: {__hostinfo['options']}"
)
print(connectHost + ' - Certificate error - ', e.verify_message)
print(str(timeNow) + ' - ' + connectHost + ' - Certificate error - ', e.verify_message)

except socket.gaierror as e:
connectHost = (
f"{__hostinfo['hostname']}:{__hostinfo['port']}, "
f"options: {__hostinfo['options']}"
)
print(connectHost + ' - Socket error - ', e.strerror)
print(str(timeNow) + ' - ' + connectHost + ' - Socket error - ', e.strerror)

except FileNotFoundError as e:
connectHost = (
f"{__hostinfo['hostname']}:{__hostinfo['port']}, "
f"options: {__hostinfo['options']}"
)
print(connectHost + ' - File not found - ', e.strerror)
print(str(timeNow) + ' - ' + connectHost + ' - File not found - ', e.strerror)

except TimeoutError as e:
connectHost = (
f"{__hostinfo['hostname']}:{__hostinfo['port']}, "
f"options: {__hostinfo['options']}"
)
print(connectHost + ' - Timeout error - ', e.strerror)
print(str(timeNow) + ' - ' + connectHost + ' - Timeout error - ', e.strerror)

except OSError as e:
connectHost = (
f"{__hostinfo['hostname']}:{__hostinfo['port']}, "
f"options: {__hostinfo['options']}"
)
print(connectHost + ' - OSError - ', e.strerror)
print(str(timeNow) + ' - ' + connectHost + ' - OSError - ', e.strerror)

return __hostnameData

Expand Down

0 comments on commit c0c9b63

Please sign in to comment.