Browse code

Merge "Always cache tokens in a shared memcache"

Jenkins authored on 2016/01/23 11:53:33
Showing 4 changed files
... ...
@@ -1,5 +1,6 @@
1 1
 libkrb5-dev
2 2
 libldap2-dev
3 3
 libsasl2-dev
4
+memcached
4 5
 python-mysqldb
5 6
 sqlite3
... ...
@@ -1,3 +1,4 @@
1 1
 cyrus-sasl-devel
2
+memcached
2 3
 openldap2-devel
3 4
 sqlite3
... ...
@@ -1,3 +1,4 @@
1
+memcached
1 2
 mod_ssl
2 3
 MySQL-python
3 4
 sqlite
... ...
@@ -430,6 +430,7 @@ function configure_auth_token_middleware {
430 430
     iniset $conf_file $section auth_uri $KEYSTONE_SERVICE_URI
431 431
     iniset $conf_file $section cafile $SSL_BUNDLE_FILE
432 432
     iniset $conf_file $section signing_dir $signing_dir
433
+    iniset $conf_file $section memcache_servers $SERVICE_HOST:11211
433 434
 }
434 435
 
435 436
 # init_keystone() - Initialize databases, etc.
... ...
@@ -483,6 +484,9 @@ function install_keystonemiddleware {
483 483
         # When not installing from repo, keystonemiddleware is still needed...
484 484
         pip_install_gr keystonemiddleware
485 485
     fi
486
+    # Install the memcache library so keystonemiddleware can cache tokens in a
487
+    # shared location.
488
+    pip_install_gr python-memcached
486 489
 }
487 490
 
488 491
 # install_keystone() - Collect source and prepare
... ...
@@ -491,17 +495,7 @@ function install_keystone {
491 491
     if is_service_enabled ldap; then
492 492
         install_ldap
493 493
     fi
494
-    if [[ "$KEYSTONE_TOKEN_BACKEND" = "memcache" ]]; then
495
-        # Install memcached and the memcache Python library that keystone uses.
496
-        # Unfortunately the Python library goes by different names in the .deb
497
-        # and .rpm circles.
498
-        install_package memcached
499
-        if is_ubuntu; then
500
-            install_package python-memcache
501
-        else
502
-            install_package python-memcached
503
-        fi
504
-    fi
494
+
505 495
     git_clone $KEYSTONE_REPO $KEYSTONE_DIR $KEYSTONE_BRANCH
506 496
     setup_develop $KEYSTONE_DIR
507 497
 
... ...
@@ -550,6 +544,9 @@ function start_keystone {
550 550
         start_tls_proxy '*' $KEYSTONE_SERVICE_PORT $KEYSTONE_SERVICE_HOST $KEYSTONE_SERVICE_PORT_INT &
551 551
         start_tls_proxy '*' $KEYSTONE_AUTH_PORT $KEYSTONE_AUTH_HOST $KEYSTONE_AUTH_PORT_INT &
552 552
     fi
553
+
554
+    # (re)start memcached to make sure we have a clean memcache.
555
+    restart_service memcached
553 556
 }
554 557
 
555 558
 # stop_keystone() - Stop running processes