Begin is_service_enabled() cleanup

This converts the special cases in the is_service_enabled() function to call
individual functions declared by the projects.  This allows projects that
are not in the DevStack repo and called via the extras.d plugin to handle
an equivalent service alias.

* Ceilometer
* Cinder
* Glance
* Neutron
* Nova
* Swift

TODO: remove the tests from is_service_enabled() after a transition period

Patch Set 2: Rebased

Change-Id: Ic78be433f93a9dd5f46be548bdbd4c984e0da6e7
diff --git a/lib/ceilometer b/lib/ceilometer
index f9c7691..4ca77bb 100644
--- a/lib/ceilometer
+++ b/lib/ceilometer
@@ -59,7 +59,14 @@
 
 # Functions
 # ---------
-#
+
+# Test if any Ceilometer services are enabled
+# is_ceilometer_enabled
+function is_ceilometer_enabled {
+    [[ ,${ENABLED_SERVICES} =~ ,"ceilometer-" ]] && return 0
+    return 1
+}
+
 # create_ceilometer_accounts() - Set up common required ceilometer accounts
 
 create_ceilometer_accounts() {
diff --git a/lib/cinder b/lib/cinder
index 9f70b2a..3ec0fd4 100644
--- a/lib/cinder
+++ b/lib/cinder
@@ -85,6 +85,14 @@
 
 # Functions
 # ---------
+
+# Test if any Cinder services are enabled
+# is_cinder_enabled
+function is_cinder_enabled {
+    [[ ,${ENABLED_SERVICES} =~ ,"c-" ]] && return 0
+    return 1
+}
+
 # _clean_lvm_lv removes all cinder LVM volumes
 #
 # Usage: _clean_lvm_lv $VOLUME_GROUP $VOLUME_NAME_PREFIX
diff --git a/lib/glance b/lib/glance
index a5cb360..1ebeeb3 100644
--- a/lib/glance
+++ b/lib/glance
@@ -59,6 +59,13 @@
 # Functions
 # ---------
 
+# Test if any Glance services are enabled
+# is_glance_enabled
+function is_glance_enabled {
+    [[ ,${ENABLED_SERVICES} =~ ,"g-" ]] && return 0
+    return 1
+}
+
 # cleanup_glance() - Remove residual data files, anything left over from previous
 # runs that a clean run would need to clean up
 function cleanup_glance() {
diff --git a/lib/neutron b/lib/neutron
index 81db2a7..5bd38bc 100644
--- a/lib/neutron
+++ b/lib/neutron
@@ -244,6 +244,13 @@
 # Functions
 # ---------
 
+# Test if any Neutron services are enabled
+# is_neutron_enabled
+function is_neutron_enabled {
+    [[ ,${ENABLED_SERVICES} =~ ,"q-" ]] && return 0
+    return 1
+}
+
 # configure_neutron()
 # Set common config for all neutron server and agents.
 function configure_neutron() {
diff --git a/lib/nova b/lib/nova
index dbc5c3d..c6d9936 100644
--- a/lib/nova
+++ b/lib/nova
@@ -129,6 +129,20 @@
 # Functions
 # ---------
 
+# Test if any Nova services are enabled
+# is_nova_enabled
+function is_nova_enabled {
+    [[ ,${ENABLED_SERVICES} =~ ,"n-" ]] && return 0
+    return 1
+}
+
+# Test if any Nova Cell services are enabled
+# is_nova_enabled
+function is_n-cell_enabled {
+    [[ ,${ENABLED_SERVICES} =~ ,"n-cell-" ]] && return 0
+    return 1
+}
+
 # Helper to clean iptables rules
 function clean_iptables() {
     # Delete rules
diff --git a/lib/swift b/lib/swift
index 28ca8a8..197c01b 100644
--- a/lib/swift
+++ b/lib/swift
@@ -118,6 +118,13 @@
 # Functions
 # ---------
 
+# Test if any Swift services are enabled
+# is_swift_enabled
+function is_swift_enabled {
+    [[ ,${ENABLED_SERVICES} =~ ,"s-" ]] && return 0
+    return 1
+}
+
 # cleanup_swift() - Remove residual data files
 function cleanup_swift() {
     rm -f ${SWIFT_CONF_DIR}{*.builder,*.ring.gz,backups/*.builder,backups/*.ring.gz}
diff --git a/lib/template b/lib/template
index 629e110..b8e7c4d 100644
--- a/lib/template
+++ b/lib/template
@@ -10,6 +10,7 @@
 
 # ``stack.sh`` calls the entry points in this order:
 #
+# - is_XXXX_enabled
 # - install_XXXX
 # - configure_XXXX
 # - init_XXXX
@@ -35,6 +36,13 @@
 # Entry Points
 # ------------
 
+# Test if any XXXX services are enabled
+# is_XXXX_enabled
+function is_XXXX_enabled {
+    [[ ,${ENABLED_SERVICES} =~ ,"XX-" ]] && return 0
+    return 1
+}
+
 # cleanup_XXXX() - Remove residual data files, anything left over from previous
 # runs that a clean run would need to clean up
 function cleanup_XXXX() {