Add is_ubuntu function

This replaces all of the [[ "$os_PACKAGE" = "deb" ]] tests, except when
those tests are before straight calls to dpkg.

Change-Id: I8a3ebf1b1bc5a55d736f9258d5ba1d24dabf04ea
diff --git a/lib/cinder b/lib/cinder
index 1aa34cd..ce160bf 100644
--- a/lib/cinder
+++ b/lib/cinder
@@ -237,7 +237,7 @@
 # start_cinder() - Start running processes, including screen
 function start_cinder() {
     if is_service_enabled c-vol; then
-        if [[ "$os_PACKAGE" = "deb" ]]; then
+        if is_ubuntu; then
             _configure_tgt_for_config_d
             if [[ ! -f /etc/tgt/conf.d/cinder.conf ]]; then
                echo "include $CINDER_STATE_PATH/volumes/*" | sudo tee /etc/tgt/conf.d/cinder.conf
diff --git a/lib/databases/mysql b/lib/databases/mysql
index eb84f2c..60ea143 100644
--- a/lib/databases/mysql
+++ b/lib/databases/mysql
@@ -20,7 +20,7 @@
 function configure_database_mysql {
     echo_summary "Configuring and starting MySQL"
 
-    if [[ "$os_PACKAGE" = "deb" ]]; then
+    if is_ubuntu; then
         MY_CONF=/etc/mysql/my.cnf
         MYSQL=mysql
     else
@@ -61,7 +61,7 @@
 }
 
 function install_database_mysql {
-    if [[ "$os_PACKAGE" = "deb" ]]; then
+    if is_ubuntu; then
         # Seed configuration with mysql password so that apt-get install doesn't
         # prompt us for a password upon install.
         cat <<MYSQL_PRESEED | sudo debconf-set-selections
diff --git a/lib/horizon b/lib/horizon
index 189ca10..d0a0f05 100644
--- a/lib/horizon
+++ b/lib/horizon
@@ -71,7 +71,7 @@
     sudo mkdir -p $HORIZON_DIR/.blackhole
 
 
-    if [[ "$os_PACKAGE" = "deb" ]]; then
+    if is_ubuntu; then
         APACHE_NAME=apache2
         APACHE_CONF=sites-available/horizon
         # Clean up the old config name
@@ -110,7 +110,7 @@
 # install_horizon() - Collect source and prepare
 function install_horizon() {
     # Apache installation, because we mark it NOPRIME
-    if [[ "$os_PACKAGE" = "deb" ]]; then
+    if is_ubuntu; then
         # Install apache2, which is NOPRIME'd
         install_package apache2 libapache2-mod-wsgi
     elif is_suse; then
@@ -121,7 +121,7 @@
     fi
 
     # NOTE(sdague) quantal changed the name of the node binary
-    if [[ "$os_PACKAGE" = "deb" ]]; then
+    if is_ubuntu; then
         if [[ ! -e "/usr/bin/node" ]]; then
             install_package nodejs-legacy
         fi
diff --git a/lib/nova b/lib/nova
index 6445a07..970806d 100644
--- a/lib/nova
+++ b/lib/nova
@@ -202,7 +202,7 @@
         # splitting a system into many smaller parts.  LXC uses cgroups and chroot
         # to simulate multiple systems.
         if [[ "$LIBVIRT_TYPE" == "lxc" ]]; then
-            if [[ "$os_PACKAGE" = "deb" ]]; then
+            if is_ubuntu; then
                 if [[ ! "$DISTRO" > natty ]]; then
                     cgline="none /cgroup cgroup cpuacct,memory,devices,cpu,freezer,blkio 0 0"
                     sudo mkdir -p /cgroup
@@ -228,7 +228,7 @@
 EOF
         fi
 
-        if [[ "$os_PACKAGE" = "deb" ]]; then
+        if is_ubuntu; then
             LIBVIRT_DAEMON=libvirt-bin
         else
             # http://wiki.libvirt.org/page/SSHPolicyKitSetup
@@ -393,7 +393,7 @@
 # install_nova() - Collect source and prepare
 function install_nova() {
     if is_service_enabled n-cpu; then
-        if [[ "$os_PACKAGE" = "deb" ]]; then
+        if is_ubuntu; then
             LIBVIRT_PKG_NAME=libvirt-bin
         else
             LIBVIRT_PKG_NAME=libvirt
@@ -403,7 +403,7 @@
         # splitting a system into many smaller parts.  LXC uses cgroups and chroot
         # to simulate multiple systems.
         if [[ "$LIBVIRT_TYPE" == "lxc" ]]; then
-            if [[ "$os_PACKAGE" = "deb" ]]; then
+            if is_ubuntu; then
                 if [[ "$DISTRO" > natty ]]; then
                     install_package cgroup-lite
                 fi
diff --git a/lib/swift b/lib/swift
index 366c467..140e5e9 100644
--- a/lib/swift
+++ b/lib/swift
@@ -159,7 +159,7 @@
         s,%SWIFT_DATA_DIR%,$SWIFT_DATA_DIR,;
     " $FILES/swift/rsyncd.conf | sudo tee /etc/rsyncd.conf
     # rsyncd.conf just prepared for 4 nodes
-    if [[ "$os_PACKAGE" = "deb" ]]; then
+    if is_ubuntu; then
         sudo sed -i '/^RSYNC_ENABLE=false/ { s/false/true/ }' /etc/default/rsync
     else
         sudo sed -i '/disable *= *yes/ { s/yes/no/ }' /etc/xinetd.d/rsync
@@ -341,7 +341,7 @@
     # (re)start rsyslog
     restart_service rsyslog
     # Start rsync
-    if [[ "$os_PACKAGE" = "deb" ]]; then
+    if is_ubuntu; then
         sudo /etc/init.d/rsync restart || :
     else
         sudo systemctl start xinetd.service