Browse code

final bash8 files for the rest of devstack

With this devstack/master is bash8 clean, and ready for enforcement

Change-Id: I03fc89b401e6b7a23224d71472122c1bfa3ad0bd

Sean Dague authored on 2013/10/23 00:37:35
Showing 7 changed files
... ...
@@ -22,8 +22,8 @@ run_bm STACKMASTER $HEAD_HOST "ENABLED_SERVICES=g-api,g-reg,key,n-api,n-sch,n-vn
22 22
 if [ ! "$TERMINATE" = "1" ]; then
23 23
     echo "Waiting for head node ($HEAD_HOST) to start..."
24 24
     if ! timeout 60 sh -c "while ! wget -q -O- http://$HEAD_HOST | grep -q username; do sleep 1; done"; then
25
-      echo "Head node did not start"
26
-      exit 1
25
+        echo "Head node did not start"
26
+        exit 1
27 27
     fi
28 28
 fi
29 29
 
... ...
@@ -229,8 +229,8 @@ EOF
229 229
 
230 230
 # (re)start a metadata service
231 231
 (
232
-  pid=`lsof -iTCP@192.168.$GUEST_NETWORK.1:4567 -n | awk '{print $2}' | tail -1`
233
-  [ -z "$pid" ] || kill -9 $pid
232
+    pid=`lsof -iTCP@192.168.$GUEST_NETWORK.1:4567 -n | awk '{print $2}' | tail -1`
233
+    [ -z "$pid" ] || kill -9 $pid
234 234
 )
235 235
 cd $vm_dir/uec
236 236
 python meta.py 192.168.$GUEST_NETWORK.1:4567 &
... ...
@@ -268,7 +268,7 @@ if [ "$WAIT_TILL_LAUNCH" = "1" ]; then
268 268
     sleep 2
269 269
 
270 270
     while [ ! -e "$vm_dir/console.log" ]; do
271
-      sleep 1
271
+        sleep 1
272 272
     done
273 273
 
274 274
     tail -F $vm_dir/console.log &
... ...
@@ -105,15 +105,15 @@ if [ -z "$OS_PASSWORD" ]; then
105 105
 fi
106 106
 
107 107
 if [ -z "$OS_TENANT_NAME" -a -z "$OS_TENANT_ID" ]; then
108
-   export OS_TENANT_NAME=admin
108
+    export OS_TENANT_NAME=admin
109 109
 fi
110 110
 
111 111
 if [ -z "$OS_USERNAME" ]; then
112
-   export OS_USERNAME=admin
112
+    export OS_USERNAME=admin
113 113
 fi
114 114
 
115 115
 if [ -z "$OS_AUTH_URL" ]; then
116
-   export OS_AUTH_URL=http://localhost:5000/v2.0/
116
+    export OS_AUTH_URL=http://localhost:5000/v2.0/
117 117
 fi
118 118
 
119 119
 USER_PASS=${USER_PASS:-$OS_PASSWORD}
... ...
@@ -249,7 +249,7 @@ if [ $MODE != "create" ]; then
249 249
         for user_id_at_name in `keystone user-list --tenant-id $tenant_id | awk 'BEGIN {IGNORECASE = 1} /true[[:space:]]*\|[^|]*\|$/ {print  $2 "@" $4}'`; do
250 250
             read user_id user_name <<< `echo "$user_id_at_name" | sed 's/@/ /'`
251 251
             if [ $MODE = one -a "$user_name" != "$USER_NAME" ]; then
252
-               continue;
252
+                continue;
253 253
             fi
254 254
             add_entry "$user_id" "$user_name" "$tenant_id" "$tenant_name" "$USER_PASS"
255 255
         done
... ...
@@ -6,8 +6,8 @@ set -o errexit
6 6
 
7 7
 # Make sure only root can run our script
8 8
 if [[ $EUID -ne 0 ]]; then
9
-   echo "This script must be run as root"
10
-   exit 1
9
+    echo "This script must be run as root"
10
+    exit 1
11 11
 fi
