From 20bbd66e859d171613c5394304bb08141c0cabd6 Mon Sep 17 00:00:00 2001 From: Victor Salgado Date: Sun, 20 Sep 2015 22:54:02 -0300 Subject: [PATCH] Use dict.get() --- lib/ansible/inventory/__init__.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/ansible/inventory/__init__.py b/lib/ansible/inventory/__init__.py index 7af5ef4cd9c..47d552774f4 100644 --- a/lib/ansible/inventory/__init__.py +++ b/lib/ansible/inventory/__init__.py @@ -461,10 +461,7 @@ class Inventory(object): return matching_host def get_group(self, groupname): - if groupname in self.groups: - return self.groups[groupname] - else: - return None + return self.groups.get(groupname) def get_group_variables(self, groupname, update_cached=False, vault_password=None): if groupname not in self._vars_per_group or update_cached: