Skip to content

Commit

Permalink
Version 0.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolargo committed Dec 31, 2014
1 parent 590f13a commit 465ca9e
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 12 deletions.
10 changes: 9 additions & 1 deletion NEWS
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
v0.4.2 - 31/12/2014
===================

* Do not send a sys.exit if /proc/mdstat doesn't exist. Just return the error.

v0.4.1 - 24/12/2014
=================
* Handle I/O error if /proc/mdstat doesn't exist (issue #2)

v0.4 - 24/12/2014
=================

* Handle I/O error if /proc/mdstat doesn't exist (issue #2)
* Misc tweaks - Pep (issue #3)

v0.3 - 23/12/2014
Expand Down
2 changes: 1 addition & 1 deletion pymdstat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Copyright (C) 2014 Nicolargo <[email protected]>

__appname__ = "PyMDstat"
__version__ = "0.4.1"
__version__ = "0.4.2"
__author__ = "Nicolas Hennion <[email protected]>"
__licence__ = "MIT"

Expand Down
12 changes: 4 additions & 8 deletions pymdstat/pymdstat.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,10 @@ def load(self):
"""Return a dict of stats."""
ret = {}

# Read the mdstat file, if it exists, exit otherwise.
try:
with open(self.get_path(), 'r') as f:
# lines is a list of line (with \n)
lines = f.readlines()
except (OSError, IOError) as err:
print("Failed to open '{0}': {1}".format(self.get_path(), err))
sys.exit(1)
# Read the mdstat file
with open(self.get_path(), 'r') as f:
# lines is a list of line (with \n)
lines = f.readlines()

# First line: get the personalities
# The "Personalities" line tells you what RAID level the kernel currently supports.
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@

setup(
name='pymdstat',
version='0.4.1',
version='0.4.2',
description="Python library to parse Linux /proc/mdstat",
long_description=open('README.rst').read(),
author='Nicolas Hennion',
author_email='[email protected]',
url='https://github.com/nicolargo/pymdstat',
# download_url='https://s3.amazonaws.com/pymdstat/pymdstat-0.4.1.tar.gz',
# download_url='https://s3.amazonaws.com/pymdstat/pymdstat-0.4.2.tar.gz',
license="MIT",
keywords="raid linux",
packages=['pymdstat'],
Expand Down
8 changes: 8 additions & 0 deletions unitest.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ def test_000_loadall(self):
# print('%s' % mdstat_test.get_stats())
self.assertNotEqual(mdstat_test.get_stats(), {})

def test_099_didnotexist(self):
try:
mdstat_test = MdStat('/proc/NOmdstat')
except IOError:
self.assertTrue(True)
else:
self.assertFalse(True)

def test_099_model(self):
i = 4
mdstat_test = MdStat('./tests/mdstat.0%s' % i)
Expand Down

0 comments on commit 465ca9e

Please sign in to comment.