def execute_resource(self, host, resource, handlers=False): """ This handles the plan/apply intercharge for a given resource in the resource tree. It is called recursively via walk_children to run against all resources. """ assert host is not None # we only care about processing leaf node objects if self.is_collection(resource): return # if in handler mode we do not process the handler unless it was signaled if handlers and not Context.has_seen_any_signal(host, resource.all_handles()): Callbacks.on_skipped(resource, is_handler=handlers) return # tell the callbacks we are about to process a resource # they may use this to print information about the resource Callbacks.on_resource(resource, handlers) # plan always, apply() only if not in check mode, else assume # the plan was executed. provider = self.do_plan(resource) assert provider is not None if Context.is_apply(): self.do_apply(host, provider, handlers) else: # is_check self.do_simulate(host, provider) # if anything has changed, let the callbacks know about it self.signal_changes(host=host, provider=provider, resource=resource)
def on_do(self, provider, action): if Context.is_apply(): self.i3("do: %s" % action.do)