From 50336185d9c5a629e8b8c2d2b6a8b5ebca6de5af Mon Sep 17 00:00:00 2001 From: Igor Malinovskiy Date: Wed, 3 Jun 2015 16:18:32 +0300 Subject: [PATCH] Align project with default openstack project structure --- .gitignore | 33 +++++++++++++- .gitreview | 4 ++ CONTRIBUTING.rst | 11 +++++ HACKING.rst | 4 ++ MANIFEST.in | 6 +++ README.md | 1 - README.rst | 20 +++++++++ bin/manila-image-create | 88 +++++++++++++++++++++++++++++++++++++ build.sh | 74 ------------------------------- doc/source/conf.py | 75 +++++++++++++++++++++++++++++++ doc/source/contributing.rst | 4 ++ doc/source/index.rst | 23 ++++++++++ doc/source/readme.rst | 1 + requirements.txt | 8 +++- setup.cfg | 23 ++++++++++ setup.py | 30 +++++++++++++ test-requirements.txt | 9 ++++ tools/run_bashate.sh | 3 ++ tox.ini | 36 +++++++++++++++ 19 files changed, 375 insertions(+), 78 deletions(-) create mode 100644 .gitreview create mode 100644 CONTRIBUTING.rst create mode 100644 HACKING.rst create mode 100644 MANIFEST.in delete mode 100644 README.md create mode 100644 README.rst create mode 100644 bin/manila-image-create create mode 100644 doc/source/conf.py create mode 100644 doc/source/contributing.rst create mode 100644 doc/source/index.rst create mode 100644 doc/source/readme.rst create mode 100644 setup.cfg create mode 100644 setup.py create mode 100644 test-requirements.txt create mode 100755 tools/run_bashate.sh create mode 100644 tox.ini diff --git a/.gitignore b/.gitignore index ca997ad..1fda68c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,33 @@ -/*.d +*.py[co] +*.egg +*.egg-info +dist +build +eggs +parts +var +sdist +develop-eggs +.installed.cfg +pip-log.txt +.coverage +.tox +*.mo +.mr.developer.cfg +.DS_Store +Thumbs.db +.venv +.idea +out +target +*.iml +*.ipr +*.iws +*.db +.coverage +ChangeLog +AUTHORS *.qcow2 +diskimage-create.* debug.sh -.idea \ No newline at end of file +/*.d \ No newline at end of file diff --git a/.gitreview b/.gitreview new file mode 100644 index 0000000..d695867 --- /dev/null +++ b/.gitreview @@ -0,0 +1,4 @@ +[gerrit] +host=review.openstack.org +port=29418 +project=openstack/manila-image-elements.git \ No newline at end of file diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst new file mode 100644 index 0000000..c3e6cf9 --- /dev/null +++ b/CONTRIBUTING.rst @@ -0,0 +1,11 @@ +If you would like to contribute to the development of OpenStack, you must follow the steps in this page: + +http://docs.openstack.org/infra/manual/developers.html +If you already have a good understanding of how the system works and your OpenStack accounts are set up, you can skip to the development workflow section of this documentation to learn how changes to OpenStack should be submitted for review via the Gerrit tool: + +http://docs.openstack.org/infra/manual/developers.html#development-workflow +Pull requests submitted through GitHub will be ignored. + +Bugs should be filed on Launchpad, not GitHub: + +https://bugs.launchpad.net/manila-image \ No newline at end of file diff --git a/HACKING.rst b/HACKING.rst new file mode 100644 index 0000000..37ad496 --- /dev/null +++ b/HACKING.rst @@ -0,0 +1,4 @@ +Manila Style Commandments +=============================================== + +Read the OpenStack Style Commandments http://docs.openstack.org/developer/hacking/ \ No newline at end of file diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..90f8a7a --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,6 @@ +include AUTHORS +include ChangeLog +exclude .gitignore +exclude .gitreview + +global-exclude *.pyc \ No newline at end of file diff --git a/README.md b/README.md deleted file mode 100644 index 0cb850b..0000000 --- a/README.md +++ /dev/null @@ -1 +0,0 @@ -# manila-service-image diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..ef9c5bb --- /dev/null +++ b/README.rst @@ -0,0 +1,20 @@ +Manila image elements project +============================== + +This repo is a place for Manila-related for diskimage-builder elements. + +* Free software: Apache license +* Source: http://git.openstack.org/cgit/manila-image-elements +* Bugs: http://bugs.launchpad.net/manila-image + + +Build instructions +------------------ + +Script for creating Ubuntu based image with our elements and default parameters. You should only need to run this command: + +.. sourcecode:: bash + + tox -e venv -- manila-image-create + +Note: More information about script `diskimage-create `_ diff --git a/bin/manila-image-create b/bin/manila-image-create new file mode 100644 index 0000000..df9d8ef --- /dev/null +++ b/bin/manila-image-create @@ -0,0 +1,88 @@ +#!/bin/bash + +set -eu +set -o pipefail + +SCRIPT_HOME=$(dirname $(readlink -f $0)) +if [ -d $SCRIPT_HOME/../share/manila-elements ]; then + _PREFIX=$SCRIPT_HOME/../share/manila-elements +elif [ -d $SCRIPT_HOME/../../../elements ]; then + _PREFIX=$SCRIPT_HOME/../../.. +else + _PREFIX=$SCRIPT_HOME/.. +fi +export ELEMENTS_PATH=$_PREFIX/elements + +# Collect configuration +# -------------------- +# Development options: +USE_OFFLINE_MODE=${USE_OFFLINE_MODE:-"yes"} +ENABLE_DEBUG_MODE=${ENABLE_DEBUG_MODE:-"no"} +DISABLE_IMG_COMPRESSION=${DISABLE_IMG_COMPRESSION:-"no"} + +# Manila user settings +MANILA_USER=${MANILA_USER:-"manila"} +MANILA_PASSWORD=${MANILA_PASSWORD:-"manila"} +MANILA_USER_AUTHORIZED_KEYS="None" + +# Manila image settings +MANILA_IMG_ARCH=${MANILA_IMG_ARCH:-"i386"} +MANILA_IMG_OS=${MANILA_IMG_OS:-"manila-ubuntu-core"} +MANILA_IMG_OS_VER=${MANILA_IMG_OS_VER:-"trusty"} +MANILA_IMG_NAME=${MANILA_IMG_NAME:-"ubuntu-manila-service-image.qcow2"} + +# Manila features +MANILA_ENABLE_NFS_SUPPORT=${MANILA_ENABLE_NFS_SUPPORT:-"yes"} +MANILA_ENABLE_CIFS_SUPPORT=${MANILA_ENABLE_CIFS_SUPPORT:-"yes"} + + +# Verify configuration +# -------------------- +REQUIRED_ELEMENTS="manila-ssh vm $MANILA_IMG_OS dhcp-all-interfaces cleanup-kernel-initrd" +OPTIONAL_ELEMENTS= +OPTIONAL_DIB_ARGS= + +if [ "$MANILA_ENABLE_CIFS_SUPPORT" != "yes" && "$MANILA_ENABLE_CIFS_SUPPORT" = "yes" ]; then + echo "You should enable NFS or CIFS support for manila image." +fi + +if [ "$MANILA_ENABLE_NFS_SUPPORT" = "yes" ]; then + OPTIONAL_ELEMENTS="$OPTIONAL_ELEMENTS manila-nfs" +fi + +if [ "$MANILA_ENABLE_CIFS_SUPPORT" = "yes" ]; then + OPTIONAL_ELEMENTS="$OPTIONAL_ELEMENTS manila-cifs" +fi + +if [ "$USE_OFFLINE_MODE" = "yes" ]; then + OPTIONAL_DIB_ARGS="$OPTIONAL_DIB_ARGS -offline" +fi + +if [ "$ENABLE_DEBUG_MODE" = "yes" ]; then + OPTIONAL_DIB_ARGS="$OPTIONAL_DIB_ARGS -x" + MANILA_USER_AUTHORIZED_KEYS=${MANILA_USER_AUTHORIZED_KEYS:-"$HOME/.ssh/id_rsa.pub"} +fi + +if [ "$DISABLE_IMG_COMPRESSION" = "yes" ]; then + OPTIONAL_DIB_ARGS="$OPTIONAL_DIB_ARGS -u" +fi + +if [ "$MANILA_IMG_OS" = "manila-ubuntu-core" && "$MANILA_IMG_OS_VER" != "trusty" ]; then + echo "manila-ubuntu-core doesn't support '$MANILA_IMG_OS_VER' release." + echo "Change MANILA_IMG_OS to 'ubuntu' if you need another release." +fi + +# Export diskimage-builder settings +# --------------------------------- +export DIB_DEFAULT_INSTALLTYPE=package +export DIB_RELEASE=$MANILA_IMG_OS_VER + +# User settings +export DIB_MANILA_USER_USERNAME=$MANILA_USER +export DIB_MANILA_USER_PASSWORD=$MANILA_PASSWORD +export DIB_MANILA_USER_AUTHORIZED_KEYS=$MANILA_USER_AUTHORIZED_KEYS + +# Build image +# ----------- +disk-image-create -a $MANILA_IMG_ARCH $OPTIONAL_DIB_ARGS -o $MANILA_IMG_NAME\ + $OPTIONAL_ELEMENTS $REQUIRED_ELEMENTS \ No newline at end of file diff --git a/build.sh b/build.sh index db71d49..e69de29 100755 --- a/build.sh +++ b/build.sh @@ -1,74 +0,0 @@ -# Defaults: - -# Development options: -USE_OFFLINE_MODE=${USE_OFFLINE_MODE:-"yes"} -ENABLE_DEBUG_MODE=${ENABLE_DEBUG_MODE:-"no"} -DISABLE_IMG_COMPRESSION=${DISABLE_IMG_COMPRESSION:-"no"} - -# Manila user settings -MANILA_USER=${MANILA_USER:-"manila"} -MANILA_PASSWORD=${MANILA_PASSWORD:-"manila"} -MANILA_USER_AUTHORIZED_KEYS="None" - -# Manila image settings -MANILA_IMG_ARCH=${MANILA_IMG_ARCH:-"i386"} -MANILA_IMG_OS=${MANILA_IMG_OS:-"manila-ubuntu-core"} -MANILA_IMG_OS_VER=${MANILA_IMG_OS_VER:-"trusty"} -MANILA_IMG_NAME=${MANILA_IMG_NAME:-"ubuntu-manila-service-image.qcow2"} - -# Manila features -MANILA_ENABLE_NFS_SUPPORT=${MANILA_ENABLE_NFS_SUPPORT:-"yes"} -MANILA_ENABLE_CIFS_SUPPORT=${MANILA_ENABLE_CIFS_SUPPORT:-"yes"} - - -# Verify configuration -# -------------------- -REQUIRED_ELEMENTS="manila-ssh vm $MANILA_IMG_OS dhcp-all-interfaces cleanup-kernel-initrd" -OPTIONAL_ELEMENTS= -OPTIONAL_DIB_ARGS= - -if [ "$MANILA_ENABLE_CIFS_SUPPORT" != "yes" && "$MANILA_ENABLE_CIFS_SUPPORT" = "yes" ]; then - echo "You should enable NFS or CIFS support for manila image." -fi - -if [ "$MANILA_ENABLE_NFS_SUPPORT" = "yes" ]; then - OPTIONAL_ELEMENTS="$OPTIONAL_ELEMENTS manila-nfs" -fi - -if [ "$MANILA_ENABLE_CIFS_SUPPORT" = "yes" ]; then - OPTIONAL_ELEMENTS="$OPTIONAL_ELEMENTS manila-cifs" -fi - -if [ "$USE_OFFLINE_MODE" = "yes" ]; then - OPTIONAL_DIB_ARGS="$OPTIONAL_DIB_ARGS -offline" -fi - -if [ "$ENABLE_DEBUG_MODE" = "yes" ]; then - OPTIONAL_DIB_ARGS="$OPTIONAL_DIB_ARGS -x" - MANILA_USER_AUTHORIZED_KEYS=${MANILA_USER_AUTHORIZED_KEYS:-"$HOME/.ssh/id_rsa.pub"} -fi - -if [ "$DISABLE_IMG_COMPRESSION" = "yes" ]; then - OPTIONAL_DIB_ARGS="$OPTIONAL_DIB_ARGS -u" -fi - -if [ "$MANILA_IMG_OS" = "manila-ubuntu-core" && "$MANILA_IMG_OS_VER" != "trusty" ]; then - echo "manila-ubuntu-core doesn't support '$MANILA_IMG_OS_VER' release." - echo "Change MANILA_IMG_OS to 'ubuntu' if you need another release." -fi - -# Export diskimage-builder settings -# --------------------------------- -export ELEMENTS_PATH=`pwd`/elements -export DIB_DEFAULT_INSTALLTYPE=package -export DIB_RELEASE=$MANILA_IMG_OS_VER - -# User settings -export DIB_MANILA_USER_USERNAME=$MANILA_USER -export DIB_MANILA_USER_PASSWORD=$MANILA_PASSWORD -export DIB_MANILA_USER_AUTHORIZED_KEYS=$MANILA_USER_AUTHORIZED_KEYS - -# Build image -# ----------- -disk-image-create -a $MANILA_IMG_ARCH $OPTIONAL_DIB_ARGS -o $MANILA_IMG_NAME\ - $OPTIONAL_ELEMENTS $REQUIRED_ELEMENTS \ No newline at end of file diff --git a/doc/source/conf.py b/doc/source/conf.py new file mode 100644 index 0000000..179a126 --- /dev/null +++ b/doc/source/conf.py @@ -0,0 +1,75 @@ +# -*- coding: utf-8 -*- +# 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. + +import os +import sys + +sys.path.insert(0, os.path.abspath('../..')) +# -- General configuration ---------------------------------------------------- + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. +extensions = [ + 'sphinx.ext.autodoc', + #'sphinx.ext.intersphinx', + 'oslosphinx' +] + +# autodoc generation is a bit aggressive and a nuisance when doing heavy +# text edit cycles. +# execute "export SPHINX_DEBUG=1" in your terminal to disable + +# The suffix of source filenames. +source_suffix = '.rst' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = u'manila-image-elements' +copyright = u'2013, OpenStack Foundation' + +# If true, '()' will be appended to :func: etc. cross-reference text. +add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +add_module_names = True + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# -- Options for HTML output -------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. Major themes that come with +# Sphinx are currently 'default' and 'sphinxdoc'. +# html_theme_path = ["."] +# html_theme = '_theme' +# html_static_path = ['static'] + +# Output file base name for HTML help builder. +htmlhelp_basename = '%sdoc' % project + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, author, documentclass +# [howto/manual]). +latex_documents = [ + ('index', + '%s.tex' % project, + u'%s Documentation' % project, + u'OpenStack Foundation', 'manual'), +] + +# Example configuration for intersphinx: refer to the Python standard library. +#intersphinx_mapping = {'http://docs.python.org/': None} diff --git a/doc/source/contributing.rst b/doc/source/contributing.rst new file mode 100644 index 0000000..ed77c12 --- /dev/null +++ b/doc/source/contributing.rst @@ -0,0 +1,4 @@ +============ +Contributing +============ +.. include:: ../../CONTRIBUTING.rst \ No newline at end of file diff --git a/doc/source/index.rst b/doc/source/index.rst new file mode 100644 index 0000000..d566b4b --- /dev/null +++ b/doc/source/index.rst @@ -0,0 +1,23 @@ +.. manila-image-elements documentation master file, created by + sphinx-quickstart on Tue Jul 9 22:26:36 2013. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to manila-image-elements documentation! +======================================================== + +Contents: + +.. toctree:: + :maxdepth: 2 + + readme + contributing + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` + diff --git a/doc/source/readme.rst b/doc/source/readme.rst new file mode 100644 index 0000000..38ba804 --- /dev/null +++ b/doc/source/readme.rst @@ -0,0 +1 @@ +.. include:: ../../README.rst \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 27249a4..e9a0630 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,7 @@ -diskimage-builder \ No newline at end of file +# The order of packages is significant, because pip processes them in the order +# of appearance. Changing the order has an impact on the overall integration +# process, which may cause wedges in the gate later. + +pbr>=0.11,<2.0 + +diskimage-builder>=0.1.45 \ No newline at end of file diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..e9517ee --- /dev/null +++ b/setup.cfg @@ -0,0 +1,23 @@ +[metadata] +name = manila-image-elements +summary = Image elements for Manila +description-file = README.rst +license = Apache Software License +classifiers = + Intended Audience :: Information Technology + Intended Audience :: System Administrators + License :: OSI Approved :: Apache Software License + Operating System :: POSIX :: Linux +author = OpenStack +author-email = openstack-dev@lists.openstack.org +home-page = https://docs.openstack.org/developer/manila + +[files] +scripts = + bin/manila-image-create + +data_files = + share/manila-elements/elements = elements/* + +[wheel] +universal = 1 \ No newline at end of file diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..7363757 --- /dev/null +++ b/setup.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python +# Copyright (c) 2013 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. + +# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT +import setuptools + +# In python < 2.7.4, a lazy loading of package `pbr` will break +# setuptools if some other modules registered functions in `atexit`. +# solution from: http://bugs.python.org/issue15881#msg170215 +try: + import multiprocessing # noqa +except ImportError: + pass + +setuptools.setup( + setup_requires=['pbr'], + pbr=True) diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 0000000..6cc778c --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1,9 @@ +# The order of packages is significant, because pip processes them in the order +# of appearance. Changing the order has an impact on the overall integration +# process, which may cause wedges in the gate later. + +bashate>=0.2 # Apache-2.0 +hacking>=0.10.0,<0.11 + +sphinx>=1.1.2,!=1.2.0,!=1.3b1,<1.3 +oslosphinx>=2.2.0 # Apache-2.0 \ No newline at end of file diff --git a/tools/run_bashate.sh b/tools/run_bashate.sh new file mode 100755 index 0000000..e8dab51 --- /dev/null +++ b/tools/run_bashate.sh @@ -0,0 +1,3 @@ +#!/bin/bash -xe + +find ./ -not -wholename \*.tox/\* -and \( -name \*.sh -or -wholename \*.d/\* -and -not -name \*.md -and -not -name \*.rst -and -not -name \*.py \) -print0 | xargs -0 bashate -v diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..1f4fd5a --- /dev/null +++ b/tox.ini @@ -0,0 +1,36 @@ +[tox] +envlist = pep8 +minversion = 1.6 +skipsdist = True + +[testenv] +usedevelop = True +install_command = pip install -U {opts} {packages} +setenv = + VIRTUAL_ENV={envdir} +deps = + -r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt + +[tox:jenkins] +downloadcache = ~/cache/pip + +[testenv:bashate] +whitelist_externals = bash +commands = {toxinidir}/tools/run_bashate.sh + +[testenv:docs] +commands = python setup.py build_sphinx + +[testenv:pep8] +commands = + flake8 {posargs} + {toxinidir}/tools/run_bashate.sh + +[testenv:venv] +commands = {posargs} + +[flake8] +show-source = true +builtins = _ +exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,tools