slapos: make forbid_supervisord_automatic_launch generic.

i.e no single line of code in this entire repository can start supervisord implicitely if option is set.
In such case, the only way to start supervisord is to run slapos node supervisord explicitely.
parent 3f21f006
...@@ -54,9 +54,9 @@ class SupervisorctlCommand(ConfigCommand): ...@@ -54,9 +54,9 @@ class SupervisorctlCommand(ConfigCommand):
return configp.getboolean('slapos', 'root_check') return configp.getboolean('slapos', 'root_check')
def _should_forbid_supervisord_launch(self, configp): def _should_forbid_supervisord_launch(self, configp):
if not configp.has_option('supervisorctl', 'forbid_supervisord_automatic_launch'): if not configp.has_option('slapos', 'forbid_supervisord_automatic_launch'):
return False return False
return configp.getboolean('supervisorctl', 'forbid_supervisord_automatic_launch') return configp.getboolean('slapos', 'forbid_supervisord_automatic_launch')
def take_action(self, args): def take_action(self, args):
configp = self.fetch_config(args) configp = self.fetch_config(args)
......
...@@ -49,7 +49,7 @@ from lxml import etree ...@@ -49,7 +49,7 @@ from lxml import etree
from slapos.slap.slap import NotFoundError from slapos.slap.slap import NotFoundError
from slapos.slap.slap import ServerError from slapos.slap.slap import ServerError
from slapos.util import mkdir_p, chownDirectory from slapos.util import mkdir_p, chownDirectory, string_to_boolean
from slapos.grid.exception import BuildoutFailedError from slapos.grid.exception import BuildoutFailedError
from slapos.grid.SlapObject import Software, Partition from slapos.grid.SlapObject import Software, Partition
from slapos.grid.svcbackend import (launchSupervisord, from slapos.grid.svcbackend import (launchSupervisord,
...@@ -225,6 +225,7 @@ def create_slapgrid_object(options, logger): ...@@ -225,6 +225,7 @@ def create_slapgrid_object(options, logger):
shacache_key_file=op.get('shacache-key-file'), shacache_key_file=op.get('shacache-key-file'),
shadir_cert_file=op.get('shadir-cert-file'), shadir_cert_file=op.get('shadir-cert-file'),
shadir_key_file=op.get('shadir-key-file'), shadir_key_file=op.get('shadir-key-file'),
forbid_supervisord_automatic_launch=string_to_boolean(op.get('forbid_supervisord_automatic_launch')),
develop=op.get('develop', False), develop=op.get('develop', False),
# Try to fetch from deprecated argument # Try to fetch from deprecated argument
software_release_filter_list=op.get('only-sr', op.get('only_sr')), software_release_filter_list=op.get('only-sr', op.get('only_sr')),
...@@ -279,6 +280,7 @@ class Slapgrid(object): ...@@ -279,6 +280,7 @@ class Slapgrid(object):
shacache_key_file=None, shacache_key_file=None,
shadir_cert_file=None, shadir_cert_file=None,
shadir_key_file=None, shadir_key_file=None,
forbid_supervisord_automatic_launch=False,
develop=False, develop=False,
software_release_filter_list=None, software_release_filter_list=None,
computer_partition_filter_list=None, computer_partition_filter_list=None,
...@@ -312,6 +314,7 @@ class Slapgrid(object): ...@@ -312,6 +314,7 @@ class Slapgrid(object):
self.shacache_key_file = shacache_key_file self.shacache_key_file = shacache_key_file
self.shadir_cert_file = shadir_cert_file self.shadir_cert_file = shadir_cert_file
self.shadir_key_file = shadir_key_file self.shadir_key_file = shadir_key_file
self.forbid_supervisord_automatic_launch = forbid_supervisord_automatic_launch
self.logger = logger self.logger = logger
# Creates objects from slap module # Creates objects from slap module
self.slap = slapos.slap.slap() self.slap = slapos.slap.slap()
...@@ -356,7 +359,8 @@ class Slapgrid(object): ...@@ -356,7 +359,8 @@ class Slapgrid(object):
createSupervisordConfiguration(self.instance_root, self._getWatchdogLine()) createSupervisordConfiguration(self.instance_root, self._getWatchdogLine())
def _launchSupervisord(self): def _launchSupervisord(self):
launchSupervisord(instance_root=self.instance_root, logger=self.logger) if not self.forbid_supervisord_automatic_launch:
launchSupervisord(instance_root=self.instance_root, logger=self.logger)
def getComputerPartitionList(self): def getComputerPartitionList(self):
try: try:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment