Browse code

Refactor swift config services

Make the sed the command to change the recon_cache_path into the renamed
generate_swift_config_services

Change-Id: I6092c26836320fab607eb9cd07f63189a9ba1ddd

Chmouel Boudjnah authored on 2014/10/04 15:14:30
Showing 1 changed files
... ...
@@ -251,7 +251,7 @@ function _config_swift_apache_wsgi {
251 251
 
252 252
 # This function generates an object/container/account configuration
253 253
 # emulating 4 nodes on different ports
254
-function generate_swift_config {
254
+function generate_swift_config_services {
255 255
     local swift_node_config=$1
256 256
     local node_id=$2
257 257
     local bind_port=$3
... ...
@@ -286,6 +286,10 @@ function generate_swift_config {
286 286
 
287 287
     iniuncomment ${swift_node_config} ${server_type}-replicator vm_test_mode
288 288
     iniset ${swift_node_config} ${server_type}-replicator vm_test_mode yes
289
+
290
+    # Using a sed and not iniset/iniuncomment because we want to a global
291
+    # modification and make sure it works for new sections.
292
+    sed -i -e "s,#[ ]*recon_cache_path .*,recon_cache_path = ${SWIFT_DATA_DIR}/cache," ${swift_node_config}
289 293
 }
290 294
 
291 295
 
... ...
@@ -436,23 +440,18 @@ EOF
436 436
     for node_number in ${SWIFT_REPLICAS_SEQ}; do
437 437
         local swift_node_config=${SWIFT_CONF_DIR}/object-server/${node_number}.conf
438 438
         cp ${SWIFT_DIR}/etc/object-server.conf-sample ${swift_node_config}
439
-        generate_swift_config ${swift_node_config} ${node_number} $(( OBJECT_PORT_BASE + 10 * (node_number - 1) )) object
439
+        generate_swift_config_services ${swift_node_config} ${node_number} $(( OBJECT_PORT_BASE + 10 * (node_number - 1) )) object
440 440
         iniset ${swift_node_config} filter:recon recon_cache_path  ${SWIFT_DATA_DIR}/cache
441
-        # Using a sed and not iniset/iniuncomment because we want to a global
442
-        # modification and make sure it works for new sections.
443
-        sed -i -e "s,#[ ]*recon_cache_path .*,recon_cache_path = ${SWIFT_DATA_DIR}/cache," ${swift_node_config}
444 441
 
445 442
         swift_node_config=${SWIFT_CONF_DIR}/container-server/${node_number}.conf
446 443
         cp ${SWIFT_DIR}/etc/container-server.conf-sample ${swift_node_config}
447
-        generate_swift_config ${swift_node_config} ${node_number} $(( CONTAINER_PORT_BASE + 10 * (node_number - 1) )) container
444
+        generate_swift_config_services ${swift_node_config} ${node_number} $(( CONTAINER_PORT_BASE + 10 * (node_number - 1) )) container
448 445
         iniuncomment ${swift_node_config} app:container-server allow_versions
449 446
         iniset ${swift_node_config} app:container-server allow_versions  "true"
450
-        sed -i -e "s,#[ ]*recon_cache_path .*,recon_cache_path = ${SWIFT_DATA_DIR}/cache," ${swift_node_config}
451 447
 
452 448
         swift_node_config=${SWIFT_CONF_DIR}/account-server/${node_number}.conf
453 449
         cp ${SWIFT_DIR}/etc/account-server.conf-sample ${swift_node_config}
454
-        generate_swift_config ${swift_node_config} ${node_number} $(( ACCOUNT_PORT_BASE + 10 * (node_number - 1) )) account
455
-        sed -i -e "s,#[ ]*recon_cache_path .*,recon_cache_path = ${SWIFT_DATA_DIR}/cache," ${swift_node_config}
450
+        generate_swift_config_services ${swift_node_config} ${node_number} $(( ACCOUNT_PORT_BASE + 10 * (node_number - 1) )) account
456 451
     done
457 452
 
458 453
     # Set new accounts in tempauth to match keystone tenant/user (to make testing easier)