Use enable/disable --now instead of two commands

Avoids needing two calls here especially for the stop.
This commit is contained in:
Joshua Boniface 2023-11-16 02:40:35 -05:00
parent c76a5afd04
commit e818df5dae
1 changed files with 4 additions and 4 deletions

View File

@ -610,8 +610,7 @@ class NodeInstance(object):
# 6. Start client API # 6. Start client API
if self.config["enable_api"]: if self.config["enable_api"]:
self.logger.out("Starting PVC API client service", state="i") self.logger.out("Starting PVC API client service", state="i")
common.run_os_command("systemctl enable pvcapid.service") common.run_os_command("systemctl enable --now pvcapid.service")
common.run_os_command("systemctl start pvcapid.service")
# 7. Start metadata API; just continue if we fail # 7. Start metadata API; just continue if we fail
self.metadata_api.start() self.metadata_api.start()
# 8. Start DHCP servers # 8. Start DHCP servers
@ -675,8 +674,9 @@ class NodeInstance(object):
# 4. Stop client API # 4. Stop client API
if self.config["enable_api"]: if self.config["enable_api"]:
self.logger.out("Stopping PVC API client service", state="i") self.logger.out("Stopping PVC API client service", state="i")
common.run_os_command("systemctl stop pvcapid.service", background=True) common.run_os_command(
common.run_os_command("systemctl disable pvcapid.service", background=True) "systemctl disable --now pvcapid.service", background=True
)
time.sleep(0.1) # Time fir new writer to acquire the lock time.sleep(0.1) # Time fir new writer to acquire the lock
# Synchronize nodes C (I am reader) # Synchronize nodes C (I am reader)