From f463f323f7f0a65703fb7bba12b7561904254dd5 Mon Sep 17 00:00:00 2001 From: louxnix Date: Wed, 10 Feb 2016 08:37:57 +0100 Subject: [PATCH] Limit vagrant fields if more than 4 Vagrant metadata contains 5 fields: 1455035554,vagrant1,metadata,provider,virtualbox vagrant --version Vagrant 1.8.1 --- ch03/inventory/vagrant.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ch03/inventory/vagrant.py b/ch03/inventory/vagrant.py index 5a2b69a..767a6f0 100755 --- a/ch03/inventory/vagrant.py +++ b/ch03/inventory/vagrant.py @@ -21,7 +21,7 @@ def list_running_hosts(): status = subprocess.check_output(cmd.split()).rstrip() hosts = [] for line in status.split('\n'): - (_, host, key, value) = line.split(',') + (_, host, key, value) = line.split(',')[:4] if key == 'state' and value == 'running': hosts.append(host) return hosts -- 2.44.0