1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

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()
data = self.responses[0]
if data:
data = re.sub(
r'^Building configuration...\s+Current configuration : \d+ bytes\n',
'', data, flags=re.MULTILINE)
self.facts['config'] = data