diff options
author | Lusheng Ji <lji@research.att.com> | 2017-10-17 16:00:06 -0400 |
---|---|---|
committer | Lusheng Ji <lji@research.att.com> | 2017-10-17 16:01:28 -0400 |
commit | 9f223bf76cd0bb36952a745711aaddf8ce4200e1 (patch) | |
tree | 74b541df367576b30e5829f83df434085cfbf3db /scripts | |
parent | 775e0e7d547b2b4b38343ce7a02ccc49d5c40212 (diff) |
Fix keystone with 2.0 path
Issue-Id: DCAEGEN2-128
Change-Id: I6b3f021b739135e92960ea4a75237eee862d9c7d
Signed-off-by: Lusheng Ji <lji@research.att.com>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/detemplate-bpinputs.py | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/scripts/detemplate-bpinputs.py b/scripts/detemplate-bpinputs.py index 5848c14..97fd88f 100755 --- a/scripts/detemplate-bpinputs.py +++ b/scripts/detemplate-bpinputs.py @@ -77,6 +77,23 @@ def detemplate_bpinputs(jjt_directory, in_directory, out_directory): inputs = render_template(infpath, context) f.write(inputs) + +def add_keystone_20(conf_directory, filename): + fpath = os.path.join(conf_directory, filename) + newurl = '' + with open(fpath, 'r') as f: + url = f.readline().rstrip() + if not url.endswith('/2.0'): + if url.endswith('/'): + newurl = url + '2.0' + else: + newurl = url + '/2.0' + f.close() + if newurl: + with open(fpath, 'w') as f: + f.write(newurl) + + def main(): if len(sys.argv) != 4: print("Usgae: {} variable_def_dir template_dir template_output_dir".format(sys.argv[0])) @@ -84,8 +101,8 @@ def main(): print("De-templatizing templates in {} using variable defs from {}, results in {}".format(sys.argv[1], sys.argv[2], sys.argv[3])) check_templates(sys.argv[1], sys.argv[2]) - detemplate_bpinputs(sys.argv[1], sys.argv[2], sys.argv[3]) - + detemplate_bpinputs(jjt_directory = sys.argv[1], in_directory = sys.argv[2], out_directory = sys.argv[3]) + add_keystone_20(conf_directory = sys.argv[3], filename = 'keystone_url.txt') ######################################## if __name__ == "__main__": |