* reqork setup-develop() to handle proxy operations and empty dependency lists
* use keystone to get admin token (eliminate a direct curl invocation)
* check for cached image files of 0 bytes and re-download if needed
Change-Id: Ief356667ed3ef8d05c6604f12513ae81f68cec04
... | ... |
@@ -309,6 +309,23 @@ function restart_service() { |
309 | 309 |
} |
310 | 310 |
|
311 | 311 |
|
312 |
+# pip install the dependencies of the package before we do the setup.py |
|
313 |
+# develop, so that pip and not distutils process the dependency chain |
|
314 |
+# setup_develop directory |
|
315 |
+function setup_develop() { |
|
316 |
+ (cd $1; \ |
|
317 |
+ python setup.py egg_info; \ |
|
318 |
+ raw_links=$(awk '/^.+/ {print "-f " $1}' *.egg-info/dependency_links.txt); \ |
|
319 |
+ depend_links=$(echo $raw_links | xargs); \ |
|
320 |
+ pip_install -r *-info/requires.txt $depend_links; \ |
|
321 |
+ sudo \ |
|
322 |
+ HTTP_PROXY=$http_proxy \ |
|
323 |
+ HTTPS_PROXY=$https_proxy \ |
|
324 |
+ python setup.py develop \ |
|
325 |
+ ) |
|
326 |
+} |
|
327 |
+ |
|
328 |
+ |
|
312 | 329 |
# Service wrapper to start services |
313 | 330 |
# start_service service-name |
314 | 331 |
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} |
... | ... |
@@ -648,16 +653,6 @@ function get_packages() { |
648 | 648 |
done |
649 | 649 |
} |
650 | 650 |
|
651 |
-# pip install the dependencies of the package before we do the setup.py |
|
652 |
-# develop, so that pip and not distutils process the dependency chain |
|
653 |
-function setup_develop() { |
|
654 |
- python setup.py egg_info |
|
655 |
- raw_links=`cat *.egg-info/dependency_links.txt | awk '{print "-f " $1}'` |
|
656 |
- depend_links=`echo $raw_links | xargs` |
|
657 |
- sudo pip install -r *-info/requires.txt $depend_links |
|
658 |
- sudo python setup.py develop |
|
659 |
-} |
|
660 |
- |
|
661 | 651 |
# install package requirements |
662 | 652 |
if [[ "$os_PACKAGE" = "deb" ]]; then |
663 | 653 |
apt_get update |
... | ... |
@@ -724,39 +719,37 @@ fi |
724 | 724 |
|
725 | 725 |
# setup our checkouts so they are installed into python path |
726 | 726 |
# allowing ``import nova`` or ``import glance.client`` |
727 |
-cd $KEYSTONECLIENT_DIR; setup_develop |
|
728 |
-cd $NOVACLIENT_DIR; setup_develop |
|
729 |
-cd $OPENSTACKCLIENT_DIR; setup_develop |
|
727 |
+setup_develop $KEYSTONECLIENT_DIR |
|
728 |
+setup_develop $NOVACLIENT_DIR |
|
729 |
+setup_develop $OPENSTACKCLIENT_DIR |
|
730 | 730 |
if is_service_enabled key g-api n-api swift; then |
731 |
- cd $KEYSTONE_DIR; setup_develop |
|
731 |
+ setup_develop $KEYSTONE_DIR |
|
732 | 732 |
fi |
733 | 733 |
if is_service_enabled swift; then |
734 |
- cd $SWIFT_DIR; setup_develop |
|
735 |
- cd $SWIFTCLIENT_DIR; setup_develop |
|
736 |
- cd $SWIFT3_DIR; setup_develop |
|
734 |
+ setup_develop $SWIFT_DIR |
|
735 |
+ setup_develop $SWIFTCLIENT_DIR |
|
736 |
+ setup_develop $SWIFT3_DIR |
|
737 | 737 |
fi |
738 | 738 |
if is_service_enabled g-api n-api; then |
739 |
- cd $GLANCE_DIR; setup_develop |
|
739 |
+ setup_develop $GLANCE_DIR |
|
740 | 740 |
fi |
741 |
-cd $NOVA_DIR; setup_develop |
|
741 |
+setup_develop $NOVA_DIR |
|
742 | 742 |
if is_service_enabled horizon; then |
743 |
- cd $HORIZON_DIR; setup_develop |
|
744 |
-fi |
|
745 |
-if is_service_enabled quantum; then |
|
746 |
- cd $QUANTUM_CLIENT_DIR; setup_develop |
|
743 |
+ setup_develop $HORIZON_DIR |
|
747 | 744 |
fi |
748 | 745 |
if is_service_enabled quantum; then |
749 |
- cd $QUANTUM_DIR; setup_develop |
|
746 |
+ setup_develop $QUANTUM_CLIENT_DIR |
|
747 |
+ setup_develop $QUANTUM_DIR |
|
750 | 748 |
fi |
751 | 749 |
if is_service_enabled m-svc; then |
752 |
- cd $MELANGE_DIR; setup_develop |
|
750 |
+ setup_develop $MELANGE_DIR |
|
753 | 751 |
fi |
754 | 752 |
if is_service_enabled melange; then |
755 |
- cd $MELANGECLIENT_DIR; setup_develop |
|
753 |
+ setup_develop $MELANGECLIENT_DIR |
|
756 | 754 |
fi |
757 | 755 |
|
758 | 756 |
# Do this _after_ glance is installed to override the old binary |
759 |
-cd $GLANCECLIENT_DIR; setup_develop |
|
757 |
+setup_develop $GLANCECLIENT_DIR |
|
760 | 758 |
|
761 | 759 |
|
762 | 760 |
# Syslog |
... | ... |
@@ -1942,7 +1935,7 @@ if is_service_enabled g-reg; then |
1942 | 1942 |
|
1943 | 1943 |
ADMIN_USER=admin |
1944 | 1944 |
ADMIN_TENANT=admin |
1945 |
- 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'];"` |
|
1945 |
+ 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) |
|
1946 | 1946 |
|
1947 | 1947 |
# Option to upload legacy ami-tty, which works with xenserver |
1948 | 1948 |
if [[ -n "$UPLOAD_LEGACY_TTY" ]]; then |
... | ... |
@@ -1952,7 +1945,7 @@ if is_service_enabled g-reg; then |
1952 | 1952 |
for image_url in ${IMAGE_URLS//,/ }; do |
1953 | 1953 |
# Downloads the image (uec ami+aki style), then extracts it. |
1954 | 1954 |
IMAGE_FNAME=`basename "$image_url"` |
1955 |
- if [ ! -f $FILES/$IMAGE_FNAME ]; then |
|
1955 |
+ if [[ ! -f $FILES/$IMAGE_FNAME || "$(stat -c "%s" $FILES/$IMAGE_FNAME)" = "0" ]]; then |
|
1956 | 1956 |
wget -c $image_url -O $FILES/$IMAGE_FNAME |
1957 | 1957 |
fi |
1958 | 1958 |
|