Akosiaris has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/94184


Change subject: Cleanup check-raid.py and PEP8 compliance
......................................................................

Cleanup check-raid.py and PEP8 compliance

Mostly fix up minor inconsistencies and make sure it is pep8 compliant

Change-Id: Idbce34f4185ab89da2f82f954aca03af9f41dcf6
---
D modules/base/files/monitoring/.pep8
M modules/base/files/monitoring/check-raid.py
2 files changed, 17 insertions(+), 18 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/84/94184/1

diff --git a/modules/base/files/monitoring/.pep8 
b/modules/base/files/monitoring/.pep8
deleted file mode 100644
index ad4323f..0000000
--- a/modules/base/files/monitoring/.pep8
+++ /dev/null
@@ -1,5 +0,0 @@
-[pep8]
-
-# Suppress warnings:
-# E501: line too long
-ignore = E501
diff --git a/modules/base/files/monitoring/check-raid.py 
b/modules/base/files/monitoring/check-raid.py
index 09a38c2..d09170d 100644
--- a/modules/base/files/monitoring/check-raid.py
+++ b/modules/base/files/monitoring/check-raid.py
@@ -18,7 +18,7 @@
     elif osName == 'Linux':
         utility = getLinuxUtility()
     else:
-        print ('WARNING: Operating system "%s" is not '
+        print ('WARNING: operating system "%s" is not '
                'supported by this check script' % (osName))
         sys.exit(1)
 
@@ -115,18 +115,20 @@
         proc = subprocess.Popen(['/usr/sbin/arcconf', 'getconfig', '1'],
                                 stdout=subprocess.PIPE, stderr=devNull)
     except:
-        print 'WARNING: Unable to execute arcconf'
+        print 'WARNING: unable to execute arcconf'
         os.chdir(oldDir)
         return 1
 
-    defunctRegex = re.compile('^\s*Defunct disk drive count\s*:\s*(\d+)')
-    logicalRegex = re.compile('^\s*Logical 
devices/Failed/Degraded\s*:\s*(\d+)/(\d+)/(\d+)')
+    dre = '^\s*Defunct disk drive count\s*:\s*(\d+)'
+    defunctRegex = re.compile(dre)
+    lre = '^\s*Logical devices/Failed/Degraded\s*:\s*(\d+)/(\d+)/(\d+)'
+    logicalRegex = re.compile(lre)
     status = 0
     numLogical = None
     for line in proc.stdout:
         m = defunctRegex.match(line)
         if m is not None and m.group(1) != '0':
-            print 'CRITICAL: Defunct disk drive count: ' + m.group(1)
+            print 'CRITICAL: defunct disk drive count: ' + m.group(1)
             status = 2
             break
 
@@ -264,22 +266,22 @@
         return 1
 
     if lines == 0:
-        print 'WARNING: No known controller found'
+        print 'WARNING: no known controller found'
         return 1
 
     if not match:
-        print 'WARNING: Parse error processing megacli output'
+        print 'WARNING: parse error processing megacli output'
         return 1
 
     if numLD == 0:
-        print 'OK: No disks configured for RAID'
+        print 'OK: no disks configured for RAID'
         return 0
 
     if failedLD > 0:
-        print 'CRITICAL: %d failed logical drive(s) (%s)' % (failedLD, ", 
".join(states))
+        print 'CRITICAL: %d failed LD(s) (%s)' % (failedLD, ", ".join(states))
         return 2
 
-    print 'OK: State is Optimal, checked %d logical drive(s), %d physical 
drive(s)' % (numLD, numPD)
+    print 'OK: optimal, %d logical, %d physical' % (numLD, numPD)
     return 0
 
 
@@ -322,7 +324,7 @@
 def checkSoftwareRaid():
     devices = getSoftwareRaidDevices()
     if len(devices) == 0:
-        print 'WARNING: Unexpectedly checked no devices'
+        print 'WARNING: unexpectedly checked no devices'
         return 1
 
     args = ['/sbin/mdadm', '--detail']
@@ -334,8 +336,10 @@
         print 'WARNING: error executing mdadm: %s' % str(error)
         return 1
 
-    deviceRegex = re.compile('^(/[^ ]*):$')
-    statRegex = re.compile('^ *(Active|Working|Failed|Spare) Devices *: 
*(\d+)')
+    dre = '^(/[^ ]*):$'
+    deviceRegex = re.compile()
+    sre = '^ *(Active|Working|Failed|Spare) Devices *: *(\d+)'
+    statRegex = re.compile(sre)
     currentDevice = None
     stats = {
         'Active': 0,

-- 
To view, visit https://gerrit.wikimedia.org/r/94184
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idbce34f4185ab89da2f82f954aca03af9f41dcf6
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Akosiaris <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to