Skip to content

Commit 589a496

Browse files
authored
add support to check if dedup is enabled (#313)
1 parent 48e1a70 commit 589a496

File tree

4 files changed

+35
-0
lines changed

4 files changed

+35
-0
lines changed

cterasdk/edge/dedup.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,16 @@ def __init__(self, edge):
1515
super().__init__(edge)
1616
self.regen = Regeneration(self._edge)
1717

18+
def is_enabled(self):
19+
"""
20+
Check if deduplication is enabled
21+
22+
:return: True is deduplication is enabled, else False
23+
:rtype: bool
24+
"""
25+
response = self._edge.api.get('/config/dedup/useLocalMapFileDedup')
26+
return False if response is None else response
27+
1828
def enable(self, reboot=False, wait=False):
1929
"""
2030
Enable local deduplication

docs/source/UserGuides/Edge/Configuration.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,14 @@ Volume Management
170170
Deduplication
171171
-------------
172172

173+
.. automethod:: cterasdk.edge.dedup.Dedup.is_enabled
174+
:noindex:
175+
176+
.. code-block:: python
177+
178+
"""Check if deduplication is enabled"""
179+
edge.dedup.is_enabled()
180+
173181
.. automethod:: cterasdk.edge.dedup.Dedup.enable
174182
:noindex:
175183

docs/source/UserGuides/Miscellaneous/Changelog.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
Changelog
22
=========
33

4+
2.20.17
5+
-------
6+
7+
Improvements
8+
^^^^^^^^^^^^
9+
10+
* Added support to validate if deduplication is enabled on the CTERA Edge Filer
11+
12+
Related issues and pull requests on GitHub: `#313 <https://github.com/ctera/ctera-python-sdk/pull/313>`_,
13+
414
2.20.16
515
-------
616

tests/ut/edge/test_dedup.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ def setUp(self):
1313
super().setUp()
1414
self._mock_reboot = self.patch_call('cterasdk.edge.power.Power.reboot')
1515

16+
def test_is_enabled(self):
17+
get_response = True
18+
self._init_filer(get_response=get_response)
19+
ret = dedup.Dedup(self._filer).is_enabled()
20+
self._filer.api.get.assert_called_once_with('/config/dedup/useLocalMapFileDedup')
21+
self.assertEqual(ret, True)
22+
1623
def test_enable_reboot_wait(self):
1724
put_response = 'Success'
1825
self._init_filer(put_response=put_response)

0 commit comments

Comments
 (0)