From 072b373a4ec171da1170cd6c02910b110ceb8f94 Mon Sep 17 00:00:00 2001 From: Adam Harwell Date: Thu, 9 Mar 2017 01:18:06 +0900 Subject: [PATCH] Look for diskimage-builder not dib-utils when building amps Also ignore E402 and W503 pep8 issues Change-Id: I7937d0a21c7a748cd682511bd429de8cf0ffe498 (cherry picked from commit cf9a8c8f779a3542681a4b3ea3274681cec6f682) --- devstack/plugin.sh | 2 -- diskimage-create/README.rst | 16 +++++----------- diskimage-create/diskimage-create.sh | 19 ------------------- diskimage-create/requirements.txt | 2 +- requirements.txt | 1 + tox.ini | 2 +- 6 files changed, 8 insertions(+), 34 deletions(-) diff --git a/devstack/plugin.sh b/devstack/plugin.sh index c160c12865..c5e6d6dc97 100644 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -7,9 +7,7 @@ function octavia_install { setup_develop $OCTAVIA_DIR if ! [ "$DISABLE_AMP_IMAGE_BUILD" == 'True' ]; then install_package qemu kpartx - git_clone $DISKIMAGE_BUILDER_REPO $DISKIMAGE_BUILDER_DIR $DISKIMAGE_BUILDER_BRANCH git_clone $TRIPLEO_IMAGE_ELEMENTS_REPO $TRIPLEO_IMAGE_ELEMENTS_DIR $TRIPLEO_IMAGE_ELEMENTS_BRANCH - sudo -H -E pip install -r $DEST/diskimage-builder/requirements.txt fi } diff --git a/diskimage-create/README.rst b/diskimage-create/README.rst index 01ace67f79..a3e9a9df24 100644 --- a/diskimage-create/README.rst +++ b/diskimage-create/README.rst @@ -14,31 +14,25 @@ Prerequisites This script assumes a typical Linux environment and was developed on Ubuntu 12.04.5 LTS. -Python pip should be installed as well as the following python modules: - - | argparse - | Babel>=1.3 - | dib-utils - | PyYAML +Python pip should be installed as well as the python modules found in the +requirements.txt file. Your cache directory should have at least 1GB available, the working directory will need ~1.5GB, and your image destination will need ~500MB -The script expects to find the diskimage-builder and tripleo-image-elements +The script expects to find the tripleo-image-elements git repositories one directory above the Octavia git repository. | //octavia - | //diskimage-builder | //tripleo-image-elements | cd / | git clone https://github.com/openstack/octavia.git - | git clone https://git.openstack.org/openstack/diskimage-builder.git | git clone https://git.openstack.org/openstack/tripleo-image-elements.git -These paths can be overridden with the following environment variables: +The script will use the version of diskimage-builder installed on your system, +or it can be overridden by setting the following environment variables: - | OCTAVIA_REPO_PATH = //octavia | DIB_REPO_PATH = //diskimage-builder | DIB_ELEMENTS = //diskimage-builder/elements | ELEMENTS_REPO_PATH = //tripleo-image-elements diff --git a/diskimage-create/diskimage-create.sh b/diskimage-create/diskimage-create.sh index 62812b01a3..bdd565c9ff 100755 --- a/diskimage-create/diskimage-create.sh +++ b/diskimage-create/diskimage-create.sh @@ -289,25 +289,6 @@ else fi fi -# pip may not be installed from package managers -# only check that we find an executable -if ! which pip &> /dev/null; then - echo "Required executable pip not found. Exiting." - exit 1 -fi - -# "pip freeze" does not show argparse, even if it is explicitly installed, -# because it is part of the standard python library in 2.7. -# See https://github.com/pypa/pip/issues/1570 - -PKG_LIST="Babel dib-utils PyYAML" - for pkg in $PKG_LIST; do - if ! pip freeze 2>/dev/null| grep -q "^$pkg==" &>/dev/null; then - echo "Required python package " $pkg " is not installed. Exiting." - exit 1 - fi - done - if [ "$AMP_WORKING_DIR" ]; then mkdir -p $AMP_WORKING_DIR TEMP=$(mktemp -d $AMP_WORKING_DIR/diskimage-create.XXXXXX) diff --git a/diskimage-create/requirements.txt b/diskimage-create/requirements.txt index 7930ee859b..c1171e39a8 100644 --- a/diskimage-create/requirements.txt +++ b/diskimage-create/requirements.txt @@ -1,4 +1,4 @@ Babel>=1.3 -dib-utils +diskimage-builder PyYAML six>=1.9.0 diff --git a/requirements.txt b/requirements.txt index fcb5dd5189..b0295d6b60 100644 --- a/requirements.txt +++ b/requirements.txt @@ -33,6 +33,7 @@ pyOpenSSL>=0.14 # Apache-2.0 WSME>=0.8 # MIT Jinja2>=2.8 # BSD License (3 clause) taskflow>=1.26.0 # Apache-2.0 +diskimage-builder>=1.1.2,!=1.6.0,!=1.7.0,!=1.7.1 # Apache-2.0 #for the amphora api Flask!=0.11,<1.0,>=0.10 # BSD diff --git a/tox.ini b/tox.ini index 44e9b10d9c..37bc2ef1a9 100644 --- a/tox.ini +++ b/tox.ini @@ -77,7 +77,7 @@ commands = bandit -r octavia -ll -ii -x octavia/tests {posargs} [flake8] # Ignoring O321 because it's unnecessarily restricting use of json package. # jsonutils version doesn't add additional value -ignore = O321 +ignore = O321,E402,W503 show-source = true builtins = _ exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build