summaryrefslogtreecommitdiffstats
path: root/scripts/detemplate-bpinputs.py
diff options
context:
space:
mode:
authorLusheng Ji <lji@research.att.com>2017-10-25 20:51:30 -0400
committerLusheng Ji <lji@research.att.com>2017-10-26 12:33:29 +0000
commit85812470a882048a741001d109a68e994f4aad39 (patch)
tree5889bf5e2d81e2314bb381784ff2f0b1130d9afd /scripts/detemplate-bpinputs.py
parent557c2cd33a111c48212d400860637f65edb4fcb6 (diff)
Fix file not found error
In addition the following: Disable designate import function Install ping and nc to docker container (Dockerfile) Issue-Id: DCAEGEN2-127 Change-Id: I13a8684260e9352bf2ae5efb7f6837f23a58cf97 Signed-off-by: Lusheng Ji <lji@research.att.com>
Diffstat (limited to 'scripts/detemplate-bpinputs.py')
-rwxr-xr-xscripts/detemplate-bpinputs.py29
1 files changed, 18 insertions, 11 deletions
diff --git a/scripts/detemplate-bpinputs.py b/scripts/detemplate-bpinputs.py
index 97fd88f..ab9905a 100755
--- a/scripts/detemplate-bpinputs.py
+++ b/scripts/detemplate-bpinputs.py
@@ -81,17 +81,24 @@ def detemplate_bpinputs(jjt_directory, in_directory, out_directory):
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()
+ try:
+ with open(fpath, 'r') as f:
+ url = f.readline().rstrip()
+ if not url.endswith('/v2.0'):
+ if url.endswith('/'):
+ newurl = url + 'v2.0'
+ else:
+ newurl = url + '/v2.0'
+ except:
+ newurl = ''
+ print("add_keystone_20 eception reading file: " + conf_directory + "/" + filename)
+
if newurl:
- with open(fpath, 'w') as f:
- f.write(newurl)
+ try:
+ with open(fpath, 'w') as f:
+ f.write(newurl)
+ except:
+ print("add_keystone_20 eception writing file: " + conf_directory + "/" + filename)
def main():
@@ -100,9 +107,9 @@ def main():
exit(1)
print("De-templatizing templates in {} using variable defs from {}, results in {}".format(sys.argv[1], sys.argv[2], sys.argv[3]))
+ add_keystone_20(conf_directory = sys.argv[1], filename = 'keystone_url.txt')
check_templates(sys.argv[1], sys.argv[2])
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__":