Merge "Fix Spark installation fails when parsing spark-env.sh" into stable/liberty
This commit is contained in:
commit
fce47d13d3
@ -0,0 +1,3 @@
|
||||
---
|
||||
fixes:
|
||||
- Escape unhandled unicode characters in environment configuration files
|
@ -143,7 +143,7 @@ class EnvironmentConfig(BaseConfigurationFile):
|
||||
|
||||
def parse(self, content):
|
||||
for line in content.splitlines():
|
||||
line = six.text_type(line.strip())
|
||||
line = self._escape(line)
|
||||
match = self._regex.match(line)
|
||||
if match:
|
||||
name, value = match.groups()
|
||||
@ -153,6 +153,16 @@ class EnvironmentConfig(BaseConfigurationFile):
|
||||
else:
|
||||
self._lines.append(line)
|
||||
|
||||
@staticmethod
|
||||
def _escape(string):
|
||||
try:
|
||||
string = string.decode("utf-8")
|
||||
except AttributeError:
|
||||
pass
|
||||
string = six.text_type(string).strip()
|
||||
string = string.replace("\"", "")
|
||||
return string
|
||||
|
||||
def render(self):
|
||||
result = []
|
||||
for line in self._lines:
|
||||
|
Loading…
Reference in New Issue
Block a user