Skip to content

Commit

Permalink
simplifyed drive.state setter according to @ulmitov's suggestion. Issue
Browse files Browse the repository at this point in the history
  • Loading branch information
ralequi committed Apr 4, 2023
1 parent 8fe9487 commit b14459b
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions pystorcli2/drive.py
Original file line number Diff line number Diff line change
Expand Up @@ -690,18 +690,7 @@ def state(self, value: Union[str, DriveState]):
""" Set drive state
"""

# if value is a str convert to DriveState
if isinstance(value, str):
value = DriveState.from_string(value)

# check if we should try to force the state change
enforce_states = [
DriveState.JBOD
]

force = (value in enforce_states) or (self.state in enforce_states)

return self.set_state(value, force=force)
return self.set_state(value, force=False)

def set_state(self, value: Union[str, DriveState], force: bool = False):
""" Set drive state
Expand Down

0 comments on commit b14459b

Please sign in to comment.