def _register(action): handler = Handler.get(action) handler.add_predicate( partial(_when, _action_id(action), desired_states, False)) handler.add_args( filter(None, map(RelationBase.from_state, desired_states))) return action
def _register(action): def arg_gen(): # use a generator to defer calling of hookenv.relation_type, for tests rel = RelationBase.from_name(hookenv.relation_type()) if rel: yield rel handler = Handler.get(action) handler.add_predicate(partial(_hook, hook_patterns)) handler.add_args(arg_gen()) return action
def _register(action): handler = Handler.get(action) handler.add_predicate(partial(_when, _action_id(action), desired_states, True)) return action
def _register(action): handler = Handler.get(action) handler.add_predicate(partial(_when, _action_id(action), desired_states, False)) handler.add_args(filter(None, map(RelationBase.from_state, desired_states))) return action
def _register(action): handler = Handler.get(action) handler.add_predicate(partial(any_file_changed, filenames, **kwargs)) return action
def _register(action): handler = Handler.get(action) handler.add_predicate( partial(_when, _action_id(action), desired_states, True)) return action