diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ea6648..6611856 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +Version 0.6.4 +============= +- Added some aliases to `drive.state` & `drive.set_state` method. (PR [#12](https://github.com/Naudit/pystorcli2/pull/12)) + Version 0.6.3 ============= - Bugfix: `pystorcli` package was incomplete. (submodules were missing) diff --git a/pystorcli2/drive/__init__.py b/pystorcli2/drive/__init__.py index cc127c8..1ccaa03 100644 --- a/pystorcli2/drive/__init__.py +++ b/pystorcli2/drive/__init__.py @@ -420,8 +420,10 @@ def set_state(self, value: Union[str, DriveState], force: bool = False): """ Set drive state """ # if DriveState, get the string value - if isinstance(value, DriveState): - value = value.settable_str() + if isinstance(value, str): + value = DriveState.from_string(value) + + value = value.settable_str() args = [ 'set', diff --git a/pystorcli2/drive/state.py b/pystorcli2/drive/state.py index ffaa45d..c694189 100644 --- a/pystorcli2/drive/state.py +++ b/pystorcli2/drive/state.py @@ -120,6 +120,8 @@ def from_string(status: str) -> 'DriveState': alias = { 'good': DriveState.UGood, + 'bad': DriveState.UBad, + 'dedicated': DriveState.DHS, 'hotspare': DriveState.GHS, 'unconfigured': DriveState.UGood, 'unconfigured(good)': DriveState.UGood,