12 12
 
13 13
 # This directory
... ...
@@ -31,15 +31,15 @@ apt-get install -y --force-yes $DEPS
31 31
 
32 32
 # Install jenkins
33 33
 if [ ! -e /var/lib/jenkins ]; then
34
-   echo "Jenkins installation failed"
35
-   exit 1
34
+    echo "Jenkins installation failed"
35
+    exit 1
36 36
 fi
37 37
 
38 38
 # Make sure user has configured a jenkins ssh pubkey
39 39
 if [ ! -e /var/lib/jenkins/.ssh/id_rsa.pub ]; then
40
-   echo "Public key for jenkins is missing.  This is used to ssh into your instances."
41
-   echo "Please run "su -c ssh-keygen jenkins" before proceeding"
42
-   exit 1
40
+    echo "Public key for jenkins is missing.  This is used to ssh into your instances."
41
+    echo "Please run "su -c ssh-keygen jenkins" before proceeding"
42
+    exit 1
43 43
 fi
44 44
 
45 45
 # Setup sudo
... ...
@@ -96,7 +96,7 @@ PLUGINS=http://hudson-ci.org/downloads/plugins/build-timeout/1.6/build-timeout.h
96 96
 
97 97
 # Configure plugins
98 98
 for plugin in ${PLUGINS//,/ }; do
99
-    name=`basename $plugin`   
99
+    name=`basename $plugin`
100 100
     dest=/var/lib/jenkins/plugins/$name
101 101
     if [ ! -e $dest ]; then
102 102
         curl -L $plugin -o $dest
... ...
@@ -44,9 +44,9 @@ source $THIS_DIR/xenrc
44 44
 
45 45
 xe_min()
46 46
 {
47
-  local cmd="$1"
48
-  shift
49
-  xe "$cmd" --minimal "$@"
47
+    local cmd="$1"
48
+    shift
49
+    xe "$cmd" --minimal "$@"
50 50
 }
51 51
 
52 52
 #
... ...
@@ -132,8 +132,8 @@ HOST_IP=$(xenapi_ip_on "$MGT_BRIDGE_OR_NET_NAME")
132 132
 # Set up ip forwarding, but skip on xcp-xapi
133 133
 if [ -a /etc/sysconfig/network ]; then
134 134
     if ! grep -q "FORWARD_IPV4=YES" /etc/sysconfig/network; then
135
-      # FIXME: This doesn't work on reboot!
136
-      echo "FORWARD_IPV4=YES" >> /etc/sysconfig/network
135
+        # FIXME: This doesn't work on reboot!
136
+        echo "FORWARD_IPV4=YES" >> /etc/sysconfig/network
137 137
     fi
138 138
 fi
139 139
 # Also, enable ip forwarding in rc.local, since the above trick isn't working
... ...
@@ -42,69 +42,69 @@ EOF
42 42
 
43 43
 get_params()
44 44
 {
45
-  while getopts "hbn:r:l:t:" OPTION;
46
-  do
47
-    case $OPTION in
48
-      h) usage
49
-         exit 1
50
-         ;;
51
-      n)
52
-         BRIDGE=$OPTARG
53
-         ;;
54
-      l)
55
-         NAME_LABEL=$OPTARG
56
-         ;;
57
-      t)
58
-         TEMPLATE_NAME=$OPTARG
59
-         ;;
60
-      ?)
61
-         usage
62
-         exit
63
-         ;;
64
-    esac
65
-  done
66
-  if [[ -z $BRIDGE ]]
67
-  then
68
-     BRIDGE=xenbr0
69
-  fi
70
-
71
-  if [[ -z $TEMPLATE_NAME ]]; then
72
-    echo "Please specify a template name" >&2
73
-    exit 1
74
-  fi
75
-
76
-  if [[ -z $NAME_LABEL ]]; then
77
-    echo "Please specify a name-label for the new VM" >&2
78
-    exit 1
79
-  fi
45
+    while getopts "hbn:r:l:t:" OPTION;
46
+    do
47
+        case $OPTION in
48
+            h) usage
49
+                exit 1
50
+                ;;
51
+            n)
52
+                BRIDGE=$OPTARG
53
+                ;;
54
+            l)
55
+                NAME_LABEL=$OPTARG
56
+                ;;
57
+            t)
58
+                TEMPLATE_NAME=$OPTARG
59
+                ;;
60
+            ?)
61
+                usage
62
+                exit
63
+                ;;
64
+        esac
65
+    done
66
+    if [[ -z $BRIDGE ]]
67
+    then
68
+        BRIDGE=xenbr0
69
+    fi
70
+
71
+    if [[ -z $TEMPLATE_NAME ]]; then
72
+        echo "Please specify a template name" >&2
73
+        exit 1
74
+    fi
75
+
76
+    if [[ -z $NAME_LABEL ]]; then
77
+        echo "Please specify a name-label for the new VM" >&2
78
+        exit 1
79
+    fi
80 80
 }
