~michael.nelson/charm-helpers/ansible-detect-hooks

« back to all changes in this revision

Viewing changes to charmhelpers/contrib/ansible/__init__.py

  • Committer: Michael Nelson
  • Date: 2014-04-16 10:15:18 UTC
  • Revision ID: michael.nelson@canonical.com-20140416101518-77vu1rnft310ry8x
Hook-up with get_tags_for_playbook.

Show diffs side-by-side

added added

removed removed

Lines of Context:
193
193
            self.register(hook, noop)
194
194
            available_tags.append(hook)
195
195
 
196
 
        # If ansible is already available, add the other hooks to available tags.
 
196
        available_tags.extend(get_tags_for_playbook(playbook_path))
197
197
 
198
198
    def execute(self, args):
199
199
        """Execute the hook followed by the playbook using the hook as tag."""
200
200
        super(AnsibleHooks, self).execute(args)
201
201
        hook_name = os.path.basename(args[0])
 
202
 
202
203
        if hook_name in available_tags:
203
204
            charmhelpers.contrib.ansible.apply_playbook(
204
205
                self.playbook_path, tags=[hook_name])