Browse code

Merge "Fix issues when working through an outbound proxy"

Jenkins authored on 2012/06/15 05:08:32
Showing 2 changed files
... ...
@@ -318,6 +318,23 @@ function restart_service() {
318 318
 }
319 319
 
320 320
 
321
+# pip install the dependencies of the package before we do the setup.py
322
+# develop, so that pip and not distutils process the dependency chain
323
+# setup_develop directory
324
+function setup_develop() {
325
+    (cd $1; \
326
+        python setup.py egg_info; \
327
+        raw_links=$(awk '/^.+/ {print "-f " $1}' *.egg-info/dependency_links.txt); \
328
+        depend_links=$(echo $raw_links | xargs); \
329
+        pip_install -r *-info/requires.txt $depend_links; \
330
+        sudo \
331
+            HTTP_PROXY=$http_proxy \
332
+            HTTPS_PROXY=$https_proxy \
333
+            python setup.py develop \
334
+    )
335
+}
336
+
337
+
321 338
 # Service wrapper to start services
322 339
 # start_service service-name
323 340
 function start_service() {
... ...
@@ -64,18 +64,23 @@ fi
64 64
 # repositories and branches to configure.  ``stackrc`` sources ``localrc`` to
65 65
 # allow you to safely override those settings without being overwritten
66 66
 # when updating DevStack.
67
+if [[ ! -r $TOP_DIR/stackrc ]]; then
68
+    echo "ERROR: missing $TOP_DIR/stackrc - did you grab more than just stack.sh?"
69
+    exit 1
70
+fi
71
+source $TOP_DIR/stackrc
67 72
 
68 73
 # HTTP and HTTPS proxy servers are supported via the usual environment variables
69 74
 # ``http_proxy`` and ``https_proxy``.  They can be set in ``localrc`` if necessary
70 75
 # or on the command line::
71 76
 #
72 77
 #     http_proxy=http://proxy.example.com:3128/ ./stack.sh
73
-
74
-if [[ ! -r $TOP_DIR/stackrc ]]; then
75
-    echo "ERROR: missing $TOP_DIR/stackrc - did you grab more than just stack.sh?"
76
-    exit 1
78
+if [[ -n "$http_proxy" ]]; then
79
+    export http_proxy=$http_proxy
80
+fi
81
+if [[ -n "$https_proxy" ]]; then
82
+    export https_proxy=$https_proxy
77 83
 fi
78
-source $TOP_DIR/stackrc
79 84
 
80 85
 # Destination path for installation ``DEST``
81 86
 DEST=${DEST:-/opt/stack}
... ...
@@ -644,16 +649,6 @@ function get_packages() {
644 644
     done
645 645
 }
646 646
 
647
-# pip install the dependencies of the package before we do the setup.py
648
-# develop, so that pip and not distutils process the dependency chain
649
-function setup_develop() {
650
-    python setup.py egg_info
651
-    raw_links=`cat *.egg-info/dependency_links.txt | awk '{print "-f " $1}'`
652
-    depend_links=`echo $raw_links | xargs`
653
-    sudo pip install -r *-info/requires.txt $depend_links
654
-    sudo python setup.py develop
655
-}
656
-
657 647
 # install package requirements
658 648
 if [[ "$os_PACKAGE" = "deb" ]]; then
659 649
     apt_get update
... ...
@@ -720,39 +715,37 @@ fi
720 720
 
721 721
 # setup our checkouts so they are installed into python path
722 722
 # allowing ``import nova`` or ``import glance.client``
723
-cd $KEYSTONECLIENT_DIR; setup_develop
724
-cd $NOVACLIENT_DIR; setup_develop
725
-cd $OPENSTACKCLIENT_DIR; setup_develop
723
+setup_develop $KEYSTONECLIENT_DIR
724
+setup_develop $NOVACLIENT_DIR
725
+setup_develop $OPENSTACKCLIENT_DIR
726 726
 if is_service_enabled key g-api n-api swift; then
727
-    cd $KEYSTONE_DIR; setup_develop
727
+    setup_develop $KEYSTONE_DIR
728 728
 fi
729 729
 if is_service_enabled swift; then
730
-    cd $SWIFT_DIR; setup_develop
731
-    cd $SWIFTCLIENT_DIR; setup_develop
732
-    cd $SWIFT3_DIR; setup_develop
730
+    setup_develop $SWIFT_DIR
731
+    setup_develop $SWIFTCLIENT_DIR
732
+    setup_develop $SWIFT3_DIR
733 733
 fi
734 734
 if is_service_enabled g-api n-api; then
735
-    cd $GLANCE_DIR; setup_develop
735
+    setup_develop $GLANCE_DIR
736 736
 fi
737
-cd $NOVA_DIR; setup_develop
737
+setup_develop $NOVA_DIR
738 738
 if is_service_enabled horizon; then
739
-    cd $HORIZON_DIR; setup_develop
740
-fi
741
-if is_service_enabled quantum; then
742
-    cd $QUANTUM_CLIENT_DIR; setup_develop
739
+    setup_develop $HORIZON_DIR
743 740
 fi
744 741
 if is_service_enabled quantum; then
745
-    cd $QUANTUM_DIR; setup_develop
742
+    setup_develop $QUANTUM_CLIENT_DIR
743
+    setup_develop $QUANTUM_DIR
746 744
 fi
747 745
 if is_service_enabled m-svc; then
748
-    cd $MELANGE_DIR; setup_develop
746
+    setup_develop $MELANGE_DIR
749 747
 fi
750 748
 if is_service_enabled melange; then
751
-    cd $MELANGECLIENT_DIR; setup_develop
749
+    setup_develop $MELANGECLIENT_DIR
752 750
 fi
753 751
 
754 752
 # Do this _after_ glance is installed to override the old binary
755
-cd $GLANCECLIENT_DIR; setup_develop
753
+setup_develop $GLANCECLIENT_DIR
756 754
 
757 755
 
758 756
 # Syslog
... ...
@@ -2008,7 +2001,7 @@ if is_service_enabled g-reg; then
2008 2008
 
2009 2009
     ADMIN_USER=admin
2010 2010
     ADMIN_TENANT=admin
2011
-    TOKEN=`curl -s -d  "{\"auth\":{\"passwordCredentials\": {\"username\": \"$ADMIN_USER\", \"password\": \"$ADMIN_PASSWORD\"}, \"tenantName\": \"$ADMIN_TENANT\"}}" -H "Content-type: application/json" http://$HOST_IP:5000/v2.0/tokens | python -c "import sys; import json; tok = json.loads(sys.stdin.read()); print tok['access']['token']['id'];"`
2011
+    TOKEN=$(keystone --os_tenant_name $ADMIN_TENANT --os_username $ADMIN_USER --os_password $ADMIN_PASSWORD --os_auth_url http://$HOST_IP:5000/v2.0 token-get | grep ' id ' | get_field 2)
2012 2012
 
2013 2013
     # Option to upload legacy ami-tty, which works with xenserver
2014 2014
     if [[ -n "$UPLOAD_LEGACY_TTY" ]]; then
... ...
@@ -2018,7 +2011,7 @@ if is_service_enabled g-reg; then
2018 2018
     for image_url in ${IMAGE_URLS//,/ }; do
2019 2019
         # Downloads the image (uec ami+aki style), then extracts it.
2020 2020
         IMAGE_FNAME=`basename "$image_url"`
2021
-        if [ ! -f $FILES/$IMAGE_FNAME ]; then
2021
+        if [[ ! -f $FILES/$IMAGE_FNAME || "$(stat -c "%s" $FILES/$IMAGE_FNAME)" = "0" ]]; then
2022 2022
             wget -c $image_url -O $FILES/$IMAGE_FNAME
2023 2023
         fi
2024 2024