From 74152807285a1e6e3ed74ae579b12e1ebcb824e9 Mon Sep 17 00:00:00 2001 From: Rafael Guterres Jeffman <rjeffman@redhat.com> Date: Tue, 15 Dec 2020 18:40:45 -0300 Subject: [PATCH] [flake8-bugbear] Fix unused loop variable. Running flake8 with bugbear enable found an extra for-loop that is not needed. The for-loop was removed, fixing bubear's warning. --- plugins/modules/ipadnsrecord.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/plugins/modules/ipadnsrecord.py b/plugins/modules/ipadnsrecord.py index c3490480..4de8a949 100644 --- a/plugins/modules/ipadnsrecord.py +++ b/plugins/modules/ipadnsrecord.py @@ -1375,10 +1375,9 @@ def define_commands_for_present_state(module, zone_name, entry, res_find): # remove record from args, as it will not be used again. del args[record] else: - for f in part_fields: - _args = {k: args[k] for k in part_fields} - _args['idnsname'] = name - _commands.append([zone_name, 'dnsrecord_add', _args]) + _args = {k: args[k] for k in part_fields if k in args} + _args['idnsname'] = name + _commands.append([zone_name, 'dnsrecord_add', _args]) # clean used fields from args for f in part_fields: if f in args: -- GitLab