Make logs for searching GNS3 VM vmware IP less noisy

Fix #765
This commit is contained in:
Julien Duponchelle committed 2016-11-11 11:41:16 +01:00
1 parent 65090c6f87
commit 1bb760d3f0
3 files changed
+10 -9

No files matched your search

+5 -5
View File
@@ -357,19 +357,19 @@ class VMware(BaseManager):
return self._host_type
@asyncio.coroutine
def execute(self, subcommand, args, timeout=120):
def execute(self, subcommand, args, timeout=120, log_level=logging.INFO):
try:
return (yield from self._execute(subcommand, args, timeout=timeout))
return (yield from self._execute(subcommand, args, timeout=timeout, log_level=log_level))
except VMwareError as e:
# We can fail to detect that it's VMware player instead of Workstation (due to marketing change Player is now Player Workstation)
if self.host_type == "ws" and "VIX_SERVICEPROVIDER_VMWARE_WORKSTATION" in str(e):
self._host_type = "player"
return (yield from self._execute(subcommand, args, timeout=timeout))
return (yield from self._execute(subcommand, args, timeout=timeout, log_level=log_level))
else:
raise e
@asyncio.coroutine
def _execute(self, subcommand, args, timeout=120):
def _execute(self, subcommand, args, timeout=120, log_level=logging.INFO):
if self.host_type is None:
yield from self.check_vmware_version()
@@ -380,7 +380,7 @@ class VMware(BaseManager):
command = [vmrun_path, "-T", self.host_type, subcommand]
command.extend(args)
command_string = " ".join(command)
log.info("Executing vmrun with command: {}".format(command_string))
log.log(log_level, "Executing vmrun with command: {}".format(command_string))
try:
process = yield from asyncio.create_subprocess_exec(*command, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE)
except (OSError, subprocess.SubprocessError) as e: