mirror of
https://github.com/containers/ansible-podman-collections.git
synced 2026-02-04 07:11:49 +00:00
Add protection for systemd files deletion (#509)
Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com> Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
This commit is contained in:
parent
5198b726fb
commit
5c68ee09fe
1 changed files with 3 additions and 1 deletions
|
|
@ -143,7 +143,9 @@ def delete_systemd(module, module_params, name, version):
|
|||
data = json.loads(systemd)
|
||||
for file_name in data.keys():
|
||||
file_name += ".service"
|
||||
os.unlink(os.path.join(sysconf['path'], file_name))
|
||||
file_path = os.path.join(sysconf['path'], file_name)
|
||||
if os.path.exists(file_path):
|
||||
os.unlink(file_path)
|
||||
return
|
||||
except Exception as e:
|
||||
module.log(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue