mirror of
https://github.com/containers/ansible-podman-collections.git
synced 2026-02-04 07:11:49 +00:00
podman_systemd: Ignore header when comparing systemd files content (#558)
Fix #557 Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
This commit is contained in:
parent
7c06ddec3b
commit
dba0d78844
1 changed files with 8 additions and 1 deletions
|
|
@ -456,7 +456,14 @@ def generate_systemd(module):
|
|||
current_unit_file_content = unit_file.read()
|
||||
# If current unit file content is the same as the
|
||||
# generated content
|
||||
if current_unit_file_content == unit_content:
|
||||
# Remove comments from files, before comparing
|
||||
current_unit_file_content_nocmnt = "\n".join([
|
||||
line for line in current_unit_file_content.splitlines()
|
||||
if not line.startswith('#')])
|
||||
unit_content_nocmnt = "\n".join([
|
||||
line for line in unit_content.splitlines()
|
||||
if not line.startswith('#')])
|
||||
if current_unit_file_content_nocmnt == unit_content_nocmnt:
|
||||
# We don't need to write it
|
||||
need_to_write_file = False
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue