From aa522faf7ff17773ee99bf505dca53ccd0feb0b8 Mon Sep 17 00:00:00 2001 From: yuvipanda Date: Wed, 27 Jun 2018 02:10:26 -0700 Subject: [PATCH] Don't use tee to write service unit files We are running as root now directly, no need to tee --- tljh/systemd.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tljh/systemd.py b/tljh/systemd.py index fcda899..cef33e6 100644 --- a/tljh/systemd.py +++ b/tljh/systemd.py @@ -23,10 +23,8 @@ def install_unit(name, unit, path='/etc/systemd/system'): """ Install unit wih given name """ - subprocess.run([ - 'tee', - os.path.join(path, name) - ], input=unit.encode('utf-8'), check=True) + with open(os.path.join(path, name), 'w') as f: + f.write(unit) def uninstall_unit(name, path='/etc/systemd/system'):