From ade84f44f429288a298c1e9d0882340518fb1323 Mon Sep 17 00:00:00 2001 From: Evgeniy L Date: Tue, 7 Apr 2015 17:16:34 -0700 Subject: [PATCH] If none of nodes have resources the resource should be skipped even if it defined in the profile --- solar/solar/extensions/modules/ansible.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/solar/solar/extensions/modules/ansible.py b/solar/solar/extensions/modules/ansible.py index 6b54622c..8c35050e 100644 --- a/solar/solar/extensions/modules/ansible.py +++ b/solar/solar/extensions/modules/ansible.py @@ -137,8 +137,12 @@ class AnsibleOrchestration(base.BaseExtension): raise Exception('Path %s is not valid,' ' should be atleast 2 items', path) - resource = next(res for res in self.resources - if res['id'] == steps[0]) + resources = filter(lambda r: r['id'] == steps[0], self.resources) + # NOTE: If there are not resouces for this tags, just skip it + if not resources: + return [] + + resource = resources[0] action = resource for step in steps[1:]: