Adds stop_service_on_exit option

This commit is contained in:
Alessandro Pilotti 2013-11-15 08:36:18 +02:00
parent e707754f3d
commit 1e4b0275af

View File

@ -26,6 +26,9 @@ from cloudbaseinit.plugins import factory as plugins_factory
opts = [ opts = [
cfg.BoolOpt('allow_reboot', default=True, help='Allows OS reboots ' cfg.BoolOpt('allow_reboot', default=True, help='Allows OS reboots '
'requested by plugins'), 'requested by plugins'),
cfg.BoolOpt('stop_service_on_exit', default=True, help='In case of '
'execution as a service, specifies if the service '
'must be gracefully stopped before exiting'),
] ]
CONF = cfg.CONF CONF = cfg.CONF
@ -111,5 +114,5 @@ class InitManager(object):
osutils.reboot() osutils.reboot()
except Exception, ex: except Exception, ex:
LOG.error('reboot failed with error \'%s\'' % ex) LOG.error('reboot failed with error \'%s\'' % ex)
else: elif CONF.stop_service_on_exit:
osutils.terminate() osutils.terminate()