Skip to content

Commit 6a87de4

Browse files
strip string while processing powerstate for HyperV
Signed-off-by: Rohit Yadav <[email protected]>
1 parent db57147 commit 6a87de4

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

extensions/HyperV/hyperv.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,11 @@ def reboot(self):
200200
def status(self):
201201
command = f'(Get-VM -Name "{self.data["vmname"]}").State'
202202
state = self.run_ps(command)
203-
if state.lower() == "running":
203+
power_state = "unknown"
204+
if state.strip().lower() == "running":
204205
power_state = "poweron"
205-
elif state.lower() == "off":
206+
elif state.strip().lower() == "off":
206207
power_state = "poweroff"
207-
else:
208-
power_state = "unknown"
209208
succeed({"status": "success", "power_state": power_state})
210209

211210
def delete(self):

0 commit comments

Comments
 (0)