ios_facts: Strip header from running-config (#48047)

IOS prepends a show running-config with lines that are not part of the
configuration, keeping the output from being an entirely valid configuration:
R1#show run
Building configuration...

Current configuration : 2045 bytes
...

In order to be able to use the config from ios_facts as-is, strip this
header.
This commit is contained in:
Paul Neumann 2018-11-08 15:58:47 +01:00 committed by Sumit Jaiswal
parent ae7b9ea8cd
commit 3cc1b8d7d3

View file

@ -282,6 +282,9 @@ class Config(FactsBase):
super(Config, self).populate() super(Config, self).populate()
data = self.responses[0] data = self.responses[0]
if data: if data:
data = re.sub(
r'^Building configuration...\s+Current configuration : \d+ bytes\n',
'', data, flags=re.MULTILINE)
self.facts['config'] = data self.facts['config'] = data