Browse code

Un-nest generate_swift_config

I think this got accidentally nested during some code refactorizing?

Change-Id: Ie486cf3395b6acf3a10eb32e116d39ca56134b9f

Ian Wienand authored on 2014/02/21 13:16:31
Showing 1 changed files
... ...
@@ -231,6 +231,46 @@ function _config_swift_apache_wsgi() {
231 231
     done
232 232
 }
233 233
 
234
+# This function generates an object/container/account configuration
235
+# emulating 4 nodes on different ports
236
+function generate_swift_config() {
237
+    local swift_node_config=$1
238
+    local node_id=$2
239
+    local bind_port=$3
240
+    local server_type=$4
241
+
242
+    log_facility=$[ node_id - 1 ]
243
+    node_path=${SWIFT_DATA_DIR}/${node_number}
244
+
245
+    iniuncomment ${swift_node_config} DEFAULT user
246
+    iniset ${swift_node_config} DEFAULT user ${STACK_USER}
247
+
248
+    iniuncomment ${swift_node_config} DEFAULT bind_port
249
+    iniset ${swift_node_config} DEFAULT bind_port ${bind_port}
250
+
251
+    iniuncomment ${swift_node_config} DEFAULT swift_dir
252
+    iniset ${swift_node_config} DEFAULT swift_dir ${SWIFT_CONF_DIR}
253
+
254
+    iniuncomment ${swift_node_config} DEFAULT devices
255
+    iniset ${swift_node_config} DEFAULT devices ${node_path}
256
+
257
+    iniuncomment ${swift_node_config} DEFAULT log_facility
258
+    iniset ${swift_node_config} DEFAULT log_facility LOG_LOCAL${log_facility}
259
+
260
+    iniuncomment ${swift_node_config} DEFAULT workers
261
+    iniset ${swift_node_config} DEFAULT workers 1
262
+
263
+    iniuncomment ${swift_node_config} DEFAULT disable_fallocate
264
+    iniset ${swift_node_config} DEFAULT disable_fallocate true
265
+
266
+    iniuncomment ${swift_node_config} DEFAULT mount_check
267
+    iniset ${swift_node_config} DEFAULT mount_check false
268
+
269
+    iniuncomment ${swift_node_config} ${server_type}-replicator vm_test_mode
270
+    iniset ${swift_node_config} ${server_type}-replicator vm_test_mode yes
271
+}
272
+
273
+
234 274
 # configure_swift() - Set config files, create data dirs and loop image
235 275
 function configure_swift() {
236 276
     local swift_pipeline="${SWIFT_EXTRAS_MIDDLEWARE_NO_AUTH}"
... ...
@@ -364,45 +404,6 @@ EOF
364 364
     cp ${SWIFT_DIR}/etc/swift.conf-sample ${SWIFT_CONF_DIR}/swift.conf
365 365
     iniset ${SWIFT_CONF_DIR}/swift.conf swift-hash swift_hash_path_suffix ${SWIFT_HASH}
366 366
 
367
-    # This function generates an object/container/account configuration
368
-    # emulating 4 nodes on different ports
369
-    function generate_swift_config() {
370
-        local swift_node_config=$1
371
-        local node_id=$2
372
-        local bind_port=$3
373
-        local server_type=$4
374
-
375
-        log_facility=$[ node_id - 1 ]
376
-        node_path=${SWIFT_DATA_DIR}/${node_number}
377
-
378
-        iniuncomment ${swift_node_config} DEFAULT user
379
-        iniset ${swift_node_config} DEFAULT user ${STACK_USER}
380
-
381
-        iniuncomment ${swift_node_config} DEFAULT bind_port
382
-        iniset ${swift_node_config} DEFAULT bind_port ${bind_port}
383
-
384
-        iniuncomment ${swift_node_config} DEFAULT swift_dir
385
-        iniset ${swift_node_config} DEFAULT swift_dir ${SWIFT_CONF_DIR}
386
-
387
-        iniuncomment ${swift_node_config} DEFAULT devices
388
-        iniset ${swift_node_config} DEFAULT devices ${node_path}
389
-
390
-        iniuncomment ${swift_node_config} DEFAULT log_facility
391
-        iniset ${swift_node_config} DEFAULT log_facility LOG_LOCAL${log_facility}
392
-
393
-        iniuncomment ${swift_node_config} DEFAULT workers
394
-        iniset ${swift_node_config} DEFAULT workers 1
395
-
396
-        iniuncomment ${swift_node_config} DEFAULT disable_fallocate
397
-        iniset ${swift_node_config} DEFAULT disable_fallocate true
398
-
399
-        iniuncomment ${swift_node_config} DEFAULT mount_check
400
-        iniset ${swift_node_config} DEFAULT mount_check false
401
-
402
-        iniuncomment ${swift_node_config} ${server_type}-replicator vm_test_mode
403
-        iniset ${swift_node_config} ${server_type}-replicator vm_test_mode yes
404
-    }
405
-
406 367
     for node_number in ${SWIFT_REPLICAS_SEQ}; do
407 368
         swift_node_config=${SWIFT_CONF_DIR}/object-server/${node_number}.conf
408 369
         cp ${SWIFT_DIR}/etc/object-server.conf-sample ${swift_node_config}