Allow jobs to disable all services
Several legacy jobs use the OVERRIDE_ENABLED_SERVICES variable
from d-g so set the list of services that should be enabled and
ignore the default set calculated via the feature matrix.
Add support for a similar functionality in the zuulv3 jobs
using the 'disable_all_services' localconf function.
Change-Id: I690554ec62cef3be600054071efbb3f92a99249e
diff --git a/roles/write-devstack-local-conf/README.rst b/roles/write-devstack-local-conf/README.rst
index e30dfa1..1b7eb1b 100644
--- a/roles/write-devstack-local-conf/README.rst
+++ b/roles/write-devstack-local-conf/README.rst
@@ -53,7 +53,12 @@
A dictionary mapping service names to boolean values. If the
boolean value is ``false``, a ``disable_service`` line will be
emitted for the service name. If it is ``true``, then
- ``enable_service`` will be emitted. All other values are ignored.
+ ``enable_service`` will be emitted. All other values are ignored.
+ The special key ``base`` can be used to enable or disable the base set of
+ services enabled by default. If ``base`` is found, it will processed before
+ all other keys. If its value is ``False`` a ``disable_all_services`` will be
+ emitted; if its value is ``True`` nothing will be emitted since base
+ services are enabled by default.
.. zuul:rolevar:: devstack_plugins
:type: dict
diff --git a/roles/write-devstack-local-conf/library/devstack_local_conf.py b/roles/write-devstack-local-conf/library/devstack_local_conf.py
index 4134beb..dbd60f5 100644
--- a/roles/write-devstack-local-conf/library/devstack_local_conf.py
+++ b/roles/write-devstack-local-conf/library/devstack_local_conf.py
@@ -124,6 +124,9 @@
self.localrc.append('enable_plugin {} {}'.format(k, v))
def handle_services(self, services):
+ base_services = services.pop('base', True)
+ if not base_services:
+ self.localrc.append('disable_all_services')
for k, v in services.items():
if v is False:
self.localrc.append('disable_service {}'.format(k))