'Block the resource until the hook is cleared if there is one.'

def _break_if_required(self, action, hook):

    if self.stack.env.registry.matches_hook(self.name, hook):
        self.trigger_hook(hook)
        self._add_event(self.action, self.status, (_('%(a)s    paused    until    Hook    %(h)s    is    cleared') % {'a': action, 'h': hook}))
        LOG.info('Reached    hook    on    %s', self)
        while self.has_hook(hook):
            try:
                (yield)
            except BaseException as exc:
                self.clear_hook(hook)
                self._add_event(self.action, self.status, 'Failure    occurred    while    waiting.')
                if (isinstance(exc, AssertionError) or (not isinstance(exc, Exception))):
                    raise
