From 6e8031680422a238fd8ea9fbc5ea04f2fd1e2a57 Mon Sep 17 00:00:00 2001 From: Sol Jerome Date: Sun, 2 Jun 2013 08:49:18 -0500 Subject: Services: Add new bootstatus attribute This new attribute allows the specification of a boot-time status separately from the current 'status' attribute. This allows for more fine-grained control over e.g. services that are really just boot scripts. Signed-off-by: Sol Jerome --- src/lib/Bcfg2/Client/Tools/__init__.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/lib/Bcfg2/Client/Tools/__init__.py') diff --git a/src/lib/Bcfg2/Client/Tools/__init__.py b/src/lib/Bcfg2/Client/Tools/__init__.py index c5a5ee4d6..11fe55bd6 100644 --- a/src/lib/Bcfg2/Client/Tools/__init__.py +++ b/src/lib/Bcfg2/Client/Tools/__init__.py @@ -519,6 +519,22 @@ class SvcTool(Tool): """ return '/etc/init.d/%s %s' % (service.get('name'), action) + def get_bootstatus(self, service): + """ Return the bootstatus attribute if it exists. + + :param service: The service entry + :type service: lxml.etree._Element + :returns: string or None - Value of bootstatus if it exists. If + bootstatus is unspecified and status is not *ignore*, + return value of status. If bootstatus is unspecified + and status is *ignore*, return None. + """ + if service.get('bootstatus') is not None: + return service.get('bootstatus') + elif service.get('status') != 'ignore': + return service.get('status') + return None + def start_service(self, service): """ Start a service. -- cgit v1.2.3-1-g7c22