Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding method to retrieve system configuration #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def read(fname):

setuptools.setup(
name='siolib',
version='2.0.2',
version='2.0.3',
description='ScaleIO API base library',
url='https://github.com/codedellemc/python-scaleioclient',
license='ASL 2.0',
Expand Down
16 changes: 16 additions & 0 deletions siolib/scaleio.py
Original file line number Diff line number Diff line change
Expand Up @@ -1105,3 +1105,19 @@ def get_storage_pool_statistics(self, protection_domain, storage_pool, props):
stats = req.json()[sp_id]

return stats

def get_configuration(self):
"""
Returns the system, configuration
:return: dict of system properties
"""

r_uri = '/api/Configuration'
req = self._get(r_uri)
if req.status_code != 200:
raise exceptions.Error('Error retrieving system properties: %s'
% req.json().get('message'))

props = req.json()

return props
4 changes: 4 additions & 0 deletions siolib/tests/test_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,7 @@ def test_storage_pool_statistics(self):
stats = self.scaleio.get_storage_pool_statistics(self.domain, self.pool, requested_stats)
self.assertEqual(len(stats), len(requested_stats))

def test_configuration(self):
props = self.scaleio.get_configuration()
self.assertIsNotNone(props['systemId'])