Skip to content

Commit

Permalink
use check_output to enable better error detection
Browse files Browse the repository at this point in the history
  • Loading branch information
TiagoTT committed Dec 22, 2024
1 parent d4546b4 commit e5b6ec8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion netbox_agent/hypervisor.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging
import shlex
import subprocess

from netbox_agent.config import config
Expand Down Expand Up @@ -44,7 +45,8 @@ def create_netbox_virtual_guest(self, name):
return guest

def get_virtual_guests(self):
return subprocess.getoutput(config.virtual.list_guests_cmd).split()
output = subprocess.check_output(shlex.split(config.virtual.list_guests_cmd))
return output.decode("utf-8")

def create_or_update_device_virtual_machines(self):
nb_guests = self.get_netbox_virtual_guests()
Expand Down

0 comments on commit e5b6ec8

Please sign in to comment.