mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 13:52:54 +00:00
Added utils.last_non_blank_line
This commit is contained in:
@@ -412,7 +412,18 @@ def do_encrypt(result, encrypt, salt_size=None, salt=None):
|
||||
return result
|
||||
|
||||
def last_non_blank_line(lines):
|
||||
return lines
|
||||
all_lines = lines.splitlines()
|
||||
all_lines.reverse()
|
||||
for line in all_lines:
|
||||
if (len(line) > 0):
|
||||
return line
|
||||
|
||||
return "" # we shouldn't come here (no lines?) but let's pretend nothing happend
|
||||
# We can't return all lines here because calling code expects only one
|
||||
# line.
|
||||
|
||||
def line_needs_filtering(line):
|
||||
return line.startswith('#') or (len(line) == 0)
|
||||
|
||||
def filter_leading_garbage(lines):
|
||||
return lines
|
||||
|
||||
Reference in New Issue
Block a user