Add API management to node daemon

This commit is contained in:
2019-12-12 22:59:07 -05:00
parent 22ae087836
commit b854d53fab
3 changed files with 11 additions and 0 deletions

View File

@ -266,6 +266,10 @@ class NodeInstance(object):
if self.config['enable_api']:
self.logger.out('Stopping PVC API client service', state='i')
common.run_os_command("systemctl stop pvc-api.service")
if self.config['enable_provisioner']:
self.logger.out('Stopping PVC Provisioner service', state='i')
common.run_os_command("systemctl stop pvc-provisioner.service")
common.run_os_command("systemctl stop pvc-provisioner-worker.service")
for network in self.d_network:
self.d_network[network].stopDHCPServer()
self.d_network[network].removeGateways()
@ -287,6 +291,10 @@ class NodeInstance(object):
if self.config['enable_api']:
self.logger.out('Starting PVC API client service', state='i')
common.run_os_command("systemctl start pvc-api.service")
if self.config['enable_provisioner']:
self.logger.out('Starting PVC Provisioner service', state='i')
common.run_os_command("systemctl start pvc-provisioner-worker.service")
common.run_os_command("systemctl start pvc-provisioner.service")
time.sleep(1)
# Switch Patroni leader to the local instance