1
0
Fork 0
mirror of https://github.com/containers/ansible-podman-collections.git synced 2026-02-04 07:11:49 +00:00

Add .service extension to systemd files (#310)

This commit is contained in:
Sergey 2021-09-23 09:50:16 +03:00 committed by GitHub
parent b2541ad39c
commit 3f3cdab506
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 6 deletions

View file

@ -69,9 +69,10 @@ def generate_systemd(module, module_params, name):
module.fail_json("Path %s is not a directory! "
"Can not save systemd unit files there!"
% sysconf['path'])
for k, v in data.items():
with open(os.path.join(sysconf['path'], k), 'w') as f:
f.write(v)
for file_name, file_content in data.items():
file_name += ".service"
with open(os.path.join(sysconf['path'], file_name), 'w') as f:
f.write(file_content)
return data
except Exception as e:
module.log(