Updates docs for SR1 with final revision
[genesis.git] / fuel / prototypes / auto-deploy / create_templates / reap_opnfv_astute.py
1 #!/usr/bin/python
2 ##############################################################################
3 # Copyright (c) 2015 Ericsson AB and others.
4 # stefan.k.berg@ericsson.com
5 # jonas.bjurel@ericsson.com
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Apache License, Version 2.0
8 # which accompanies this distribution, and is available at
9 # http://www.apache.org/licenses/LICENSE-2.0
10 ##############################################################################
11
12 import yaml
13 import re
14 import sys
15 import os
16
17 if len(sys.argv) != 4:
18     sys.stderr.write("Usage: "+sys.argv[0]+" <controllerfile> <computefile> <outfile>\n")
19     sys.exit(1)
20
21 controller = sys.argv[1]
22 if not os.path.exists(controller):
23     sys.stderr.write("ERROR: The file "+controller+" could not be opened\n")
24     sys.exit(1)
25
26 compute = sys.argv[2]
27 if not os.path.exists(compute):
28     sys.stderr.write("ERROR: The file "+compute+" could not be opened\n")
29     sys.exit(1)
30
31 outfile = sys.argv[3]
32
33 f_controller = open(controller, 'r')
34 doc_controller = yaml.load(f_controller)
35 f_controller.close()
36
37 f_compute = open(compute, 'r')
38 doc_compute = yaml.load(f_compute)
39 f_compute.close()
40
41 out = {}
42 out["opnfv"] = {}
43 out["opnfv"]["controller"] = doc_controller["opnfv"]
44 out["opnfv"]["compute"] = doc_compute["opnfv"]
45
46 f2 = open(outfile, 'a')
47 f2.write(yaml.dump(out, default_flow_style=False))
48 f2.close()
49