From 902158bb8fb8452d747225e5986fb789828e4e67 Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Tue, 30 May 2017 14:11:09 -0700 Subject: [PATCH] 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 --- lib/cinder | 1 + lib/glance | 1 + lib/keystone | 1 + lib/neutron | 2 ++ lib/nova | 1 + lib/swift | 1 + lib/template | 1 + 7 files changed, 8 insertions(+) diff --git a/lib/cinder b/lib/cinder index 2cbab2030b..291eebee87 100644 --- a/lib/cinder +++ b/lib/cinder @@ -129,6 +129,7 @@ CINDER_CACHE_ENABLED_FOR_BACKENDS=${CINDER_CACHE_ENABLED_FOR_BACKENDS:-$CINDER_E # Test if any Cinder services are enabled # is_cinder_enabled function is_cinder_enabled { + [[ ,${DISABLED_SERVICES} =~ ,"cinder" ]] && return 1 [[ ,${ENABLED_SERVICES} =~ ,"c-" ]] && return 0 return 1 } diff --git a/lib/glance b/lib/glance index d6438a6b48..57b5f45113 100644 --- a/lib/glance +++ b/lib/glance @@ -78,6 +78,7 @@ GLANCE_REGISTRY_PORT_INT=${GLANCE_REGISTRY_PORT_INT:-19191} # Test if any Glance services are enabled # is_glance_enabled function is_glance_enabled { + [[ ,${DISABLED_SERVICES} =~ ,"glance" ]] && return 1 [[ ,${ENABLED_SERVICES} =~ ,"g-" ]] && return 0 return 1 } diff --git a/lib/keystone b/lib/keystone index 4bb6893089..eaed937d2e 100644 --- a/lib/keystone +++ b/lib/keystone @@ -134,6 +134,7 @@ KEYSTONE_UNIQUE_LAST_PASSWORD_COUNT=${KEYSTONE_UNIQUE_LAST_PASSWORD_COUNT:-2} # Test if Keystone is enabled # is_keystone_enabled function is_keystone_enabled { + [[ ,${DISABLED_SERVICES} =~ ,"keystone" ]] && return 1 [[ ,${ENABLED_SERVICES}, =~ ,"key", ]] && return 0 return 1 } diff --git a/lib/neutron b/lib/neutron index efca88050b..5c88a50bad 100644 --- a/lib/neutron +++ b/lib/neutron @@ -91,6 +91,7 @@ declare -a -g _NEUTRON_SERVER_EXTRA_CONF_FILES_ABS # Test if any Neutron services are enabled # is_neutron_enabled function is_neutron_enabled { + [[ ,${DISABLED_SERVICES} =~ ,"neutron" ]] && return 1 [[ ,${ENABLED_SERVICES} =~ ,"neutron-" || ,${ENABLED_SERVICES} =~ ,"q-" ]] && return 0 return 1 } @@ -98,6 +99,7 @@ function is_neutron_enabled { # Test if any Neutron services are enabled # is_neutron_enabled function is_neutron_legacy_enabled { + [[ ,${DISABLED_SERVICES} =~ ,"neutron" ]] && return 1 [[ ,${ENABLED_SERVICES} =~ ,"q-" ]] && return 0 return 1 } diff --git a/lib/nova b/lib/nova index 9c3ba33013..5832f11d67 100644 --- a/lib/nova +++ b/lib/nova @@ -175,6 +175,7 @@ NOVA_USE_SERVICE_TOKEN=$(trueorfalse False NOVA_USE_SERVICE_TOKEN) # Test if any Nova services are enabled # is_nova_enabled function is_nova_enabled { + [[ ,${DISABLED_SERVICES} =~ ,"nova" ]] && return 1 [[ ,${ENABLED_SERVICES} =~ ,"n-" ]] && return 0 return 1 } diff --git a/lib/swift b/lib/swift index 8fad6b8f97..1472e4407b 100644 --- a/lib/swift +++ b/lib/swift @@ -174,6 +174,7 @@ SWIFT_STORAGE_IPS=${SWIFT_STORAGE_IPS:-} # Test if any Swift services are enabled # is_swift_enabled function is_swift_enabled { + [[ ,${DISABLED_SERVICES} =~ ,"swift" ]] && return 1 [[ ,${ENABLED_SERVICES} =~ ,"s-" ]] && return 0 return 1 } diff --git a/lib/template b/lib/template index b92fb40483..25d653cb46 100644 --- a/lib/template +++ b/lib/template @@ -41,6 +41,7 @@ XXX_CONF_DIR=/etc/XXXX # Test if any XXXX services are enabled # is_XXXX_enabled function is_XXXX_enabled { + [[ ,${DISABLED_SERVICES} =~ ,"XXXX" ]] && return 1 [[ ,${ENABLED_SERVICES} =~ ,"XX-" ]] && return 0 return 1 }