From 2fe25f19dc5d41ab60adb4a3258f4364c224bb5c Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Mon, 22 Jul 2013 10:11:19 -0400 Subject: [PATCH 1/4] Fix to group_by module as a result of previous conditional upgrades. --- lib/ansible/runner/action_plugins/group_by.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/ansible/runner/action_plugins/group_by.py b/lib/ansible/runner/action_plugins/group_by.py index 79bcea42c1..477f46fe84 100644 --- a/lib/ansible/runner/action_plugins/group_by.py +++ b/lib/ansible/runner/action_plugins/group_by.py @@ -58,8 +58,12 @@ class ActionModule(object): data = {} data.update(inject) data.update(inject['hostvars'][host]) - if not check_conditional(self.runner.basedir, self.runner.conditional, data, fail_on_undefined=self.runner.error_on_undefined_vars): - continue + conds = self.runner.conditional + if type(conds) != list: + conds = [ conds ] + for cond in conds: + if not check_conditional(cond, self.runner.basedir, data, fail_on_undefined=self.runner.error_on_undefined_vars): + continue group_name = template.template(self.runner.basedir, args['key'], data) group_name = group_name.replace(' ','-') if group_name not in groups: From b40295910db617b93f8bd1566f9dcb92b03abadb Mon Sep 17 00:00:00 2001 From: Serge van Ginderachter Date: Mon, 22 Jul 2013 16:47:36 +0200 Subject: [PATCH 2/4] also rename plugin name in error message --- lib/ansible/runner/lookup_plugins/flattened.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/runner/lookup_plugins/flattened.py b/lib/ansible/runner/lookup_plugins/flattened.py index e359f59172..831b2e9130 100644 --- a/lib/ansible/runner/lookup_plugins/flattened.py +++ b/lib/ansible/runner/lookup_plugins/flattened.py @@ -71,7 +71,7 @@ class LookupModule(object): terms = utils.listify_lookup_plugin_terms(terms, self.basedir, inject) if not isinstance(terms, list): - raise errors.AnsibleError("with_flat_list expects a list") + raise errors.AnsibleError("with_flattened expects a list") ret = self.flatten(terms, inject) return ret From 3f85a82ae940aa373666ce93e5a6e0e11e61f385 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Mon, 22 Jul 2013 10:54:20 -0400 Subject: [PATCH 3/4] use global to fail as its not in self Signed-off-by: Brian Coca --- library/system/setup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/system/setup b/library/system/setup index 5b78aae02e..e6fde009af 100644 --- a/library/system/setup +++ b/library/system/setup @@ -636,7 +636,7 @@ class LinuxHardware(Hardware): if e.errno == errno.ENOENT: pass else: - self.fail_json(msg=e.strerror) + module.fail_json(msg=e.strerror) self.facts['mounts'].append( {'mount': fields[1], From fc9aa5f01473e429a20beb00dd4adb0f79c42d7e Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Mon, 22 Jul 2013 13:57:35 -0400 Subject: [PATCH 4/4] Continue on mount errors, don't fail the setup module. --- library/system/setup | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/library/system/setup b/library/system/setup index e6fde009af..c304a3c848 100644 --- a/library/system/setup +++ b/library/system/setup @@ -633,10 +633,7 @@ class LinuxHardware(Hardware): size_total = statvfs_result.f_bsize * statvfs_result.f_blocks size_available = statvfs_result.f_bsize * (statvfs_result.f_bavail) except OSError, e: - if e.errno == errno.ENOENT: - pass - else: - module.fail_json(msg=e.strerror) + continue self.facts['mounts'].append( {'mount': fields[1],