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
This commit is contained in:
Ricardo Carrillo Cruz 2017-04-04 16:04:00 +02:00
parent 08be1ae562
commit f0e19d8334

View file

@ -201,6 +201,10 @@ class Hardware(FactsBase):
def populate_filesystems(self): def populate_filesystems(self):
data = self.responses[0] data = self.responses[0]
if isinstance(data, dict):
data = data['messages'][0]
fs = re.findall(r'^Directory of (.+)/', data, re.M) fs = re.findall(r'^Directory of (.+)/', data, re.M)
return dict(filesystems=fs) return dict(filesystems=fs)