def crashDiag(node): util.output("[%s]" % node.name) if not execute.isdir(node, node.cwd()): util.output("No work dir found\n") return (rc, output) = execute.runHelper(node, "run-cmd", [os.path.join(config.Config.scriptsdir, "crash-diag"), node.cwd()]) if not rc: util.output("cannot run crash-diag for %s" % node.name) return for line in output: util.output(line)
def _canonTarget(file, dst): manager = config.Config.manager() if execute.isdir(manager, dst): target = os.path.join(dst, os.path.basename(file)) else: target = dst subst = False if target.endswith(".in"): target = target[:-3] subst = True if file.endswith(".in"): subst = True return (target, subst)
def crashDiag(node): util.output("[%s]" % node.name) if not execute.isdir(node, node.cwd()): util.output("No work dir found\n") return (rc, output) = execute.runHelper( node, "run-cmd", [os.path.join(config.Config.scriptsdir, "crash-diag"), node.cwd()]) if not rc: util.output("cannot run crash-diag for %s" % node.name) return for line in output: util.output(line)
def install(local_only): config.Config.determineBroVersion() manager = config.Config.manager() # Delete previously installed policy files to not mix things up. policies = [config.Config.policydirsiteinstall, config.Config.policydirsiteinstallauto] for p in policies: if os.path.isdir(p): util.output("removing old policies in %s ..." % p, False) execute.rmdir(manager, p) util.output(" done.") util.output("creating policy directories ...", False) for p in policies: execute.mkdir(manager, p) util.output(" done.") # Install local site policy. if config.Config.sitepolicypath: util.output("installing site policies ...", False) dst = config.Config.policydirsiteinstall for dir in config.Config.sitepolicypath.split(":"): dir = config.Config.subst(dir) for file in glob.glob(os.path.join(dir, "*")): if execute.isfile(manager, file): execute.install(manager, file, dst) elif execute.isdir(manager, file): dstdir = os.path.join(dst, os.path.basename(file)) execute.install(manager, file, dstdir) util.output(" done.") makeLayout(config.Config.policydirsiteinstallauto) makeLocalNetworks(config.Config.policydirsiteinstallauto) makeConfig(config.Config.policydirsiteinstallauto) current = config.Config.subst(os.path.join(config.Config.logdir, "current")) try: util.force_symlink(manager.cwd(), current) except (IOError, OSError), e: util.error("failed to update current log symlink")