summaryrefslogtreecommitdiff
path: root/tools/merge.py
blob: 212c1719472c7ebba035631537e6eb7bd712359a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2014-2015, NORDUnet A/S.
# See LICENSE for licensing information.

import argparse
import yaml
import sys
from certtools import create_ssl_context
from merge_fetch import merge_fetch
from merge_backup import merge_backup
from merge_dist import merge_dist

def main():
    parser = argparse.ArgumentParser(description="")
    parser.add_argument('--config', help="System configuration",
                        required=True)
    parser.add_argument('--localconfig', help="Local configuration",
                        required=True)
    parser.add_argument("--nomerge", action='store_true',
                        help="Don't actually do merge")
    parser.add_argument("--timing", action='store_true',
                        help="Print timing information")
    args = parser.parse_args()

    config = yaml.load(open(args.config))
    localconfig = yaml.load(open(args.localconfig))
    paths = localconfig["paths"]

    create_ssl_context(cafile=paths["https_cacertfile"])

    sth = merge_fetch(args, config, localconfig)
    merge_backup(args, config, localconfig, sth)
    merge_dist(args, config, localconfig, sth)

if __name__ == '__main__':
    sys.exit(main())