Browse code

Don't treat service as enabled if in disabled list

The old implementation for is_$service_enabled simply checked if any of
the subservices were enabled and if so the service was considered to be
enabled. This makes disabling services complicated as it means you have
to list every single subservice which can and do change over time.

Instead also check if the generic service name is in the disabled
services list and if so don't treat the service as enabled.

Change-Id: I7fe4dfca2cd9c15069d50a04161a29c5638291cb

Clark Boylan authored on 2017/05/31 06:11:09
Showing 7 changed files
... ...
@@ -129,6 +129,7 @@ CINDER_CACHE_ENABLED_FOR_BACKENDS=${CINDER_CACHE_ENABLED_FOR_BACKENDS:-$CINDER_E
129 129
 # Test if any Cinder services are enabled
130 130
 # is_cinder_enabled
131 131
 function is_cinder_enabled {
132
+    [[ ,${DISABLED_SERVICES} =~ ,"cinder" ]] && return 1
132 133
     [[ ,${ENABLED_SERVICES} =~ ,"c-" ]] && return 0
133 134
     return 1
134 135
 }
... ...
@@ -78,6 +78,7 @@ GLANCE_REGISTRY_PORT_INT=${GLANCE_REGISTRY_PORT_INT:-19191}
78 78
 # Test if any Glance services are enabled
79 79
 # is_glance_enabled
80 80
 function is_glance_enabled {
81
+    [[ ,${DISABLED_SERVICES} =~ ,"glance" ]] && return 1
81 82
     [[ ,${ENABLED_SERVICES} =~ ,"g-" ]] && return 0
82 83
     return 1
83 84
 }
... ...
@@ -134,6 +134,7 @@ KEYSTONE_UNIQUE_LAST_PASSWORD_COUNT=${KEYSTONE_UNIQUE_LAST_PASSWORD_COUNT:-2}
134 134
 # Test if Keystone is enabled
135 135
 # is_keystone_enabled
136 136
 function is_keystone_enabled {
137
+    [[ ,${DISABLED_SERVICES} =~ ,"keystone" ]] && return 1
137 138
     [[ ,${ENABLED_SERVICES}, =~ ,"key", ]] && return 0
138 139
     return 1
139 140
 }
... ...
@@ -91,6 +91,7 @@ declare -a -g _NEUTRON_SERVER_EXTRA_CONF_FILES_ABS
91 91
 # Test if any Neutron services are enabled
92 92
 # is_neutron_enabled
93 93
 function is_neutron_enabled {
94
+    [[ ,${DISABLED_SERVICES} =~ ,"neutron" ]] && return 1
94 95
     [[ ,${ENABLED_SERVICES} =~ ,"neutron-" || ,${ENABLED_SERVICES} =~ ,"q-" ]] && return 0
95 96
     return 1
96 97
 }
... ...
@@ -98,6 +99,7 @@ function is_neutron_enabled {
98 98
 # Test if any Neutron services are enabled
99 99
 # is_neutron_enabled
100 100
 function is_neutron_legacy_enabled {
101
+    [[ ,${DISABLED_SERVICES} =~ ,"neutron" ]] && return 1
101 102
     [[ ,${ENABLED_SERVICES} =~ ,"q-" ]] && return 0
102 103
     return 1
103 104
 }
... ...
@@ -175,6 +175,7 @@ NOVA_USE_SERVICE_TOKEN=$(trueorfalse False NOVA_USE_SERVICE_TOKEN)
175 175
 # Test if any Nova services are enabled
176 176
 # is_nova_enabled
177 177
 function is_nova_enabled {
178
+    [[ ,${DISABLED_SERVICES} =~ ,"nova" ]] && return 1
178 179
     [[ ,${ENABLED_SERVICES} =~ ,"n-" ]] && return 0
179 180
     return 1
180 181
 }
... ...
@@ -174,6 +174,7 @@ SWIFT_STORAGE_IPS=${SWIFT_STORAGE_IPS:-}
174 174
 # Test if any Swift services are enabled
175 175
 # is_swift_enabled
176 176
 function is_swift_enabled {
177
+    [[ ,${DISABLED_SERVICES} =~ ,"swift" ]] && return 1
177 178
     [[ ,${ENABLED_SERVICES} =~ ,"s-" ]] && return 0
178 179
     return 1
179 180
 }
... ...
@@ -41,6 +41,7 @@ XXX_CONF_DIR=/etc/XXXX
41 41
 # Test if any XXXX services are enabled
42 42
 # is_XXXX_enabled
43 43
 function is_XXXX_enabled {
44
+    [[ ,${DISABLED_SERVICES} =~ ,"XXXX" ]] && return 1
44 45
     [[ ,${ENABLED_SERVICES} =~ ,"XX-" ]] && return 0
45 46
     return 1
46 47
 }