Exemple #1
0
 def test(self):
     scenarios = 'tests/scenarios'
     for scenario in next(os.walk(scenarios))[1]:
         input_dir = os.path.join(scenarios, scenario, 'in')
         reference_dir = os.path.join(scenarios, scenario, 'out')
         output_dir = os.path.join(self.tmpdir, scenario)
         os.makedirs(output_dir)
         caretakr.run(input_dir, output_dir)
         subprocess.check_call(['diff', '-ru', output_dir, reference_dir])
Exemple #2
0
def main():
    args = parse_args()
    start_logging(args.verbose, args.quiet)
    import caretakr
    if args.noop is True or args.no_write is True:
        no_write, no_exec, no_git = (True, True, True)
    elif args.no_exec is True:
        no_write, no_exec, no_git = (False, True, True)
    else:
        no_write, no_exec, no_git = (args.no_write, args.no_exec, args.no_git)
    diff = not args.no_diff
    caretakr.run(indir=args.indir, outdir=args.outdir,
                 modules_to_run=args.modules_to_run, diff=diff,
                 no_write=no_write, no_exec=no_exec, no_git=no_git)
Exemple #3
0
def run(_, __, dry_run):
    """
    appcontroller calls this function directly

    We don't care about the given parameters at all :D Even the dry run option
    is not necessary, because caretakr nginx will never attempt to reload nginx
    if you're not root (uid 0) and your username is also not 'appctl'... So unit
    tests (where dryrun was used) should still work. Also, git commit will skip
    actually trying to do something if the git repo is not owned by itself, which
    is the case for the appctl, which writes in /etc/nginx/caretakr.d, while
    /etc/.git is owned by root.

    So here's what the appcontroller should call instead: \o/~
    """
    import caretakr
    caretakr.run(modules_to_load='nginx', modules_to_run='nginx')