X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=functest%2Futils%2Fopenstack_utils.py;h=3093cb558062872b379946ebd4611d6b4358a019;hb=03208634b25e61faebaa34e932e282a8f26c0ea4;hp=c21ed818ef5216ef4bc103df59265932a9a3497c;hpb=cd4b47c5096b5b9f16e6a742e5e35bf74c55559e;p=functest.git diff --git a/functest/utils/openstack_utils.py b/functest/utils/openstack_utils.py index c21ed818e..3093cb558 100755 --- a/functest/utils/openstack_utils.py +++ b/functest/utils/openstack_utils.py @@ -114,10 +114,12 @@ def get_credentials(other_creds={}): def source_credentials(rc_file): with open(rc_file, "r") as f: for line in f: - var = line.rstrip('"\n').replace( - 'export ', '').replace("'", "").split("=") - key = re.sub(r'^ *| *$', '', var[0]) - value = re.sub(r'^[" ]*|[ "]*$', '', "".join(var[1:])) + var = line.rstrip('"\n').replace('export ', '').split("=") + # The two next lines should be modified as soon as rc_file + # conforms with common rules. Be aware that it could induce + # issues if value starts with ' + key = re.sub(r'^["\' ]*|[ \'"]*$', '', var[0]) + value = re.sub(r'^["\' ]*|[ \'"]*$', '', "".join(var[1:])) os.environ[key] = value