Add partial openSUSE/SLE support
Note that this is the first part of the support. A second part involves
dealing with the package names.
Among the changes:
- add several functions to determine some distro-specific behavior (how
to call usermod, if some features are available on the distro, etc.)
- correctly detect openSUSE and SLE in GetOSVersion, and set DISTRO
accordingly
- new is_suse() function to check if running on a SUSE-based distro
- use zypper to install packages
- adapt apache virtual host configuration for openSUSE
- some simple fixes (path to pip, mysql service name)
Change-Id: Id2f7c9e18a1c4a7b7cea262ea7959d183e4b0cf0
diff --git a/lib/cinder b/lib/cinder
index c2cf15b..058fcc2 100644
--- a/lib/cinder
+++ b/lib/cinder
@@ -63,11 +63,7 @@
cp -p $CINDER_DIR/etc/cinder/policy.json $CINDER_CONF_DIR
# Set the paths of certain binaries
- if [[ "$os_PACKAGE" = "deb" ]]; then
- CINDER_ROOTWRAP=/usr/local/bin/cinder-rootwrap
- else
- CINDER_ROOTWRAP=/usr/bin/cinder-rootwrap
- fi
+ CINDER_ROOTWRAP=$(get_rootwrap_location cinder)
# If Cinder ships the new rootwrap filters files, deploy them
# (owned by root) and add a parameter to $CINDER_ROOTWRAP
diff --git a/lib/databases/mysql b/lib/databases/mysql
index ed59290..fc6a3b7 100644
--- a/lib/databases/mysql
+++ b/lib/databases/mysql
@@ -25,7 +25,11 @@
MYSQL=mysql
else
MY_CONF=/etc/my.cnf
- MYSQL=mysqld
+ if is_suse; then
+ MYSQL=mysql
+ else
+ MYSQL=mysqld
+ fi
fi
# Start mysql-server
diff --git a/lib/horizon b/lib/horizon
index c6c96da..af09f77 100644
--- a/lib/horizon
+++ b/lib/horizon
@@ -81,9 +81,17 @@
sudo a2ensite horizon
else
# Install httpd, which is NOPRIME'd
- APACHE_NAME=httpd
- APACHE_CONF=conf.d/horizon.conf
- sudo sed '/^Listen/s/^.*$/Listen 0.0.0.0:80/' -i /etc/httpd/conf/httpd.conf
+ if is_suse; then
+ APACHE_NAME=apache2
+ APACHE_CONF=vhosts.d/horizon.conf
+ # Append wsgi to the list of modules to load
+ grep -q "^APACHE_MODULES=.*wsgi" /etc/sysconfig/apache2 ||
+ sudo sed '/^APACHE_MODULES=/s/^\(.*\)"$/\1 wsgi"/' -i /etc/sysconfig/apache2
+ else
+ APACHE_NAME=httpd
+ APACHE_CONF=conf.d/horizon.conf
+ sudo sed '/^Listen/s/^.*$/Listen 0.0.0.0:80/' -i /etc/httpd/conf/httpd.conf
+ fi
fi
# Configure apache to run horizon
diff --git a/lib/nova b/lib/nova
index 3ea2f2a..d15d9e3 100644
--- a/lib/nova
+++ b/lib/nova
@@ -47,11 +47,7 @@
fi
# Set the paths of certain binaries
-if [[ "$os_PACKAGE" = "deb" ]]; then
- NOVA_ROOTWRAP=/usr/local/bin/nova-rootwrap
-else
- NOVA_ROOTWRAP=/usr/bin/nova-rootwrap
-fi
+NOVA_ROOTWRAP=$(get_rootwrap_location nova)
# Allow rate limiting to be turned off for testing, like for Tempest
# NOTE: Set API_RATE_LIMIT="False" to turn OFF rate limiting
@@ -252,7 +248,7 @@
# The user that nova runs as needs to be member of **libvirtd** group otherwise
# nova-compute will be unable to use libvirt.
- sudo usermod -a -G libvirtd `whoami`
+ add_user_to_group `whoami` libvirtd
# libvirt detects various settings on startup, as we potentially changed
# the system configuration (modules, filesystems), we need to restart