示例#1
0
    def _call_hook(self, hook, method, *args):
        """
        Call a hook script resisiding within this payload.

        This method should not be used by consumers within Vortex: hook scripts
        in all payloads should be called for all hookable events, so only
        :meth:`call_hooks` should be used.
        """
        # Don't call hooks if we haven't been successfully acquired
        if not self.acquired:
            return None

        hook = os.path.join(self.directory, Deployer.CFG_DIRNAME, "hooks", hook)

        # Skip unless the hook is executable (and exists, etc...)
        if not os.access(hook, os.R_OK | os.X_OK):
            return None

        script_args = [hook, method]
        script_args.extend(args)

        env = {"VORTEX_ENVIRONMENT": self.environment}

        try:
            return runcmd(script_args, env=env, cwd=self.directory)
        except:
            return None
示例#2
0
        def git_wrapper(*args):
            command = [self.GIT] + list(args)
            (ret, out) = runcmd(command, cwd=cwd)
            if ret == 0:
                return

            raise AcquisitionError("Failed to acquire Git repo {repo}".format(
                repo=self.repository), out)