@@ -27,39 +27,29 @@ log_it() {
2727 echo " $( date) : $* " >> $log
2828}
2929
30- while getopts ' c:' OPTION
31- do
32- case $OPTION in
33- c) cfg=" $OPTARG "
34- ;;
35- esac
36- done
30+ while getopts ' c:' OPTION; do
31+ case $OPTION in
32+ c) cfg=" $OPTARG " ;;
33+ esac ; done
3734
38- while read line
39- do
35+ export DEFER_CONFIG=true
36+ while read line ; do
4037 # comment
41- if [[ $line == \# * ]]
42- then
43- continue
44- fi
38+ if [[ $line == \# * ]]; then
39+ continue
4540
46- if [ " $line " == " <version>" ]
47- then
41+ elif [ " $line " == " <version>" ]; then
4842 read line
4943 version=$line
5044 log_it " VR config: configuation format version $version "
5145 # skip </version>
5246 read line
53- continue
54- fi
5547
56- if [ " $line " == " <script>" ]
57- then
48+ elif [ " $line " == " <script>" ]; then
5849 read line
5950 log_it " VR config: executing: $line "
6051 eval $line >> $log 2>&1
61- if [ $? -ne 0 ]
62- then
52+ if [ $? -ne 0 ]; then
6353 log_it " VR config: executing failed: $line "
6454 # expose error info to mgmt server
6555 echo " VR config: execution failed: \" $line \" , check $log in VR for details " 1>&2
6858 # skip </script>
6959 read line
7060 log_it " VR config: execution success "
71- continue
72- fi
7361
74- if [ " $line " == " <file>" ]
75- then
62+ elif [ " $line " == " <file>" ]; then
7663 read line
7764 file=$line
7865 log_it " VR config: creating file: $file "
7966 rm -f $file
80- while read -r line
81- do
82- if [ " $line " == " </file>" ]
83- then
67+ while read -r line; do
68+ if [ " $line " == " </file>" ]; then
8469 break
8570 fi
8671 echo $line >> $file
8772 done
8873 log_it " VR config: create file success"
89- continue
74+
9075 fi
76+
9177done < $cfg
9278
93- # remove the configuration file, log file should have all the records as well
94- rm -f $cfg
79+ # archive the configuration file
80+ mv $cfg /var/cache/cloud/processed/
81+
82+ unset DEFER_CONFIG
83+ # trigger finish_config()
84+ /opt/cloud/bin/configure.py
9585
9686# Flush kernel conntrack table
9787log_it " VR config: Flushing conntrack table"
0 commit comments