BrightcoveOS/Diamond — pull request #742 by nicholaskuechler (2014-10-03 16:48:18+00:00)
Title: Fix up regex for nonexistent replication mode.

The previous regex (\w{1}) was looking for a single alphanumeric character, however in some states, the replication mode this regex was collecting is nonexistent / an empty space.

Example of a good replication mode that exists (C):

0: cs:Connected ro:Secondary/Primary ds:UpToDate/UpToDate C r----

Example of a nonexistent replication mode (does not exist - not the missing replication state flag A, B, or C [1]):

0: cs:StandAlone ro:Primary/Unknown ds:UpToDate/Outdated r----

Attempting to regex on the nonexistent replication mode was throwing an exception since the replication mode did not exist:

[2014-10-03 14:08:19,949] [Thread-1] Traceback (most recent call last):
File "/usr/lib/pymodules/python2.6/diamond/collector.py", line 412, in _run
self.collect()
File "/usr/share/diamond/collectors/drbd/drbd.py", line 63, in collect
current_resource = matches.group(1)
AttributeError: 'NoneType' object has no attribute 'group'

References:
[1] http://www.drbd.org/users-guide/s-replication-protocols.html