mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
allow empty line in src template file (#42493)
This commit is contained in:
committed by
Ganesh Nalawade
parent
940d4a0e89
commit
cf7a42b4f4
@@ -146,12 +146,17 @@ CONFIG_FILTERS = [
|
||||
def get_candidate(module):
|
||||
contents = module.params['src'] or module.params['lines']
|
||||
|
||||
if module.params['lines']:
|
||||
contents = '\n'.join(contents)
|
||||
if module.params['src']:
|
||||
contents = format_commands(contents.splitlines())
|
||||
|
||||
contents = '\n'.join(contents)
|
||||
return contents
|
||||
|
||||
|
||||
def format_commands(commands):
|
||||
return [line for line in commands if len(line.strip()) > 0]
|
||||
|
||||
|
||||
def diff_config(commands, config):
|
||||
config = [str(c).replace("'", '') for c in config.splitlines()]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user