81 81
 
82 82
 
83 83
 xe_min()
84 84
 {
85
-  local cmd="$1"
86
-  shift
87
-  xe "$cmd" --minimal "$@"
85
+    local cmd="$1"
86
+    shift
87
+    xe "$cmd" --minimal "$@"
88 88
 }
89 89
 
90 90
 
91 91
 find_network()
92 92
 {
93
-  result=$(xe_min network-list bridge="$1")
94
-  if [ "$result" = "" ]
95
-  then
96
-    result=$(xe_min network-list name-label="$1")
97
-  fi
98
-  echo "$result"
93
+    result=$(xe_min network-list bridge="$1")
94
+    if [ "$result" = "" ]
95
+    then
96
+        result=$(xe_min network-list name-label="$1")
97
+    fi
98
+    echo "$result"
99 99
 }
100 100
 
101 101
 
102 102
 create_vif()
103 103
 {
104
-  local v="$1"
105
-  echo "Installing VM interface on [$BRIDGE]"
106
-  local out_network_uuid=$(find_network "$BRIDGE")
107
-  xe vif-create vm-uuid="$v" network-uuid="$out_network_uuid" device="0"
104
+    local v="$1"
105
+    echo "Installing VM interface on [$BRIDGE]"
106
+    local out_network_uuid=$(find_network "$BRIDGE")
107
+    xe vif-create vm-uuid="$v" network-uuid="$out_network_uuid" device="0"
108 108
 }
109 109
 
110 110
 
... ...
@@ -112,20 +112,20 @@ create_vif()
112 112
 # Make the VM auto-start on server boot.
113 113
 set_auto_start()
114 114
 {
115
-  local v="$1"
116
-  xe vm-param-set uuid="$v" other-config:auto_poweron=true
115
+    local v="$1"
116
+    xe vm-param-set uuid="$v" other-config:auto_poweron=true
117 117
 }
118 118
 
119 119
 
120 120
 destroy_vifs()
121 121
 {
122
-  local v="$1"
123
-  IFS=,
124
-  for vif in $(xe_min vif-list vm-uuid="$v")
125
-  do
126
-    xe vif-destroy uuid="$vif"
127
-  done
128
-  unset IFS
122
+    local v="$1"
123
+    IFS=,
124
+    for vif in $(xe_min vif-list vm-uuid="$v")
125
+    do
126
+        xe vif-destroy uuid="$vif"
127
+    done
128
+    unset IFS
129 129
 }
130 130
 
131 131
 
... ...
@@ -22,63 +22,63 @@ set -ex
22 22
 # By default, don't remove the templates
23 23
 REMOVE_TEMPLATES=${REMOVE_TEMPLATES:-"false"}
24 24
 if [ "$1" = "--remove-templates" ]; then
25
-  REMOVE_TEMPLATES=true
25
+    REMOVE_TEMPLATES=true
26 26
 fi
27 27
 
28 28
 xe_min()
29 29
 {
30
-  local cmd="$1"
31
-  shift
32
-  xe "$cmd" --minimal "$@"
30
+    local cmd="$1"
31
+    shift
32
+    xe "$cmd" --minimal "$@"
33 33
 }
