Browse code

Using no proxy option to skip wget and curl proxy settings in config

When end users specify proxy settings in config file for wget /etc/wgetrc:
http_proxy = http://...
or for curl ${HOME}/.curlrc:
proxy = http://...

Using `http_proxy="" wget' can not skip the proxy setting in the
config files, also it can skip proxy settings in env viriables.

In order to skip proxy setting in both env and config file, we pass
--no-proxy option for wget, and --noproxy '*' for curl.

Fixes bug #1224836

Change-Id: I2b25aeca9edf2ce4525fb1db325e5e24c18b4d55

JUN JIE NAN authored on 2013/09/13 16:47:09
Showing 5 changed files
... ...
@@ -1484,7 +1484,7 @@ function use_exclusive_service {
1484 1484
 function wait_for_service() {
1485 1485
     local timeout=$1
1486 1486
     local url=$2
1487
-    timeout $timeout sh -c "while ! http_proxy= https_proxy= curl -s $url >/dev/null; do sleep 1; done"
1487
+    timeout $timeout sh -c "while ! curl --noproxy '*' -s $url >/dev/null; do sleep 1; done"
1488 1488
 }
1489 1489
 
1490 1490
 
... ...
@@ -193,7 +193,7 @@ function start_glance() {
193 193
     screen_it g-reg "cd $GLANCE_DIR; $GLANCE_BIN_DIR/glance-registry --config-file=$GLANCE_CONF_DIR/glance-registry.conf"
194 194
     screen_it g-api "cd $GLANCE_DIR; $GLANCE_BIN_DIR/glance-api --config-file=$GLANCE_CONF_DIR/glance-api.conf"
195 195
     echo "Waiting for g-api ($GLANCE_HOSTPORT) to start..."
196
-    if ! timeout $SERVICE_TIMEOUT sh -c "while ! http_proxy= wget -q -O- http://$GLANCE_HOSTPORT; do sleep 1; done"; then
196
+    if ! timeout $SERVICE_TIMEOUT sh -c "while ! wget --no-proxy -q -O- http://$GLANCE_HOSTPORT; do sleep 1; done"; then
197 197
       die $LINENO "g-api did not start"
198 198
     fi
199 199
 }
... ...
@@ -194,7 +194,7 @@ function start_ironic() {
194 194
 function start_ironic_api() {
195 195
     screen_it ir-api "cd $IRONIC_DIR; $IRONIC_BIN_DIR/ironic-api --config-file=$IRONIC_CONF_FILE"
196 196
     echo "Waiting for ir-api ($IRONIC_HOSTPORT) to start..."
197
-    if ! timeout $SERVICE_TIMEOUT sh -c "while ! http_proxy= wget -q -O- http://$IRONIC_HOSTPORT; do sleep 1; done"; then
197
+    if ! timeout $SERVICE_TIMEOUT sh -c "while ! wget --no-proxy -q -O- http://$IRONIC_HOSTPORT; do sleep 1; done"; then
198 198
       die $LINENO "ir-api did not start"
199 199
     fi
200 200
 }
... ...
@@ -372,7 +372,7 @@ function start_keystone() {
372 372
     fi
373 373
 
374 374
     echo "Waiting for keystone to start..."
375
-    if ! timeout $SERVICE_TIMEOUT sh -c "while ! http_proxy= curl -s http://$SERVICE_HOST:$service_port/v$IDENTITY_API_VERSION/ >/dev/null; do sleep 1; done"; then
375
+    if ! timeout $SERVICE_TIMEOUT sh -c "while ! curl --noproxy '*' -s http://$SERVICE_HOST:$service_port/v$IDENTITY_API_VERSION/ >/dev/null; do sleep 1; done"; then
376 376
       die $LINENO "keystone did not start"
377 377
     fi
378 378
 
... ...
@@ -419,7 +419,7 @@ function start_neutron_service_and_check() {
419 419
     # Start the Neutron service
420 420
     screen_it q-svc "cd $NEUTRON_DIR && python $NEUTRON_BIN_DIR/neutron-server $CFG_FILE_OPTIONS"
421 421
     echo "Waiting for Neutron to start..."
422
-    if ! timeout $SERVICE_TIMEOUT sh -c "while ! http_proxy= wget -q -O- http://$Q_HOST:$Q_PORT; do sleep 1; done"; then
422
+    if ! timeout $SERVICE_TIMEOUT sh -c "while ! wget --no-proxy -q -O- http://$Q_HOST:$Q_PORT; do sleep 1; done"; then
423 423
       die $LINENO "Neutron did not start"
424 424
     fi
425 425
 }