diff options
author | Rohit <rohitthakur2590@outlook.com> | 2020-01-04 21:08:25 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-04 21:08:25 +0530 |
commit | 6defad6652bedef840aa772c7978bb832a8f8315 (patch) | |
tree | 9c5d464f48f96c4e12bb35f53a50371a8c9c815f | |
parent | 865e767d3940699a418748b4389e02d25687a3d6 (diff) | |
download | ansible-revert-66122-vyos_config_fix.tar.gz |
Revert "vyos_config bug fix #66110 (#66122)"revert-66122-vyos_config_fix
This reverts commit 2f996fc6e222eeaf6c3391ad437dadf8ad642b36.
4 files changed, 2 insertions, 35 deletions
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 |