def run(ctx): """ :param ctx: Application context :return: True if commands run successfully else False """ assert_ctx_has_keys(ctx, ["repos", "workdir"]) workdir = ctx.get("workdir", False) if workdir: _mk_dir_if_not_exist(workdir) else: ctx["workdir"] = workdir = _mk_temporary_workdir() ctx = _setup_extra_template_vars(ctx) cs = [c for c in prepare(ctx["repos"], ctx, ctx.get("deploy", False))] if ctx.get("dryrun", False): for c in cs: print c return True logging.info("Run myrepo.commands.genconf.run...") _logfile = lambda: os.path.join(workdir, "%d.log" % os.getpid()) rc = all(MS.prun(cs, dict(logfile=_logfile))) if not ctx.get("deploy", False): prefix = "Created " if rc else "Failed to create " sys.stderr.write(prefix + "yum repo config SRPM in: %(workdir)s\n" % ctx) return rc
def run(ctx): """ :param ctx: Application context :return: True if commands run successfully else False """ assert_ctx_has_keys(ctx, ("repos", "srpm")) cs = [c for c in prepare(ctx["repos"], ctx["srpm"], ctx.get("build", False))] if ctx.get("dryrun", False): for c in cs: print c return True logging.info("Run myrepo.commands.deploy.run...") return all(MS.prun(cs, dict(logfile=False, )))