Browse code

Drop signing_dir option from configure_auth_token_middleware

This is no longer being used due to Keystone PKI tokens no longer
being implemented.

In order to not break backward compatibility we create a new function
that is to be used instead and deprecate the old one. Modify the old
function to ignore the 3rd argument and display a deprecation warning.
Adjust callers to no longer create and set that directory, calling the
new function instead.

Change-Id: Id0dec1ba72467cce5cacfcfdb2bc0af2bd3a3610

Dirk Mueller authored on 2017/11/18 03:52:29
Showing 8 changed files
... ...
@@ -51,7 +51,6 @@ else
51 51
 fi
52 52
 
53 53
 CINDER_STATE_PATH=${CINDER_STATE_PATH:=$DATA_DIR/cinder}
54
-CINDER_AUTH_CACHE_DIR=${CINDER_AUTH_CACHE_DIR:-/var/cache/cinder}
55 54
 
56 55
 CINDER_CONF_DIR=/etc/cinder
57 56
 CINDER_CONF=$CINDER_CONF_DIR/cinder.conf
... ...
@@ -217,7 +216,7 @@ function configure_cinder {
217 217
     inicomment $CINDER_API_PASTE_INI filter:authtoken admin_password
218 218
     inicomment $CINDER_API_PASTE_INI filter:authtoken signing_dir
219 219
 
220
-    configure_auth_token_middleware $CINDER_CONF cinder $CINDER_AUTH_CACHE_DIR
220
+    configure_keystone_authtoken_middleware $CINDER_CONF cinder
221 221
 
222 222
     iniset $CINDER_CONF DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL
223 223
 
... ...
@@ -314,7 +313,7 @@ function configure_cinder {
314 314
     fi
315 315
 
316 316
     # Set nova credentials (used for os-assisted-snapshots)
317
-    configure_auth_token_middleware $CINDER_CONF nova $CINDER_AUTH_CACHE_DIR nova
317
+    configure_keystone_authtoken_middleware $CINDER_CONF nova nova
318 318
     iniset $CINDER_CONF nova region_name "$REGION_NAME"
319 319
     iniset $CINDER_CONF DEFAULT graceful_shutdown_timeout "$SERVICE_GRACEFUL_SHUTDOWN_TIMEOUT"
320 320
 
... ...
@@ -380,13 +379,6 @@ function create_cinder_accounts {
380 380
     fi
381 381
 }
382 382
 
383
-# create_cinder_cache_dir() - Part of the init_cinder() process
384
-function create_cinder_cache_dir {
385
-    # Create cache dir
386
-    sudo install -d -o $STACK_USER $CINDER_AUTH_CACHE_DIR
387
-    rm -f $CINDER_AUTH_CACHE_DIR/*
388
-}
389
-
390 383
 # init_cinder() - Initialize database and volume group
391 384
 function init_cinder {
392 385
     if is_service_enabled $DATABASE_BACKENDS; then
... ...
@@ -415,7 +407,6 @@ function init_cinder {
415 415
     fi
416 416
 
417 417
     mkdir -p $CINDER_STATE_PATH/volumes
418
-    create_cinder_cache_dir
419 418
 }
420 419
 
421 420
 # install_cinder() - Collect source and prepare
... ...
@@ -44,7 +44,6 @@ fi
44 44
 GLANCE_CACHE_DIR=${GLANCE_CACHE_DIR:=$DATA_DIR/glance/cache}
45 45
 GLANCE_IMAGE_DIR=${GLANCE_IMAGE_DIR:=$DATA_DIR/glance/images}
46 46
 GLANCE_LOCK_DIR=${GLANCE_LOCK_DIR:=$DATA_DIR/glance/locks}
47
-GLANCE_AUTH_CACHE_DIR=${GLANCE_AUTH_CACHE_DIR:-/var/cache/glance}
48 47
 
49 48
 GLANCE_CONF_DIR=${GLANCE_CONF_DIR:-/etc/glance}
50 49
 GLANCE_METADEF_DIR=$GLANCE_CONF_DIR/metadefs
... ...
@@ -97,20 +96,14 @@ function is_glance_enabled {
97 97
 # cleanup_glance() - Remove residual data files, anything left over from previous
98 98
 # runs that a clean run would need to clean up
99 99
 function cleanup_glance {
100
-    # kill instances (nova)
101 100
     # delete image files (glance)
102
-    sudo rm -rf $GLANCE_CACHE_DIR $GLANCE_IMAGE_DIR $GLANCE_AUTH_CACHE_DIR
101
+    sudo rm -rf $GLANCE_CACHE_DIR $GLANCE_IMAGE_DIR
103 102
 }
104 103
 
105 104
 # configure_glance() - Set config files, create data dirs, etc
106 105
 function configure_glance {
107 106
     sudo install -d -o $STACK_USER $GLANCE_CONF_DIR $GLANCE_METADEF_DIR
108 107
 
109
-    # We run this here as this configures cache dirs for the auth middleware
110
-    # which is used in the api server and not in the registry. The api
111
-    # Server is configured through this function and not init_glance.
112
-    create_glance_cache_dir
113
-
114 108
     # Set non-default configuration options for registry
115 109
     iniset $GLANCE_REGISTRY_CONF DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL
116 110
     iniset $GLANCE_REGISTRY_CONF DEFAULT bind_host $GLANCE_SERVICE_LISTEN_ADDRESS
... ...
@@ -120,7 +113,7 @@ function configure_glance {
120 120
     iniset $GLANCE_REGISTRY_CONF database connection $dburl
121 121
     iniset $GLANCE_REGISTRY_CONF DEFAULT use_syslog $SYSLOG
122 122
     iniset $GLANCE_REGISTRY_CONF paste_deploy flavor keystone
123
-    configure_auth_token_middleware $GLANCE_REGISTRY_CONF glance $GLANCE_AUTH_CACHE_DIR/registry
123
+    configure_keystone_authtoken_middleware $GLANCE_REGISTRY_CONF glance
124 124
     iniset $GLANCE_REGISTRY_CONF oslo_messaging_notifications driver messagingv2
125 125
     iniset_rpc_backend glance $GLANCE_REGISTRY_CONF
126 126
     iniset $GLANCE_REGISTRY_CONF DEFAULT graceful_shutdown_timeout "$SERVICE_GRACEFUL_SHUTDOWN_TIMEOUT"
... ...
@@ -132,7 +125,7 @@ function configure_glance {
132 132
     iniset $GLANCE_API_CONF DEFAULT image_cache_dir $GLANCE_CACHE_DIR/
133 133
     iniset $GLANCE_API_CONF oslo_concurrency lock_path $GLANCE_LOCK_DIR
134 134
     iniset $GLANCE_API_CONF paste_deploy flavor keystone+cachemanagement
135
-    configure_auth_token_middleware $GLANCE_API_CONF glance $GLANCE_AUTH_CACHE_DIR/api
135
+    configure_keystone_authtoken_middleware $GLANCE_API_CONF glance
136 136
     iniset $GLANCE_API_CONF oslo_messaging_notifications driver messagingv2
137 137
     iniset_rpc_backend glance $GLANCE_API_CONF
138 138
     if [ "$VIRT_DRIVER" = 'xenserver' ]; then
... ...
@@ -279,23 +272,12 @@ function create_glance_accounts {
279 279
     fi
280 280
 }
281 281
 
282
-# create_glance_cache_dir() - Part of the configure_glance() process
283
-function create_glance_cache_dir {
284
-    # Create cache dir
285
-    sudo install -d -o $STACK_USER $GLANCE_AUTH_CACHE_DIR/api $GLANCE_AUTH_CACHE_DIR/registry $GLANCE_AUTH_CACHE_DIR/search $GLANCE_AUTH_CACHE_DIR/artifact
286
-    rm -f $GLANCE_AUTH_CACHE_DIR/api/* $GLANCE_AUTH_CACHE_DIR/registry/* $GLANCE_AUTH_CACHE_DIR/search/* $GLANCE_AUTH_CACHE_DIR/artifact/*
287
-}
288
-
289 282
 # init_glance() - Initialize databases, etc.
290 283
 function init_glance {
291 284
     # Delete existing images
292 285
     rm -rf $GLANCE_IMAGE_DIR
293 286
     mkdir -p $GLANCE_IMAGE_DIR
294 287
 
295
-    # Delete existing cache
296
-    rm -rf $GLANCE_CACHE_DIR
297
-    mkdir -p $GLANCE_CACHE_DIR
298
-
299 288
     # (Re)create glance database
300 289
     recreate_database glance
301 290
 
... ...
@@ -397,18 +397,17 @@ function create_service_user {
397 397
     fi
398 398
 }
399 399
 
400
-# Configure the service to use the auth token middleware.
400
+# Configure a service to use the auth token middleware.
401 401
 #
402
-# configure_auth_token_middleware conf_file admin_user signing_dir [section]
402
+# configure_keystone_authtoken_middleware conf_file admin_user IGNORED [section]
403 403
 #
404 404
 # section defaults to keystone_authtoken, which is where auth_token looks in
405 405
 # the .conf file. If the paste config file is used (api-paste.ini) then
406 406
 # provide the section name for the auth_token filter.
407
-function configure_auth_token_middleware {
407
+function configure_keystone_authtoken_middleware {
408 408
     local conf_file=$1
409 409
     local admin_user=$2
410
-    local signing_dir=$3
411
-    local section=${4:-keystone_authtoken}
410
+    local section=${3:-keystone_authtoken}
412 411
 
413 412
     iniset $conf_file $section auth_type password
414 413
     iniset $conf_file $section auth_url $KEYSTONE_SERVICE_URI
... ...
@@ -419,10 +418,16 @@ function configure_auth_token_middleware {
419 419
     iniset $conf_file $section project_domain_name "$SERVICE_DOMAIN_NAME"
420 420
 
421 421
     iniset $conf_file $section cafile $SSL_BUNDLE_FILE
422
-    iniset $conf_file $section signing_dir $signing_dir
423 422
     iniset $conf_file $section memcached_servers localhost:11211
424 423
 }
425 424
 
425
+# configure_auth_token_middleware conf_file admin_user IGNORED [section]
426
+# TODO(frickler): old function for backwards compatibility, remove in U cycle
427
+function configure_auth_token_middleware {
428
+    echo "WARNING: configure_auth_token_middleware is deprecated, use configure_keystone_authtoken_middleware instead"
429
+    configure_keystone_authtoken_middleware $1 $2 $4
430
+}
431
+
426 432
 # init_keystone() - Initialize databases, etc.
427 433
 function init_keystone {
428 434
     if is_service_enabled ldap; then
... ...
@@ -36,7 +36,6 @@ GITDIR["python-neutronclient"]=$DEST/python-neutronclient
36 36
 NEUTRON_DEPLOY_MOD_WSGI=$(trueorfalse False NEUTRON_DEPLOY_MOD_WSGI)
37 37
 NEUTRON_AGENT=${NEUTRON_AGENT:-openvswitch}
38 38
 NEUTRON_DIR=$DEST/neutron
39
-NEUTRON_AUTH_CACHE_DIR=${NEUTRON_AUTH_CACHE_DIR:-/var/cache/neutron}
40 39
 
41 40
 NEUTRON_DISTRIBUTED_ROUTING=$(trueorfalse False NEUTRON_DISTRIBUTED_ROUTING)
42 41
 # Distributed Virtual Router (DVR) configuration
... ...
@@ -62,7 +61,6 @@ NEUTRON_AGENT_CONF=$NEUTRON_CONF_DIR/
62 62
 NEUTRON_CREATE_INITIAL_NETWORKS=${NEUTRON_CREATE_INITIAL_NETWORKS:-True}
63 63
 
64 64
 NEUTRON_STATE_PATH=${NEUTRON_STATE_PATH:=$DATA_DIR/neutron}
65
-NEUTRON_AUTH_CACHE_DIR=${NEUTRON_AUTH_CACHE_DIR:-/var/cache/neutron}
66 65
 
67 66
 NEUTRON_UWSGI_CONF=$NEUTRON_CONF_DIR/neutron-api-uwsgi.ini
68 67
 
... ...
@@ -200,8 +198,8 @@ function configure_neutron_new {
200 200
         iniset $NEUTRON_CONF DEFAULT router_distributed $NEUTRON_DISTRIBUTED_ROUTING
201 201
 
202 202
         iniset $NEUTRON_CONF DEFAULT auth_strategy $NEUTRON_AUTH_STRATEGY
203
-        configure_auth_token_middleware $NEUTRON_CONF neutron $NEUTRON_AUTH_CACHE_DIR keystone_authtoken
204
-        configure_auth_token_middleware $NEUTRON_CONF nova $NEUTRON_AUTH_CACHE_DIR nova
203
+        configure_keystone_authtoken_middleware $NEUTRON_CONF neutron
204
+        configure_keystone_authtoken_middleware $NEUTRON_CONF nova nova
205 205
 
206 206
         # Configure VXLAN
207 207
         # TODO(sc68cal) not hardcode?
... ...
@@ -292,7 +290,7 @@ function configure_neutron_new {
292 292
 
293 293
         # TODO(dtroyer): remove the v2.0 hard code below
294 294
         iniset $NEUTRON_META_CONF DEFAULT auth_url $KEYSTONE_SERVICE_URI
295
-        configure_auth_token_middleware $NEUTRON_META_CONF neutron $NEUTRON_AUTH_CACHE_DIR DEFAULT
295
+        configure_keystone_authtoken_middleware $NEUTRON_META_CONF neutron DEFAULT
296 296
     fi
297 297
 
298 298
     # Format logging
... ...
@@ -389,13 +387,6 @@ function create_neutron_accounts_new {
389 389
     fi
390 390
 }
391 391
 
392
-# create_neutron_cache_dir() - Part of the init_neutron() process
393
-function create_neutron_cache_dir {
394
-    # Create cache dir
395
-    sudo install -d -o $STACK_USER $NEUTRON_AUTH_CACHE_DIR
396
-    rm -f $NEUTRON_AUTH_CACHE_DIR/*
397
-}
398
-
399 392
 # init_neutron() - Initialize databases, etc.
400 393
 function init_neutron_new {
401 394
 
... ...
@@ -405,8 +396,6 @@ function init_neutron_new {
405 405
     # Run Neutron db migrations
406 406
     $NEUTRON_BIN_DIR/neutron-db-manage upgrade heads
407 407
     time_stop "dbsync"
408
-
409
-    create_neutron_cache_dir
410 408
 }
411 409
 
412 410
 # install_neutron() - Collect source and prepare
... ...
@@ -71,7 +71,6 @@ GITDIR["python-neutronclient"]=$DEST/python-neutronclient
71 71
 
72 72
 NEUTRON_DIR=$DEST/neutron
73 73
 NEUTRON_FWAAS_DIR=$DEST/neutron-fwaas
74
-NEUTRON_AUTH_CACHE_DIR=${NEUTRON_AUTH_CACHE_DIR:-/var/cache/neutron}
75 74
 
76 75
 # Support entry points installation of console scripts
77 76
 if [[ -d $NEUTRON_DIR/bin/neutron-server ]]; then
... ...
@@ -841,13 +840,13 @@ function _configure_neutron_service {
841 841
     iniset $NEUTRON_CONF DEFAULT allow_overlapping_ips $Q_ALLOW_OVERLAPPING_IP
842 842
 
843 843
     iniset $NEUTRON_CONF DEFAULT auth_strategy $Q_AUTH_STRATEGY
844
-    _neutron_setup_keystone $NEUTRON_CONF keystone_authtoken
844
+    configure_keystone_authtoken_middleware $NEUTRON_CONF $Q_ADMIN_USERNAME
845 845
 
846 846
     # Configuration for neutron notifications to nova.
847 847
     iniset $NEUTRON_CONF DEFAULT notify_nova_on_port_status_changes $Q_NOTIFY_NOVA_PORT_STATUS_CHANGES
848 848
     iniset $NEUTRON_CONF DEFAULT notify_nova_on_port_data_changes $Q_NOTIFY_NOVA_PORT_DATA_CHANGES
849 849
 
850
-    configure_auth_token_middleware $NEUTRON_CONF nova $NEUTRON_AUTH_CACHE_DIR nova
850
+    configure_keystone_authtoken_middleware $NEUTRON_CONF nova nova
851 851
 
852 852
     # Configure plugin
853 853
     neutron_plugin_configure_service
... ...
@@ -933,15 +932,6 @@ function _neutron_setup_rootwrap {
933 933
     fi
934 934
 }
935 935
 
936
-# Configures keystone integration for neutron service
937
-function _neutron_setup_keystone {
938
-    local conf_file=$1
939
-    local section=$2
940
-
941
-    create_neutron_cache_dir
942
-    configure_auth_token_middleware $conf_file $Q_ADMIN_USERNAME $NEUTRON_AUTH_CACHE_DIR $section
943
-}
944
-
945 936
 function _neutron_setup_interface_driver {
946 937
 
947 938
     # ovs_use_veth needs to be set before the plugin configuration
... ...
@@ -46,7 +46,6 @@ fi
46 46
 NOVA_STATE_PATH=${NOVA_STATE_PATH:=$DATA_DIR/nova}
47 47
 # INSTANCES_PATH is the previous name for this
48 48
 NOVA_INSTANCES_PATH=${NOVA_INSTANCES_PATH:=${INSTANCES_PATH:=$NOVA_STATE_PATH/instances}}
49
-NOVA_AUTH_CACHE_DIR=${NOVA_AUTH_CACHE_DIR:-/var/cache/nova}
50 49
 
51 50
 NOVA_CONF_DIR=/etc/nova
52 51
 NOVA_CONF=$NOVA_CONF_DIR/nova.conf
... ...
@@ -215,7 +214,7 @@ function cleanup_nova {
215 215
         sudo rm -rf $NOVA_INSTANCES_PATH/*
216 216
     fi
217 217
 
218
-    sudo rm -rf $NOVA_STATE_PATH $NOVA_AUTH_CACHE_DIR
218
+    sudo rm -rf $NOVA_STATE_PATH
219 219
 
220 220
     # NOTE(dtroyer): This really should be called from here but due to the way
221 221
     #                nova abuses the _cleanup() function we're moving it
... ...
@@ -443,7 +442,7 @@ function create_nova_conf {
443 443
             iniset $NOVA_CONF DEFAULT osapi_compute_link_prefix $NOVA_SERVICE_PROTOCOL://$NOVA_SERVICE_HOST:$NOVA_SERVICE_PORT
444 444
         fi
445 445
 
446
-        configure_auth_token_middleware $NOVA_CONF nova $NOVA_AUTH_CACHE_DIR
446
+        configure_keystone_authtoken_middleware $NOVA_CONF nova
447 447
     fi
448 448
 
449 449
     if is_service_enabled cinder; then
... ...
@@ -690,13 +689,6 @@ function conductor_conf {
690 690
     echo "${NOVA_CONF_DIR}/nova_cell${cell}.conf"
691 691
 }
692 692
 
693
-# create_nova_cache_dir() - Part of the init_nova() process
694
-function create_nova_cache_dir {
695
-    # Create cache dir
696
-    sudo install -d -o $STACK_USER $NOVA_AUTH_CACHE_DIR
697
-    rm -f $NOVA_AUTH_CACHE_DIR/*
698
-}
699
-
700 693
 # create_nova_keys_dir() - Part of the init_nova() process
701 694
 function create_nova_keys_dir {
702 695
     # Create keys dir
... ...
@@ -738,7 +730,6 @@ function init_nova {
738 738
         done
739 739
     fi
740 740
 
741
-    create_nova_cache_dir
742 741
     create_nova_keys_dir
743 742
 
744 743
     if [[ "$NOVA_BACKEND" == "LVM" ]]; then
... ...
@@ -29,7 +29,6 @@ set +o xtrace
29 29
 PLACEMENT_DIR=$DEST/placement
30 30
 PLACEMENT_CONF_DIR=/etc/placement
31 31
 PLACEMENT_CONF=$PLACEMENT_CONF_DIR/placement.conf
32
-PLACEMENT_AUTH_CACHE_DIR=${PLACEMENT_AUTH_CACHE_DIR:-/var/cache/placement}
33 32
 PLACEMENT_AUTH_STRATEGY=${PLACEMENT_AUTH_STRATEGY:-keystone}
34 33
 # Placement virtual environment
35 34
 if [[ ${USE_VENV} = True ]]; then
... ...
@@ -64,7 +63,6 @@ function is_placement_enabled {
64 64
 function cleanup_placement {
65 65
     sudo rm -f $(apache_site_config_for placement-api)
66 66
     remove_uwsgi_config "$PLACEMENT_UWSGI_CONF" "$PLACEMENT_UWSGI"
67
-    sudo rm -f $PLACEMENT_AUTH_CACHE_DIR/*
68 67
 }
69 68
 
70 69
 # _config_placement_apache_wsgi() - Set WSGI config files
... ...
@@ -99,7 +97,7 @@ function create_placement_conf {
99 99
     iniset $PLACEMENT_CONF placement_database connection `database_connection_url placement`
100 100
     iniset $PLACEMENT_CONF DEFAULT debug "$ENABLE_DEBUG_LOG_LEVEL"
101 101
     iniset $PLACEMENT_CONF api auth_strategy $PLACEMENT_AUTH_STRATEGY
102
-    configure_auth_token_middleware $PLACEMENT_CONF placement $PLACEMENT_AUTH_CACHE_DIR
102
+    configure_keystone_authtoken_middleware $PLACEMENT_CONF placement
103 103
     setup_logging $PLACEMENT_CONF
104 104
 }
105 105
 
... ...
@@ -127,19 +125,11 @@ function create_placement_accounts {
127 127
         "$placement_api_url"
128 128
 }
129 129
 
130
-# create_placement_cache_dir() - Create directories for keystone cache
131
-function create_placement_cache_dir {
132
-    # Create cache dir
133
-    sudo install -d -o $STACK_USER $PLACEMENT_AUTH_CACHE_DIR
134
-    rm -f $PLACEMENT_AUTH_CACHE_DIR/*
135
-}
136
-
137 130
 # init_placement() - Create service user and endpoints
138 131
 function init_placement {
139 132
     recreate_database placement
140 133
     $PLACEMENT_BIN_DIR/placement-manage db sync
141 134
     create_placement_accounts
142
-    create_placement_cache_dir
143 135
 }
144 136
 
145 137
 # install_placement() - Collect source and prepare
... ...
@@ -47,7 +47,6 @@ else
47 47
     SWIFT_BIN_DIR=$(get_python_exec_prefix)
48 48
 fi
49 49
 
50
-SWIFT_AUTH_CACHE_DIR=${SWIFT_AUTH_CACHE_DIR:-/var/cache/swift}
51 50
 SWIFT_APACHE_WSGI_DIR=${SWIFT_APACHE_WSGI_DIR:-/var/www/swift}
52 51
 
53 52
 SWIFT_SERVICE_PROTOCOL=${SWIFT_SERVICE_PROTOCOL:-$SERVICE_PROTOCOL}
... ...
@@ -452,7 +451,7 @@ function configure_swift {
452 452
     iniset ${SWIFT_CONFIG_PROXY_SERVER} filter:authtoken log_name swift
453 453
 
454 454
     iniset ${SWIFT_CONFIG_PROXY_SERVER} filter:authtoken paste.filter_factory keystonemiddleware.auth_token:filter_factory
455
-    configure_auth_token_middleware $SWIFT_CONFIG_PROXY_SERVER swift $SWIFT_AUTH_CACHE_DIR filter:authtoken
455
+    configure_keystone_authtoken_middleware $SWIFT_CONFIG_PROXY_SERVER swift filter:authtoken
456 456
     iniset ${SWIFT_CONFIG_PROXY_SERVER} filter:authtoken delay_auth_decision 1
457 457
     iniset ${SWIFT_CONFIG_PROXY_SERVER} filter:authtoken cache swift.cache
458 458
     iniset ${SWIFT_CONFIG_PROXY_SERVER} filter:authtoken include_service_catalog False
... ...
@@ -735,10 +734,6 @@ function init_swift {
735 735
         $SWIFT_BIN_DIR/swift-ring-builder container.builder rebalance 42
736 736
         $SWIFT_BIN_DIR/swift-ring-builder account.builder rebalance 42
737 737
     } && popd >/dev/null
738
-
739
-    # Create cache dir
740
-    sudo install -d -o ${STACK_USER} $SWIFT_AUTH_CACHE_DIR
741
-    rm -f $SWIFT_AUTH_CACHE_DIR/*
742 738
 }
743 739
 
744 740
 function install_swift {