wxt9861 / esxi_stats

ESXi component for Home Assistant
MIT License
145 stars 40 forks source link

Host shutdown/reboot #72

Closed phr0z closed 2 years ago

phr0z commented 2 years ago

Added simple host shutdown/reboot functionality with new service call.

lgtm-com[bot] commented 2 years ago

This pull request introduces 1 alert when merging 786bb59d83e52d6e2824459beb505eb2c0913f44 into e8eb0c9d4241418406a39ae1d6fcc0c339414464 - view on LGTM.com

new alerts:

wxt9861 commented 2 years ago

I merged this into dev. but don't have a good way of testing this right now.

On first glance, a few things i added and need to add

  1. more logging for debug, right now we're sending a command to shutdown but don't output anything about it. At the very least, want to debug what is being shutdown
  2. i wrapped it in a try/catch to catch errors
  3. I see it is capturing host during a command call, but it does nothing with it in the function. I am not sure if I am reading this right, but looks like if it is run against a vcenter it will try to shutdown every host?