Browse code

Add support for proxy servers

Set http_proxy and https_proxy as usual outside of devstack, or
in localrc. All clients running under sudo need env vars passed
explicitly (apt-get, pip, curl). Some tests using wget need proxy
turned off since they point to our services (i.e. glance, keystone).

Change-Id: Ie87aa2d3502ed5a1312f148db12bb61e5eaf1054

Dean Troyer authored on 2012/01/14 03:13:59
Showing 1 changed files
... ...
@@ -66,6 +66,12 @@ fi
66 66
 # We try to have sensible defaults, so you should be able to run ``./stack.sh``
67 67
 # in most cases.
68 68
 #
69
+# We support HTTP and HTTPS proxy servers via the usual environment variables
70
+# http_proxy and https_proxy.  They can be set in localrc if necessary or
71
+# on the command line::
72
+#
73
+#     http_proxy=http://proxy.example.com:3128/ ./stack.sh
74
+#
69 75
 # We source our settings from ``stackrc``.  This file is distributed with devstack
70 76
 # and contains locations for what repositories to use.  If you want to use other
71 77
 # repositories and branches, you can add your own settings with another file called
... ...
@@ -85,8 +91,9 @@ function apt_get() {
85 85
     [[ "$OFFLINE" = "True" ]] && return
86 86
     local sudo="sudo"
87 87
     [ "$(id -u)" = "0" ] && sudo="env"
88
-    $sudo DEBIAN_FRONTEND=noninteractive apt-get \
89
-        --option "Dpkg::Options::=--force-confold" --assume-yes "$@"
88
+    $sudo DEBIAN_FRONTEND=noninteractive \
89
+        http_proxy=$http_proxy https_proxy=$https_proxy \
90
+        apt-get --option "Dpkg::Options::=--force-confold" --assume-yes "$@"
90 91
 }
91 92
 
92 93
 # Check to see if we are already running a stack.sh
... ...
@@ -513,7 +520,10 @@ function get_packages() {
513 513
 
514 514
 function pip_install {
515 515
     [[ "$OFFLINE" = "True" ]] && return
516
-    sudo PIP_DOWNLOAD_CACHE=/var/cache/pip pip install --use-mirrors $@
516
+    sudo PIP_DOWNLOAD_CACHE=/var/cache/pip \
517
+        HTTP_PROXY=$http_proxy \
518
+        HTTPS_PROXY=$https_proxy \
519
+        pip install --use-mirrors $@
517 520
 }
518 521
 
519 522
 # install apt requirements
... ...
@@ -1007,7 +1017,7 @@ if [[ "$ENABLED_SERVICES" =~ "swift" ]]; then
1007 1007
        # We need a special version of bin/swift which understand the
1008 1008
        # OpenStack api 2.0, we download it until this is getting
1009 1009
        # integrated in swift.
1010
-       sudo curl -s -o/usr/local/bin/swift \
1010
+       sudo https_proxy=$https_proxy curl -s -o/usr/local/bin/swift \
1011 1011
            'https://review.openstack.org/gitweb?p=openstack/swift.git;a=blob_plain;f=bin/swift;hb=48bfda6e2fdf3886c98bd15649887d54b9a2574e'
1012 1012
    else
1013 1013
        swift_auth_server=tempauth
... ...
@@ -1309,7 +1319,7 @@ fi
1309 1309
 if [[ "$ENABLED_SERVICES" =~ "g-api" ]]; then
1310 1310
     screen_it g-api "cd $GLANCE_DIR; bin/glance-api --config-file=etc/glance-api.conf"
1311 1311
     echo "Waiting for g-api ($GLANCE_HOSTPORT) to start..."
1312
-    if ! timeout $SERVICE_TIMEOUT sh -c "while ! wget -q -O- http://$GLANCE_HOSTPORT; do sleep 1; done"; then
1312
+    if ! timeout $SERVICE_TIMEOUT sh -c "while ! http_proxy= wget -q -O- http://$GLANCE_HOSTPORT; do sleep 1; done"; then
1313 1313
       echo "g-api did not start"
1314 1314
       exit 1
1315 1315
     fi
... ...
@@ -1319,7 +1329,7 @@ fi
1319 1319
 if [[ "$ENABLED_SERVICES" =~ "key" ]]; then
1320 1320
     screen_it key "cd $KEYSTONE_DIR && $KEYSTONE_DIR/bin/keystone --config-file $KEYSTONE_CONF $KEYSTONE_LOG_CONFIG -d"
1321 1321
     echo "Waiting for keystone to start..."
1322
-    if ! timeout $SERVICE_TIMEOUT sh -c "while ! wget -q -O- $KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_SERVICE_PORT; do sleep 1; done"; then
1322
+    if ! timeout $SERVICE_TIMEOUT sh -c "while ! http_proxy= wget -q -O- $KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_SERVICE_PORT; do sleep 1; done"; then
1323 1323
       echo "keystone did not start"
1324 1324
       exit 1
1325 1325
     fi
... ...
@@ -1329,7 +1339,7 @@ fi
1329 1329
 if [[ "$ENABLED_SERVICES" =~ "n-api" ]]; then
1330 1330
     screen_it n-api "cd $NOVA_DIR && $NOVA_DIR/bin/nova-api"
1331 1331
     echo "Waiting for nova-api to start..."
1332
-    if ! timeout $SERVICE_TIMEOUT sh -c "while ! wget -q -O- http://127.0.0.1:8774; do sleep 1; done"; then
1332
+    if ! timeout $SERVICE_TIMEOUT sh -c "while ! http_proxy= wget -q -O- http://127.0.0.1:8774; do sleep 1; done"; then
1333 1333
       echo "nova-api did not start"
1334 1334
       exit 1
1335 1335
     fi