#!/bin/bash -xe

# Copyright (C) 2014 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
#
# See the License for the specific language governing permissions and
# limitations under the License.

source /etc/nodepool/provider

NODEPOOL_PYPI_MIRROR=${NODEPOOL_PYPI_MIRROR:-http://pypi.$NODEPOOL_REGION.openstack.org/simple}

cat >/home/jenkins/.pip/pip.conf <<EOF
[global]
index-url = $NODEPOOL_PYPI_MIRROR
EOF

cat >/home/jenkins/.pydistutils.cfg <<EOF
[easy_install]
index_url = $NODEPOOL_PYPI_MIRROR
EOF

#!/bin/bash -xe

# Copyright (C) 2014 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
#
# See the License for the specific language governing permissions and
# limitations under the License.

source /etc/nodepool/provider

cat >/home/jenkins/.pip/pip.conf <<EOF
[global]
index-url = http://pypi.$NODEPOOL_REGION.openstack.org/simple
EOF

cat >/home/jenkins/.pydistutils.cfg <<EOF
[easy_install]
index_url = http://pypi.$NODEPOOL_REGION.openstack.org/simple
EOF

--- 
+++ 
@@ -18,12 +18,14 @@
 
 source /etc/nodepool/provider
 
+NODEPOOL_PYPI_MIRROR=${NODEPOOL_PYPI_MIRROR:-http://pypi.$NODEPOOL_REGION.openstack.org/simple}
+
 cat >/home/jenkins/.pip/pip.conf <<EOF
 [global]
-index-url = http://pypi.$NODEPOOL_REGION.openstack.org/simple
+index-url = $NODEPOOL_PYPI_MIRROR
 EOF
 
 cat >/home/jenkins/.pydistutils.cfg <<EOF
 [easy_install]
-index_url = http://pypi.$NODEPOOL_REGION.openstack.org/simple
+index_url = $NODEPOOL_PYPI_MIRROR
 EOF
Allow to use custom mirror

The current configure_mirror.sh expects no-one
want to use other than openstack.org pypi mirrors.

Having the configure_mirror.sh to use a costum,
NODEPOOL_PYPI_MIRROR instead of NODEPOOL_REGION when defined.

It allows averyone to use his local pypi mirror, with his
nodepool.

Change-Id: I6f0bd3372be09ccf423caacff83e615038c96ec5
