Allow choice of GIT protocol used.

From within some corporate http networks, the 'git' protocol cannot be used.
Update the prepare_node and cache_git_repos scripts to default to using the
'git' protocol, but allow customiztion to use the 'http' protocol via command
line argument.

In addition, allow the full base url to be modifed as done in devstack stackrc
to also allow changing repositories.

Change-Id: I875f2e46c466e4e0fb7a5d4dbc54e958d91f9151
Partial-Bug: #1307702
This commit is contained in:
Ramy Asselin 2014-05-29 10:38:02 -07:00
parent 0a23df5a98
commit 4e6c268f6f
2 changed files with 13 additions and 3 deletions

View File

@ -19,6 +19,7 @@
import os.path import os.path
import re import re
import shutil import shutil
import sys
import urllib2 import urllib2
from common import run_local from common import run_local
@ -27,9 +28,16 @@ URL = ('https://git.openstack.org/cgit/openstack-infra/config/plain/'
'modules/openstack_project/files/review.projects.yaml') 'modules/openstack_project/files/review.projects.yaml')
PROJECT_RE = re.compile('^-?\s+project:\s+(.*)$') PROJECT_RE = re.compile('^-?\s+project:\s+(.*)$')
# Not using an arg libraries in order to avoid module imports that
# are not available across all python versions
if len(sys.argv) > 1:
GIT_BASE = sys.argv[1]
else:
GIT_BASE = 'git://git.openstack.org'
def clone_repo(project): def clone_repo(project):
remote = 'git://git.openstack.org/%s.git' % project remote = '%s/%s.git' % (GIT_BASE, project)
# Clear out any existing target directory first, in case of a retry. # Clear out any existing target directory first, in case of a retry.
try: try:

View File

@ -22,6 +22,7 @@ THIN=$3
PYTHON3=${4:-false} PYTHON3=${4:-false}
PYPY=${5:-false} PYPY=${5:-false}
ALL_MYSQL_PRIVS=${6:-false} ALL_MYSQL_PRIVS=${6:-false}
GIT_BASE=${7:-git://git.openstack.org}
# Save the nameservers configured by our provider. # Save the nameservers configured by our provider.
cat >/tmp/forwarding.conf <<EOF cat >/tmp/forwarding.conf <<EOF
@ -37,7 +38,8 @@ if [ -f /usr/bin/yum ]; then
fi fi
wget https://git.openstack.org/cgit/openstack-infra/config/plain/install_puppet.sh wget https://git.openstack.org/cgit/openstack-infra/config/plain/install_puppet.sh
sudo bash -xe install_puppet.sh sudo bash -xe install_puppet.sh
sudo git clone --depth=1 git://git.openstack.org/openstack-infra/config.git \
sudo git clone --depth=1 $GIT_BASE/openstack-infra/config.git \
/root/config /root/config
sudo /bin/bash /root/config/install_modules.sh sudo /bin/bash /root/config/install_modules.sh
if [ -z "$NODEPOOL_SSH_KEY" ] ; then if [ -z "$NODEPOOL_SSH_KEY" ] ; then
@ -86,7 +88,7 @@ dig git.openstack.org
# Cache all currently known gerrit repos. # Cache all currently known gerrit repos.
sudo mkdir -p /opt/git sudo mkdir -p /opt/git
sudo -i python /opt/nodepool-scripts/cache_git_repos.py sudo -i python /opt/nodepool-scripts/cache_git_repos.py $GIT_BASE
# We don't always get ext4 from our clouds, mount ext3 as ext4 on the next # We don't always get ext4 from our clouds, mount ext3 as ext4 on the next
# boot (eg when this image is used for testing). # boot (eg when this image is used for testing).