From a87de8d7b012ca5962a0be2ba21d6b2708ce9392 Mon Sep 17 00:00:00 2001 From: Rohit Date: Thu, 6 Jun 2019 18:23:19 +0530 Subject: [PATCH] flag added foy vyos_interface module (#57124) Signed-off-by: rohitthakur2590 --- lib/ansible/modules/network/vyos/vyos_interface.py | 2 +- lib/ansible/plugins/cliconf/vyos.py | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/ansible/modules/network/vyos/vyos_interface.py b/lib/ansible/modules/network/vyos/vyos_interface.py index dce70ff48db..4b97ea55df1 100644 --- a/lib/ansible/modules/network/vyos/vyos_interface.py +++ b/lib/ansible/modules/network/vyos/vyos_interface.py @@ -227,7 +227,7 @@ def map_obj_to_commands(updates): def map_config_to_obj(module): - data = get_config(module) + data = get_config(module, flags=['| grep interface']) obj = [] for line in data.split('\n'): if line.startswith('set interfaces ethernet'): diff --git a/lib/ansible/plugins/cliconf/vyos.py b/lib/ansible/plugins/cliconf/vyos.py index 48e5874c747..d5c8efa7ada 100644 --- a/lib/ansible/plugins/cliconf/vyos.py +++ b/lib/ansible/plugins/cliconf/vyos.py @@ -71,10 +71,18 @@ class Cliconf(CliconfBase): if format not in option_values['format']: raise ValueError("'format' value %s is invalid. Valid values of format are %s" % (format, ', '.join(option_values['format']))) + if not flags: + flags = [] + if format == 'text': - out = self.send_command('show configuration') + command = 'show configuration' else: - out = self.send_command('show configuration commands') + command = 'show configuration commands' + + command += ' '.join(to_list(flags)) + command = command.strip() + + out = self.send_command(command) return out def edit_config(self, candidate=None, commit=True, replace=None, comment=None):