From 6defad6652bedef840aa772c7978bb832a8f8315 Mon Sep 17 00:00:00 2001 From: Rohit Date: Sat, 4 Jan 2020 21:08:25 +0530 Subject: Revert "vyos_config bug fix #66110 (#66122)" This reverts commit 2f996fc6e222eeaf6c3391ad437dadf8ad642b36. --- lib/ansible/modules/network/vyos/vyos_config.py | 8 +------- .../targets/vyos_config/tests/cli/config.cfg | 3 --- .../targets/vyos_config/tests/cli/simple.yaml | 24 ---------------------- .../network/vyos/fixtures/vyos_config_src.cfg | 2 +- 4 files changed, 2 insertions(+), 35 deletions(-) delete mode 100644 test/integration/targets/vyos_config/tests/cli/config.cfg diff --git a/lib/ansible/modules/network/vyos/vyos_config.py b/lib/ansible/modules/network/vyos/vyos_config.py index 5af2147172..25711a0cc4 100644 --- a/lib/ansible/modules/network/vyos/vyos_config.py +++ b/lib/ansible/modules/network/vyos/vyos_config.py @@ -208,13 +208,7 @@ def get_candidate(module): def format_commands(commands): - """ - This function format the input commands and removes the prepend white spaces - for command lines having 'set' or 'delete' and it skips empty lines. - :param commands: - :return: list of commands - """ - return [line.strip() if line.split()[0] in ('set', 'delete') else line for line in commands if len(line.strip()) > 0] + return [line for line in commands if len(line.strip()) > 0] def diff_config(commands, config): diff --git a/test/integration/targets/vyos_config/tests/cli/config.cfg b/test/integration/targets/vyos_config/tests/cli/config.cfg deleted file mode 100644 index 36c98f19aa..0000000000 --- a/test/integration/targets/vyos_config/tests/cli/config.cfg +++ /dev/null @@ -1,3 +0,0 @@ - set service lldp - set protocols static - diff --git a/test/integration/targets/vyos_config/tests/cli/simple.yaml b/test/integration/targets/vyos_config/tests/cli/simple.yaml index 376d0b94bb..a4a879957c 100644 --- a/test/integration/targets/vyos_config/tests/cli/simple.yaml +++ b/test/integration/targets/vyos_config/tests/cli/simple.yaml @@ -25,30 +25,6 @@ that: - "result.changed == false" -- name: Configuring when commands starts with whitespaces - vyos_config: - src: "{{ role_path }}/tests/cli/config.cfg" - register: result - -- assert: - that: - - "result.changed == true" - - '"set service lldp" in result.commands' - - '"set protocols static" in result.commands' - -- name: Delete description - vyos_config: - lines: - - delete service lldp - - delete protocols static - register: result - -- assert: - that: - - "result.changed == true" - - '"delete service lldp" in result.commands' - - '"delete protocols static" in result.commands' - - name: teardown vyos_config: lines: set system host-name {{ inventory_hostname_short }} diff --git a/test/units/modules/network/vyos/fixtures/vyos_config_src.cfg b/test/units/modules/network/vyos/fixtures/vyos_config_src.cfg index 410f6115fc..18cd793718 100644 --- a/test/units/modules/network/vyos/fixtures/vyos_config_src.cfg +++ b/test/units/modules/network/vyos/fixtures/vyos_config_src.cfg @@ -2,5 +2,5 @@ set system host-name foo delete interfaces ethernet eth0 address set interfaces ethernet eth1 address '6.7.8.9/24' - set interfaces ethernet eth1 description 'test string' +set interfaces ethernet eth1 description 'test string' set interfaces ethernet eth1 disable -- cgit v1.2.1