specify version for tox
Change-Id: I099c3753f29f414159fafb527b0c568e3324ec85
This commit is contained in:
parent
38139b9700
commit
a2804a5579
|
@ -19,4 +19,4 @@ dist
|
|||
!.coveragerc
|
||||
cover/
|
||||
.idea
|
||||
|
||||
ec2api/tests/unit/test_cert.pem
|
||||
|
|
|
@ -37,23 +37,30 @@ fi
|
|||
EC2_URL=`openstack endpoint list --service ec2 --interface public --os-identity-api-version=3 -c URL -f value`
|
||||
S3_URL=`openstack endpoint list --service s3 --interface public --os-identity-api-version=3 -c URL -f value`
|
||||
|
||||
# in some cases these packages can present in the system but don't work
|
||||
# reinstalling can help
|
||||
venv_dir="$(pwd)/.venv_awscli"
|
||||
virtualenv "$venv_dir"
|
||||
if [[ "$?" -ne "0" ]]; then
|
||||
die $LINENO "Can't setup virtual env."
|
||||
fi
|
||||
source "$venv_dir/bin/activate"
|
||||
pip install awscli
|
||||
if [[ "$?" -ne "0" ]]; then
|
||||
die $LINENO "Can't install awscli in virtual env."
|
||||
fi
|
||||
aws --version
|
||||
if [[ "$?" -ne "0" ]]; then
|
||||
sudo pip install awscli --upgrade
|
||||
aws --version
|
||||
if [[ "$?" -ne "0" ]]; then
|
||||
die $LINENO "Looks like awscli is not correctly installed."
|
||||
fi
|
||||
die $LINENO "awscli doesn't work correctly."
|
||||
fi
|
||||
deactivate
|
||||
|
||||
project_id=`openstack project show $OS_PROJECT_NAME -c id -f value`
|
||||
openstack ec2 credentials create 1>&2
|
||||
line=`openstack ec2 credentials list | grep " $project_id "`
|
||||
read ec2_access_key ec2_secret_key <<< `echo $line | awk '{print $2 " " $4 }'`
|
||||
source "$venv_dir/bin/activate"
|
||||
aws configure set aws_access_key_id $ec2_access_key --profile admin
|
||||
aws configure set aws_secret_access_key $ec2_secret_key --profile admin
|
||||
deactivate
|
||||
AWS_PARAMS="--region $REGION_NAME --endpoint-url $EC2_URL"
|
||||
|
||||
neutron_item=$(openstack service list | grep neutron)
|
||||
|
@ -68,7 +75,9 @@ wget -nv -P /tmp $CIRROS_IMAGE_URL &
|
|||
cirros_image_wget_pid=$!
|
||||
|
||||
# find simple image
|
||||
source "$venv_dir/bin/activate"
|
||||
image_id=`aws $AWS_PARAMS --profile admin ec2 describe-images --filters Name=image-type,Values=machine Name=name,Values=cirros* --query 'Images[0].ImageId' --output text`
|
||||
deactivate
|
||||
|
||||
if [[ "$image_id" == 'None' || -z "$image_id" ]]; then
|
||||
wait $cirros_image_wget_pid
|
||||
|
@ -77,7 +86,9 @@ if [[ "$image_id" == 'None' || -z "$image_id" ]]; then
|
|||
if [[ "$?" -ne "0" ]]; then
|
||||
echo "Creation of openstack image failed."
|
||||
fi
|
||||
source "$venv_dir/bin/activate"
|
||||
image_id=`aws $AWS_PARAMS --profile admin ec2 describe-images --filters Name=image-type,Values=machine Name=name,Values=cirros* --query 'Images[0].ImageId' --output text`
|
||||
deactivate
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -95,7 +106,9 @@ if [[ $RUN_LONG_TESTS == "1" ]]; then
|
|||
exit 1
|
||||
fi
|
||||
# find this image
|
||||
source "$venv_dir/bin/activate"
|
||||
image_id_ubuntu=`aws $AWS_PARAMS --profile admin ec2 describe-images --filters Name=image-type,Values=machine Name=name,Values=$REGULAR_IMAGE_NAME --query 'Images[0].ImageId' --output text`
|
||||
deactivate
|
||||
fi
|
||||
|
||||
# create separate user/project
|
||||
|
@ -129,8 +142,10 @@ fi
|
|||
openstack ec2 credentials create --user $user_id --project $project_id 1>&2
|
||||
line=`openstack ec2 credentials list --user $user_id | grep " $project_id "`
|
||||
read ec2_access_key ec2_secret_key <<< `echo $line | awk '{print $2 " " $4 }'`
|
||||
source "$venv_dir/bin/activate"
|
||||
aws configure set aws_access_key_id $ec2_access_key --profile user
|
||||
aws configure set aws_secret_access_key $ec2_secret_key --profile user
|
||||
deactivate
|
||||
|
||||
auth="--os-project-name $project_name --os-username $user_name --os-password password"
|
||||
|
||||
|
@ -189,7 +204,9 @@ if [[ -n "$openstack_image_id" ]]; then
|
|||
if [[ "$?" -ne "0" ]]; then
|
||||
die $LINENO "Image creation from instance fails"
|
||||
fi
|
||||
source "$venv_dir/bin/activate"
|
||||
ebs_image_id=`aws $AWS_PARAMS --profile user ec2 describe-images --filters Name=image-type,Values=machine Name=name,Values=$image_name --query 'Images[0].ImageId' --output text`
|
||||
deactivate
|
||||
nova $auth delete $instance_id
|
||||
fi
|
||||
|
||||
|
@ -245,7 +262,9 @@ if [[ "$?" -eq "0" && "$CA_CERT" && -e "$CA_CERT" ]]; then
|
|||
warn $LINENO "Bundling of image $CIRROS_IMAGE_URL failed."
|
||||
fi
|
||||
# next line is example how to register this image in the cloud
|
||||
#source "$venv_dir/bin/activate"
|
||||
#aws --endpoint-url $EC2_URL --region RegionOne --profile admin ec2 register-image --image-location "$AWS_AMI_BUCKET/$CIRROS_IMAGE_FNAME.manifest.xml" --name "$CIRROS_IMAGE_FNAME" --architecture x86_64
|
||||
#deactivate
|
||||
else
|
||||
warn $LINENO "Downloading of image $CIRROS_IMAGE_URL failed."
|
||||
fi
|
||||
|
|
22
tox.ini
22
tox.ini
|
@ -1,27 +1,25 @@
|
|||
[tox]
|
||||
minversion = 2.0
|
||||
envlist = py35,py27,pep8
|
||||
minversion = 2.1
|
||||
envlist = py{35,27},pep8
|
||||
skipsdist = True
|
||||
|
||||
[testenv]
|
||||
sitepackages = False
|
||||
usedevelop = True
|
||||
install_command = {toxinidir}/tools/tox_install.sh {env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages}
|
||||
# tox is silly... these need to be separated by a newline....
|
||||
whitelist_externals = bash
|
||||
find
|
||||
rm
|
||||
env
|
||||
install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=stable/pike} {opts} {packages}
|
||||
setenv = VIRTUAL_ENV={envdir}
|
||||
BRANCH_NAME=master
|
||||
CLIENT_NAME=ec2-api
|
||||
LANG=en_US.UTF-8
|
||||
LANGUAGE=en_US:en
|
||||
LC_ALL=C
|
||||
deps = -r{toxinidir}/requirements.txt
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
deps = -r{toxinidir}/test-requirements.txt
|
||||
commands =
|
||||
find . -type f -name "*.pyc" -delete
|
||||
rm -f .testrepository/times.dbm
|
||||
python tools/patch_tox_venv.py
|
||||
python setup.py testr --slowest --testr-args='{posargs}'
|
||||
|
||||
[tox:jenkins]
|
||||
sitepackages = False
|
||||
|
||||
[testenv:pep8]
|
||||
sitepackages = False
|
||||
|
|
Loading…
Reference in New Issue