Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions ansible/library/bgp_facts.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/python
import re

DOCUMENTATION = '''
module: bgp_facts
Expand Down Expand Up @@ -76,6 +77,14 @@ def run(self):
"""
Main method of the class
"""

# Check if bgp is enabled as a feature, and if not return facts with empty bgp_neighbors.
rc, self.out, err = self.module.run_command("show feature status bgp", executable='/bin/bash',
use_unsafe_shell=True)
regex_bgp = re.compile(r'bgp\s+disabled')
if regex_bgp.search(self.out):
self.module.exit_json(ansible_facts=self.facts)

for instance in self.instances:
self.collect_data('summary', instance)
self.parse_summary()
Expand Down