allow empty line in src template file (#42493)

This commit is contained in:
hitsumabushi
2018-07-11 14:59:07 +09:00
committed by Ganesh Nalawade
parent 940d4a0e89
commit cf7a42b4f4
3 changed files with 12 additions and 4 deletions

View File

@@ -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()]