From 64fe7402ff759a214acb05cc13f394c38e11b500 Mon Sep 17 00:00:00 2001 From: Ricardo Carrillo Cruz Date: Tue, 4 Apr 2017 16:04:00 +0200 Subject: [PATCH] Pull filesystems from dict in case is not string on eos_facts (#23254) Apparently in some devices the filesystems gathering command can return a dict containing a 'messages' key with the filesystems, instead of a plain string. Fixes #23217 --- lib/ansible/modules/network/eos/eos_facts.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/ansible/modules/network/eos/eos_facts.py b/lib/ansible/modules/network/eos/eos_facts.py index 99ecd2bffa..0f5efdb165 100644 --- a/lib/ansible/modules/network/eos/eos_facts.py +++ b/lib/ansible/modules/network/eos/eos_facts.py @@ -201,6 +201,10 @@ class Hardware(FactsBase): def populate_filesystems(self): data = self.responses[0] + + if isinstance(data, dict): + data = data['messages'][0] + fs = re.findall(r'^Directory of (.+)/', data, re.M) return dict(filesystems=fs)