From 7bc7c347dd35f1eb05c31e7cfd8d59c7745cf76d Mon Sep 17 00:00:00 2001 From: Adam Miller Date: Mon, 11 Dec 2017 13:35:56 -0600 Subject: [PATCH] remove unnecessary extra conditional (thanks bcoca) Signed-off-by: Adam Miller --- lib/ansible/plugins/inventory/ini.py | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/lib/ansible/plugins/inventory/ini.py b/lib/ansible/plugins/inventory/ini.py index ee41ae4d956..82d4e1899d6 100644 --- a/lib/ansible/plugins/inventory/ini.py +++ b/lib/ansible/plugins/inventory/ini.py @@ -179,18 +179,13 @@ class InventoryModule(BaseFileInventoryPlugin): # Either [groupname] or [groupname:children] is sufficient to declare a group, # but [groupname:vars] is allowed only if the # group is declared elsewhere. # We add the group anyway, but make a note in pending_declarations to check at the end. - if state == 'vars': - - # It's possible that a group is previously pending due to being - # defined as a child group, in that case we simply pass so that - # the logic below to process pending declarations will take the - # appropriate action for a pending child group instead of - # incorrectly handling it as a var state pending declaration - if groupname in pending_declarations: - if pending_declarations[groupname]['state'] == 'children': - pass - else: - pending_declarations[groupname] = dict(line=self.lineno, state=state, name=groupname) + # + # It's possible that a group is previously pending due to being defined as a child + # group, in that case we simply pass so that the logic below to process pending + # declarations will take the appropriate action for a pending child group instead of + # incorrectly handling it as a var state pending declaration + if state == 'vars' and groupname not in pending_declarations: + pending_declarations[groupname] = dict(line=self.lineno, state=state, name=groupname) self.inventory.add_group(groupname)