Merge branch '8784-dir-listings'
[arvados.git] / tools / arvbox / lib / arvbox / docker / application_yml_override.py
1 #!/usr/bin/env python
2 # Copyright (C) The Arvados Authors. All rights reserved.
3 #
4 # SPDX-License-Identifier: AGPL-3.0
5
6 import yaml
7
8 try:
9     with open("application.yml.override") as f:
10         b = yaml.load(f)
11 except IOError:
12     exit()
13
14 with open("application.yml") as f:
15     a = yaml.load(f)
16
17 def recursiveMerge(a, b):
18     if isinstance(a, dict) and isinstance(b, dict):
19         for k in b:
20             print k
21             a[k] = recursiveMerge(a.get(k), b[k])
22         return a
23     else:
24         return b
25
26 with open("application.yml", "w") as f:
27     yaml.dump(recursiveMerge(a, b), f)