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): """ Initialize yum repos. :param ctx: Application context :return: True if commands run successfully else False """ assert_ctx_has_key(ctx, "repos") cs = prepare(ctx["repos"]) if ctx.get("dryrun", False): for c in cs: print c if ctx.get("genconf", False): return MCG.run(ctx) return True logging.info("Run myrepo.commands.init.run...") if all(MS.prun(cs, dict(logfile=False, ))): return MCG.run(ctx) if ctx.get("genconf", False) else True else: RuntimeError("Could not initialize the yum repos")
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, )))