aboutsummaryrefslogtreecommitdiff
path: root/jobs
diff options
context:
space:
mode:
authorTom Ritter <tom@ritter.vg>2020-09-07 23:54:47 -0400
committerTom Ritter <tom@ritter.vg>2020-09-07 23:54:47 -0400
commit7deaed5205d0db6139f1c5e1f7c2b72181b1a208 (patch)
treea9f11fe72bf4b20d787bd90bbcb7a78902dac1ae /jobs
parent4671e0dec5eab28941e598f109dbf77ed551a707 (diff)
Run futurize on the codebase for python3
Diffstat (limited to 'jobs')
-rwxr-xr-xjobs/EmailChecker.py4
-rwxr-xr-xjobs/HTTPServerChecker.py6
-rwxr-xr-xjobs/JobBase.py8
-rwxr-xr-xjobs/JobSpawner.py3
-rwxr-xr-xjobs/PeerChecker.py6
-rwxr-xr-xjobs/TCPServerChecker.py6
-rwxr-xr-xjobs/TLSCertExpiration.py12
-rwxr-xr-xjobs/__init__.py4
8 files changed, 33 insertions, 16 deletions
diff --git a/jobs/EmailChecker.py b/jobs/EmailChecker.py
index 74b41d9..11f1f86 100755
--- a/jobs/EmailChecker.py
+++ b/jobs/EmailChecker.py
@@ -1,5 +1,7 @@
#!/usr/bin/env python
+from __future__ import absolute_import
+from builtins import str
import os
import base64
import datetime
@@ -7,7 +9,7 @@ import logging
import imaplib
-import JobBase
+from . import JobBase
class EmailChecker(JobBase.JobBase):
def executeEvery(self):
diff --git a/jobs/HTTPServerChecker.py b/jobs/HTTPServerChecker.py
index df96c1e..260f36f 100755
--- a/jobs/HTTPServerChecker.py
+++ b/jobs/HTTPServerChecker.py
@@ -1,10 +1,12 @@
#!/usr/bin/env python
+from __future__ import absolute_import
+from builtins import str
import logging
import requests
-import JobBase
-import JobSpawner
+from . import JobBase
+from . import JobSpawner
class HTTPServerChecker(JobSpawner.JobSpawner):
servers = [
diff --git a/jobs/JobBase.py b/jobs/JobBase.py
index 3561992..fc1d459 100755
--- a/jobs/JobBase.py
+++ b/jobs/JobBase.py
@@ -1,5 +1,7 @@
#!/usr/bin/env python
+from builtins import str
+from builtins import object
import time
import random
import base64
@@ -8,13 +10,13 @@ import datetime
import smtplib
-class JobFrequency:
+class JobFrequency(object):
MINUTE = "minute"
HOUR = "hour"
DAY = "day"
DAY_NOON = "day_noon"
-class JobFailureNotificationFrequency:
+class JobFailureNotificationFrequency(object):
EVERYTIME = "every"
EVERYFIVEMINUTES = "5min"
EVERYTENMINUTES = "10min"
@@ -22,7 +24,7 @@ class JobFailureNotificationFrequency:
EVERYDAY = "day"
ONSTATECHANGE = "state_change"
-class JobFailureCountMinimumBeforeNotification:
+class JobFailureCountMinimumBeforeNotification(object):
ONE = 1
TWO = 2
FIVE = 5
diff --git a/jobs/JobSpawner.py b/jobs/JobSpawner.py
index ff9744f..6e2c636 100755
--- a/jobs/JobSpawner.py
+++ b/jobs/JobSpawner.py
@@ -1,6 +1,7 @@
#!/usr/bin/env python
-class JobSpawner:
+from builtins import object
+class JobSpawner(object):
"""OVERRIDE ME
Returns an array (or using 'yield') of Job objects to run"""
def get_sub_jobs(self, config):
diff --git a/jobs/PeerChecker.py b/jobs/PeerChecker.py
index 77df4ce..93c6df3 100755
--- a/jobs/PeerChecker.py
+++ b/jobs/PeerChecker.py
@@ -1,5 +1,7 @@
#!/usr/bin/env python
+from __future__ import absolute_import
+from builtins import str
import os
import base64
import datetime
@@ -7,8 +9,8 @@ import datetime
import imaplib
import requests
-import JobBase
-import JobSpawner
+from . import JobBase
+from . import JobSpawner
class PeerChecker(JobSpawner.JobSpawner):
class IndividualPeerChecker(JobBase.JobBase):
diff --git a/jobs/TCPServerChecker.py b/jobs/TCPServerChecker.py
index 6098977..b516cfa 100755
--- a/jobs/TCPServerChecker.py
+++ b/jobs/TCPServerChecker.py
@@ -1,11 +1,13 @@
#!/usr/bin/env python
+from __future__ import absolute_import
+from builtins import str
import os
import socket
import logging
-import JobBase
-import JobSpawner
+from . import JobBase
+from . import JobSpawner
class TCPServerChecker(JobSpawner.JobSpawner):
servers = [
diff --git a/jobs/TLSCertExpiration.py b/jobs/TLSCertExpiration.py
index e4b05b7..e0fb689 100755
--- a/jobs/TLSCertExpiration.py
+++ b/jobs/TLSCertExpiration.py
@@ -1,14 +1,18 @@
#!/usr/bin/env python
+from __future__ import absolute_import
+from future import standard_library
+standard_library.install_aliases()
+from builtins import str
import ssl
import time
import logging
-import httplib
+import http.client
import OpenSSL
import datetime
-import JobBase
-import JobSpawner
+from . import JobBase
+from . import JobSpawner
class TLSCertExpiration(JobSpawner.JobSpawner):
servers = [
@@ -35,7 +39,7 @@ class TLSCertExpiration(JobSpawner.JobSpawner):
def execute(self):
try:
context = ssl._create_unverified_context()
- c = httplib.HTTPSConnection(self.url, context=context)
+ c = http.client.HTTPSConnection(self.url, context=context)
c.request("GET", "/")
asn1 = c.sock.getpeercert(True)
x509 = OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_ASN1, asn1)
diff --git a/jobs/__init__.py b/jobs/__init__.py
index 0e780eb..a6eff83 100755
--- a/jobs/__init__.py
+++ b/jobs/__init__.py
@@ -1,5 +1,7 @@
#!/usr/bin/env python
+from builtins import str
+from builtins import object
import os
import sys
import inspect
@@ -11,7 +13,7 @@ import jobs
import jobs.JobBase
import jobs.JobSpawner
-class JobFinder:
+class JobFinder(object):
def __init__(self, config):
"""
Opens the jobs folder and looks at every .py module in that directory.