diff --git a/changelogs/fragments/43024-nclu-empty-net-commands.yaml b/changelogs/fragments/43024-nclu-empty-net-commands.yaml new file mode 100644 index 00000000000..50a95620be6 --- /dev/null +++ b/changelogs/fragments/43024-nclu-empty-net-commands.yaml @@ -0,0 +1,2 @@ +bugfixes: +- nclu - no longer runs net on empty lines in templates (https://github.com/ansible/ansible/pull/43024) diff --git a/lib/ansible/modules/network/cumulus/nclu.py b/lib/ansible/modules/network/cumulus/nclu.py index 764e9b2435f..0aa5f0d92c4 100644 --- a/lib/ansible/modules/network/cumulus/nclu.py +++ b/lib/ansible/modules/network/cumulus/nclu.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -# (c) 2016-2017, Cumulus Networks +# (c) 2016-2018, Cumulus Networks # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function @@ -185,7 +185,8 @@ def run_nclu(module, command_list, command_string, commit, atomic, abort, descri # Run all of the net commands output_lines = [] for line in commands: - output_lines += [command_helper(module, line.strip(), "Failed on line %s" % line)] + if line.strip(): + output_lines += [command_helper(module, line.strip(), "Failed on line %s" % line)] output = "\n".join(output_lines) # If pending changes changed, report a change.