From 14d2727c0474d794d491ebde2251a7e190654a8d Mon Sep 17 00:00:00 2001 From: Jimmy McCrory Date: Tue, 14 Feb 2017 16:07:51 -0800 Subject: [PATCH] Remove quotes when assigning values from an openrc The magnum and neutron modules parse an openrc file and create key-value pairs by literally assigning the key to anything in front of an '=' and the value to everything after an '='. If the value is surrounded by quotes, do not include them. Depends-On: I4b1e7b5cb83061ea35108db545fdfa33cef037a5 Change-Id: Ib44d9fa63332286fe4e51bd818f80b5989815988 --- library/magnum | 2 +- library/neutron | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/library/magnum b/library/magnum index 1107212..33c1352 100644 --- a/library/magnum +++ b/library/magnum @@ -142,7 +142,7 @@ class ManageMagnum(object): def _parse_openrc(self): """Get credentials from an openrc file.""" openrc_path = self.module.params['openrc_path'] - line_re = re.compile('^export (?POS_\w*)=(?P[^\n]*)') + line_re = re.compile('^export (?POS_\w*)=\'?(?P[^\n\']*)') with open(openrc_path) as openrc: matches = [line_re.match(l) for l in openrc] return dict( diff --git a/library/neutron b/library/neutron index e41a6fa..aab51ed 100644 --- a/library/neutron +++ b/library/neutron @@ -262,7 +262,7 @@ class ManageNeutron(object): def _parse_openrc(self): """Get credentials from an openrc file.""" openrc_path = self.module.params['openrc_path'] - line_re = re.compile('^export (?POS_\w*)=(?P[^\n]*)') + line_re = re.compile('^export (?POS_\w*)=\'?(?P[^\n\']*)') with open(openrc_path) as openrc: matches = [line_re.match(l) for l in openrc] return dict(