Add support for redis to Zaqar's lib
A new redis driver has landed in Zaqar. This patch adds support for that
driver to Zaqar's lib.
Change-Id: I97629a303c55ee098e3bfbc534bfb05ccab94649
diff --git a/files/apts/zaqar-server b/files/apts/zaqar-server
index bc7ef22..32b1017 100644
--- a/files/apts/zaqar-server
+++ b/files/apts/zaqar-server
@@ -1,3 +1,5 @@
python-pymongo
mongodb-server
pkg-config
+redis-server # NOPRIME
+python-redis # NOPRIME
\ No newline at end of file
diff --git a/files/rpms/zaqar-server b/files/rpms/zaqar-server
index d7b7ea8..69e8bfa 100644
--- a/files/rpms/zaqar-server
+++ b/files/rpms/zaqar-server
@@ -1,3 +1,5 @@
selinux-policy-targeted
mongodb-server
pymongo
+redis # NOPRIME
+python-redis # NOPRIME
diff --git a/lib/zaqar b/lib/zaqar
index fe25e1f..b8570eb 100644
--- a/lib/zaqar
+++ b/lib/zaqar
@@ -125,11 +125,27 @@
iniset $ZAQAR_CONF drivers storage mongodb
iniset $ZAQAR_CONF 'drivers:storage:mongodb' uri mongodb://localhost:27017/zaqar
configure_mongodb
+ elif [ "$ZAQAR_BACKEND" = 'redis' ] ; then
+ iniset $ZAQAR_CONF drivers storage redis
+ iniset $ZAQAR_CONF 'drivers:storage:redis' uri redis://localhost:6379
+ configure_redis
fi
cleanup_zaqar
}
+function configure_redis {
+ if is_ubuntu; then
+ install_package redis-server
+ elif is_fedora; then
+ install_package redis
+ else
+ exit_distro_not_supported "redis installation"
+ fi
+
+ install_package python-redis
+}
+
function configure_mongodb {
# Set nssize to 2GB. This increases the number of namespaces supported
# # per database.