def check(self): """ This is dry-run mode """ executor = Executor(self._policies, tags=self._tags) contexts = executor.check() return contexts
def apply(self): """ This is live-configuration mode. """ executor = Executor(self._policies, tags=self._tags) contexts = executor.apply() return contexts
def apply(self): """ This is live-configuration mode. """ executor = Executor(policies=self._policies, callbacks=self._callbacks) contexts = executor.apply() return contexts
def check(self): """ This is dry-run mode """ executor = Executor(policies=self._policies, callbacks=self._callbacks) contexts = executor.check() return contexts
def validate(self): """ This just checks for invalid types in the python file as well as missing files and non-sensical option combinations. """ executor = Executor(self._policies, tags=self._tags) contexts = executor.validate() return contexts
def get_executor(self): return Executor(self._policies, push=self._push, extra_vars=self._extra_vars, limit_groups=self._limit_groups, limit_hosts=self._limit_hosts, relative_root=self._relative_root)
def remote_fn(caller, params, sender): """ This is the remote function used for mitogen calls """ # FIXME: REFACTOR: we have a bit of a growing inconsistency between what is a constructor parameter and what is passed around in Context. # we should change this to have context objects that have more meat, but also get passed around versus acting globally, and smaller # function signatures across the board. import dill from opsmop.core.executor import Executor params = dill.loads(zlib.decompress(params)) host = params['host'] policy = params['policy'] role = params['role'] mode = params['mode'] tags = params['tags'] checksums = params['checksums'] relative_root = params['relative_root'] hostvars = params['hostvars'] extra_vars = params['extra_vars'] Context().set_mode(mode) Context().set_caller(caller) assert relative_root is not None Context().set_checksums(checksums) Context().update_globals(hostvars) policy.roles = Roles(role) Callbacks().set_callbacks([ EventStreamCallbacks(sender=sender), LocalCliCallbacks(), CommonCallbacks() ]) executor = Executor([policy], local_host=host, push=False, tags=params['tags'], extra_vars=extra_vars, relative_root=relative_root) # remove single_role # FIXME: care about mode executor.apply()
def apply(self): """ This is live-configuration mode. """ return Executor(policies=self._policies, local=False).apply()
def check(self): """ This is dry-run mode """ return Executor(policies=self._policies, local=False).check()