From 72a9d716fca4239effeeb851b224be72eb315e38 Mon Sep 17 00:00:00 2001 From: Eric Young Date: Thu, 24 May 2018 15:59:18 -0400 Subject: [PATCH 1/2] Adding Method to get system configuration --- setup.py | 2 +- siolib/scaleio.py | 16 ++++++++++++++++ siolib/tests/test_system.py | 4 ++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 08db7bd..08499ac 100644 --- a/setup.py +++ b/setup.py @@ -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', diff --git a/siolib/scaleio.py b/siolib/scaleio.py index f12e918..f61b051 100644 --- a/siolib/scaleio.py +++ b/siolib/scaleio.py @@ -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 \ No newline at end of file diff --git a/siolib/tests/test_system.py b/siolib/tests/test_system.py index 30efb5c..ede3bdc 100644 --- a/siolib/tests/test_system.py +++ b/siolib/tests/test_system.py @@ -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']) + From 28a86695a19de7b02549dbe048d1a7f25111d491 Mon Sep 17 00:00:00 2001 From: Eric Young Date: Thu, 24 May 2018 16:06:38 -0400 Subject: [PATCH 2/2] Adding newline --- siolib/scaleio.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/siolib/scaleio.py b/siolib/scaleio.py index f61b051..868bb1c 100644 --- a/siolib/scaleio.py +++ b/siolib/scaleio.py @@ -1120,4 +1120,4 @@ def get_configuration(self): props = req.json() - return props \ No newline at end of file + return props