Skip to content

Fixed handling for quoted right braces in crossplane build #51

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions crossplane/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,14 @@ def _escape(string):
def _needs_quotes(string):
if string == '':
return True
elif string in DELIMITERS:
return False

# lexer should throw an error when variable expansion syntax
# is messed up, but just wrap it in quotes for now I guess
chars = _escape(string)

# arguments can't start with variable expansion syntax
char = next(chars)
if char.isspace() or char in ('{', ';', '"', "'", '${'):
if char.isspace() or char in ('{', '}', ';', '"', "'", '${'):
return True

expanding = False
Expand Down
4 changes: 4 additions & 0 deletions tests/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,3 +252,7 @@ def test_compare_parsed_and_built_empty_map_values(tmpdir):

def test_compare_parsed_and_built_russian_text(tmpdir):
compare_parsed_and_built('russian-text', 'nginx.conf', tmpdir)


def test_compare_parsed_and_built_quoted_right_brace(tmpdir):
compare_parsed_and_built('quoted-right-brace', 'nginx.conf', tmpdir)