Skip to content

Commit

Permalink
Cleaning some old mess.
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcinZablocki committed May 18, 2021
1 parent 4de9683 commit a749cd9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \<[email protected]\>"
PKG_ARCH=all
PKG_ARCH_RPM=noarch
Expand Down
17 changes: 11 additions & 6 deletions src/var/lib/oci-cn-auth/lib/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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):

Expand Down Expand Up @@ -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))

Expand Down

0 comments on commit a749cd9

Please sign in to comment.