34 34
 
35 35
 destroy_vdi()
36 36
 {
37
-  local vbd_uuid="$1"
38
-  local type=$(xe_min vbd-list uuid=$vbd_uuid params=type)
39
-  local dev=$(xe_min vbd-list uuid=$vbd_uuid params=userdevice)
40
-  local vdi_uuid=$(xe_min vbd-list uuid=$vbd_uuid params=vdi-uuid)
37
+    local vbd_uuid="$1"
38
+    local type=$(xe_min vbd-list uuid=$vbd_uuid params=type)
39
+    local dev=$(xe_min vbd-list uuid=$vbd_uuid params=userdevice)
40
+    local vdi_uuid=$(xe_min vbd-list uuid=$vbd_uuid params=vdi-uuid)
41 41
 
42
-  if [ "$type" == 'Disk' ] && [ "$dev" != 'xvda' ] && [ "$dev" != '0' ]; then
43
-    xe vdi-destroy uuid=$vdi_uuid
44
-  fi
42
+    if [ "$type" == 'Disk' ] && [ "$dev" != 'xvda' ] && [ "$dev" != '0' ]; then
43
+        xe vdi-destroy uuid=$vdi_uuid
44
+    fi
45 45
 }
46 46
 
47 47
 uninstall()
48 48
 {
49
-  local vm_uuid="$1"
50
-  local power_state=$(xe_min vm-list uuid=$vm_uuid params=power-state)
49
+    local vm_uuid="$1"
50
+    local power_state=$(xe_min vm-list uuid=$vm_uuid params=power-state)
51 51
 
52
-  if [ "$power_state" != "halted" ]; then
53
-    xe vm-shutdown vm=$vm_uuid force=true
54
-  fi
52
+    if [ "$power_state" != "halted" ]; then
53
+        xe vm-shutdown vm=$vm_uuid force=true
54
+    fi
55 55
 
56
-  for v in $(xe_min vbd-list vm-uuid=$vm_uuid | sed -e 's/,/ /g'); do
57
-    destroy_vdi "$v"
58
-  done
56
+    for v in $(xe_min vbd-list vm-uuid=$vm_uuid | sed -e 's/,/ /g'); do
57
+        destroy_vdi "$v"
58
+    done
59 59
 
60
-  xe vm-uninstall vm=$vm_uuid force=true >/dev/null
60
+    xe vm-uninstall vm=$vm_uuid force=true >/dev/null
61 61
 }
62 62
 
63 63
 uninstall_template()
64 64
 {
65
-  local vm_uuid="$1"
65
+    local vm_uuid="$1"
66 66
 
67
-  for v in $(xe_min vbd-list vm-uuid=$vm_uuid | sed -e 's/,/ /g'); do
68
-    destroy_vdi "$v"
69
-  done
67
+    for v in $(xe_min vbd-list vm-uuid=$vm_uuid | sed -e 's/,/ /g'); do
68
+        destroy_vdi "$v"
69
+    done
70 70
 
71
-  xe template-uninstall template-uuid=$vm_uuid force=true >/dev/null
71
+    xe template-uninstall template-uuid=$vm_uuid force=true >/dev/null
72 72
 }
73 73
 
74 74
 # remove the VMs and their disks
75 75
 for u in $(xe_min vm-list other-config:os-vpx=true | sed -e 's/,/ /g'); do
76
-  uninstall "$u"
76
+    uninstall "$u"
77 77
 done
78 78
 
79 79
 # remove the templates
80 80
 if [ "$REMOVE_TEMPLATES" == "true" ]; then
81
-  for u in $(xe_min template-list other-config:os-vpx=true | sed -e 's/,/ /g'); do
82
-    uninstall_template "$u"
83
-  done
81
+    for u in $(xe_min template-list other-config:os-vpx=true | sed -e 's/,/ /g'); do
82
+        uninstall_template "$u"
83
+    done
84 84
 fi