From a749cd9071f599763c66ecba559f9c728d191c51 Mon Sep 17 00:00:00 2001 From: Marcin Zablocki Date: Mon, 17 May 2021 23:36:25 -0700 Subject: [PATCH] Cleaning some old mess. --- Makefile | 2 +- src/var/lib/oci-cn-auth/lib/util.py | 17 +++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 49c8737..eab2751 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ PKG_NAME=oci-cn-auth PKG_DESCRIPTION="OCI cluster network authentication tool" PKG_VERSION=0.2.6 -PKG_RELEASE=0 +PKG_RELEASE=2 PKG_MAINTAINER="Marcin Zablocki \" PKG_ARCH=all PKG_ARCH_RPM=noarch diff --git a/src/var/lib/oci-cn-auth/lib/util.py b/src/var/lib/oci-cn-auth/lib/util.py index cbfe046..71d63d0 100644 --- a/src/var/lib/oci-cn-auth/lib/util.py +++ b/src/var/lib/oci-cn-auth/lib/util.py @@ -62,7 +62,7 @@ def disable(self): return lib.systemd.disable(self.service)['status'] def delete(self): - if self.unit: + if os.path.isfile(self.unitfile): return os.remove(self.unitfile) else: return False @@ -84,7 +84,7 @@ def create_unit(self, write=True): tmpfile.write(template) tmpfile.flush() - if self.unit: + if self.unitfile: if not filecmp.cmp(tmpfile.name, self.unitfile): @@ -211,12 +211,17 @@ def check_units(config, write=True, start=True): interface = RdmaInterface(i) should_configure = _should_configure(config, interface) - if should_configure: + if should_configure: if interface.service.create_unit(write=False): - print('Updating unit: {}'.format(interface.interface)) + if not write: + print('Unit {} needs updating'.format(interface.interface)) + else: + print('Updating unit: {}'.format(interface.interface)) interface.service.create_unit() - print('Reloading systemd') - lib.systemd.reload() + if write: + print('Reloading systemd') + lib.systemd.reload() + else: print('[ OK ] {}'.format(interface.service.service))