Skip to content

Commit

Permalink
HACK to fix bug in parsing of Ansible code in last line
Browse files Browse the repository at this point in the history
  • Loading branch information
Nfsaavedra committed Oct 1, 2022
1 parent 8469c13 commit b518fb3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions glitch/parsers/cmof.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ def __parse_playbook(self, name, file, parsed_file = None) -> UnitBlock:
unit_block.path = file.name
file.seek(0, 0)
code = file.readlines()
code.append("") # HACK allows to parse code in the end of the file

for p in parsed_file.value:
# Plays are unit blocks inside a unit block
Expand Down Expand Up @@ -266,6 +267,7 @@ def __parse_tasks_file(self, name, file, parsed_file = None) -> UnitBlock:
unit_block.path = file.name
file.seek(0, 0)
code = file.readlines()
code.append("") # HACK allows to parse code in the end of the file

if parsed_file is None:
return unit_block
Expand All @@ -289,6 +291,7 @@ def __parse_vars_file(self, name, file, parsed_file=None) -> UnitBlock:
unit_block.path = file.name
file.seek(0, 0)
code = file.readlines()
code.append("") # HACK allows to parse code in the end of the file

if parsed_file is None:
return unit_block
Expand Down

0 comments on commit b518fb3

Please sign in to comment.