From 04a45ae457729d12c6c1c885a8e56b27b368f7d7 Mon Sep 17 00:00:00 2001 From: Arnaud Patard Date: Tue, 29 Mar 2022 12:06:53 +0200 Subject: [PATCH 1/2] vagrant/__init__.py: Fix vagrant output parsing Vagrant has added some more lines with extra informations like box-info, Description, so remove them. This possibly needs to be revisited later to properly deal with them, for instance, by changing the split() parameter to 3 and not 4. Signed-off-by: Arnaud Patard --- vagrant/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vagrant/__init__.py b/vagrant/__init__.py index 85a221b..c583803 100644 --- a/vagrant/__init__.py +++ b/vagrant/__init__.py @@ -938,8 +938,9 @@ def _parse_machine_readable_output(self, output): # vagrant 1.8 adds additional fields that aren't required, # and will break parsing if included in the status lines. # filter them out pending future implementation. + unneeded_kind = ["metadata", "ui", "action", "Description", "box-info"] parsed_lines = list( - filter(lambda x: x[2] not in ["metadata", "ui", "action"], parsed_lines) + filter(lambda x: x[2] not in unneeded_kind, parsed_lines) ) return parsed_lines From e0ab0654b3800a117e959a578e81f82511da175a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 29 Mar 2022 10:10:01 +0000 Subject: [PATCH 2/2] chore: auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- vagrant/__init__.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/vagrant/__init__.py b/vagrant/__init__.py index c583803..20de1de 100644 --- a/vagrant/__init__.py +++ b/vagrant/__init__.py @@ -939,9 +939,7 @@ def _parse_machine_readable_output(self, output): # and will break parsing if included in the status lines. # filter them out pending future implementation. unneeded_kind = ["metadata", "ui", "action", "Description", "box-info"] - parsed_lines = list( - filter(lambda x: x[2] not in unneeded_kind, parsed_lines) - ) + parsed_lines = list(filter(lambda x: x[2] not in unneeded_kind, parsed_lines)) return parsed_lines def _parse_config(self, ssh_config):