From 6d3c5fb31c2f51136c6cf3d9f30107c2e02c927e Mon Sep 17 00:00:00 2001 From: Taseer Ahmed Date: Sun, 24 Dec 2017 19:15:23 +0500 Subject: [PATCH] Outline the structure --- .gitignore | 71 ++++++++++++++++++++++++++ .gitreview | 4 ++ Vagrantfile | 47 ++++++++++++++++++ defaults/main.yml | 1 + handlers/main.yml | 1 + meta/main.yml | 1 + run_tests.sh | 71 ++++++++++++++++++++++++++ setup.cfg | 24 +++++++++ setup.py | 19 +++++++ tasks/main.yml | 1 + test-requirements.txt | 16 ++++++ tests/main.yml | 1 + tox.ini | 113 ++++++++++++++++++++++++++++++++++++++++++ vars/main.yml | 1 + 14 files changed, 371 insertions(+) create mode 100644 .gitignore create mode 100644 .gitreview create mode 100644 Vagrantfile create mode 100644 defaults/main.yml create mode 100644 handlers/main.yml create mode 100644 meta/main.yml create mode 100644 run_tests.sh create mode 100644 setup.cfg create mode 100644 setup.py create mode 100644 tasks/main.yml create mode 100644 test-requirements.txt create mode 100644 tests/main.yml create mode 100644 tox.ini create mode 100644 vars/main.yml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ffc8054 --- /dev/null +++ b/.gitignore @@ -0,0 +1,71 @@ +# Compiled source # +################### +*.com +*.class +*.dll +*.exe +*.o +*.so +*.pyc +build/ +dist/ +doc/build/ + +# Packages # +############ +# it's better to unpack these files and commit the raw source +# git has its own built in compression methods +*.7z +*.dmg +*.gz +*.iso +*.jar +*.rar +*.tar +*.zip + +# Logs and databases # +###################### +*.log +*.sql +*.sqlite +logs/* + +# OS generated files # +###################### +.DS_Store +.DS_Store? +._* +.Spotlight-V100 +.Trashes +.idea +.tox +*.sublime* +*.egg-info +Icon? +ehthumbs.db +Thumbs.db +.eggs + +# User driven backup files # +############################ +*.bak +*.swp + +# Generated by pbr while building docs +###################################### +AUTHORS +ChangeLog + +# Files created by releasenotes build +releasenotes/build + +# Test temp files +tests/common +tests/*.retry + +# Vagrant artifacts +.vagrant + +# Git clones +openstack-ansible-ops \ No newline at end of file diff --git a/.gitreview b/.gitreview new file mode 100644 index 0000000..8293158 --- /dev/null +++ b/.gitreview @@ -0,0 +1,4 @@ +[gerrit] +host=review.openstack.org +port=29418 +project=openstack/openstack-ansible-os_blazar.git \ No newline at end of file diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 0000000..5a1e429 --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,47 @@ +# Note: +# This file is maintained in the openstack-ansible-tests repository. +# https://git.openstack.org/cgit/openstack/openstack-ansible-tests/tree/Vagrantfile +# +# If you need to perform any change on it, you should modify the central file, +# then, an OpenStack CI job will propagate your changes to every OSA repository +# since every repo uses the same Vagrantfile + +# Verify whether required plugins are installed. +required_plugins = [ "vagrant-disksize" ] +required_plugins.each do |plugin| + if not Vagrant.has_plugin?(plugin) + raise "The vagrant plugin #{plugin} is required. Please run `vagrant plugin install #{plugin}`" + end +end + +Vagrant.configure(2) do |config| + config.vm.provider "virtualbox" do |v| + v.memory = 4096 + v.cpus = 2 + end + + config.vm.provision "shell", + privileged: false, + inline: <<-SHELL + cd /vagrant + ./run_tests.sh + SHELL + + config.vm.define "ubuntu1604" do |xenial| + xenial.disksize.size = "40GB" + xenial.vm.box = "ubuntu/xenial64" + end + + config.vm.define "opensuse422" do |leap422| + leap422.vm.box = "opensuse/openSUSE-42.2-x86_64" + end + + config.vm.define "opensuse423" do |leap423| + leap423.vm.box = "opensuse/openSUSE-42.3-x86_64" + end + + config.vm.define "centos7" do |centos7| + centos7.vm.box = "centos/7" + end + +end \ No newline at end of file diff --git a/defaults/main.yml b/defaults/main.yml new file mode 100644 index 0000000..75356bf --- /dev/null +++ b/defaults/main.yml @@ -0,0 +1 @@ +# defaults for blazar \ No newline at end of file diff --git a/handlers/main.yml b/handlers/main.yml new file mode 100644 index 0000000..b42181f --- /dev/null +++ b/handlers/main.yml @@ -0,0 +1 @@ +# handlers for blazar \ No newline at end of file diff --git a/meta/main.yml b/meta/main.yml new file mode 100644 index 0000000..a664c88 --- /dev/null +++ b/meta/main.yml @@ -0,0 +1 @@ +# meta \ No newline at end of file diff --git a/run_tests.sh b/run_tests.sh new file mode 100644 index 0000000..23ec75a --- /dev/null +++ b/run_tests.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash +# Copyright 2015, Rackspace US, Inc. +# +# 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. +# +# Note: +# This file is maintained in the openstack-ansible-tests repository. +# https://git.openstack.org/cgit/openstack/openstack-ansible-tests/tree/run_tests.sh +# If you need to modify this file, update the one in the openstack-ansible-tests +# repository and then update this file as well. The purpose of this file is to +# prepare the host and then execute all the tox tests. +# + +## Shell Opts ---------------------------------------------------------------- +set -xeu + +## Vars ---------------------------------------------------------------------- + +export WORKING_DIR=${WORKING_DIR:-$(pwd)} + +## Main ---------------------------------------------------------------------- + +source /etc/os-release || source /usr/lib/os-release + +install_pkg_deps() { + pkg_deps="git" + + # Prefer dnf over yum for CentOS. + which dnf &>/dev/null && RHT_PKG_MGR='dnf' || RHT_PKG_MGR='yum' + + case ${ID,,} in + *suse*) pkg_mgr_cmd="zypper -n in" ;; + centos|rhel) pkg_mgr_cmd="${RHT_PKG_MGR} install -y" ;; + fedora) pkg_mgr_cmd="dnf -y install" ;; + ubuntu|debian) pkg_mgr_cmd="apt-get install -y" ;; + *) echo "unsupported distribution: ${ID,,}"; exit 1 ;; + esac + + eval sudo $pkg_mgr_cmd $pkg_deps +} + +git_clone_repo() { + if [[ ! -d tests/common ]]; then + # The tests repo doesn't need a clone, we can just + # symlink it. + if [[ "$(basename ${WORKING_DIR})" == "openstack-ansible-tests" ]]; then + ln -s ${WORKING_DIR} ${WORKING_DIR}/tests/common + else + git clone \ + https://git.openstack.org/openstack/openstack-ansible-tests \ + tests/common + fi + fi +} + +install_pkg_deps + +git_clone_repo + +# start executing the main test script +source tests/common/run_tests_common.sh \ No newline at end of file diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..62b3e03 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,24 @@ +[metadata] +name = openstack-ansible-os_blazar +summary = os_blazar role for OpenStack-Ansible +description-file = + README.rst +author = Taseer Ahmed +author-email = taseer94@gmail.com +home-page = https://docs.openstack.org/openstack-ansible-os_blazar +classifier = + Intended Audience :: Developers + Intended Audience :: System Administrators + License :: OSI Approved :: Apache Software License + Operating System :: POSIX :: Linux + +[build_sphinx] +all_files = 1 +build-dir = doc/build +source-dir = doc/source + +[pbr] +warnerrors = True + +[wheel] +universal = 1 \ No newline at end of file diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..9c3b9d3 --- /dev/null +++ b/setup.py @@ -0,0 +1,19 @@ +# Copyright (c) 2017 taseer94@gmail.com +# +# 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 setuptools + +setuptools.setup( + setup_requires=['pbr>=2.0.0'], + pbr=True) diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..1855f7e --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1 @@ +# tasks \ No newline at end of file diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 0000000..48906f7 --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1,16 @@ +# 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.5.1 # Apache-2.0 +flake8<2.6.0,>=2.5.4 # MIT +pyasn1!=0.2.3,>=0.1.8 # BSD +pyOpenSSL>=16.2.0 # Apache-2.0 +requests>=2.14.2 # Apache-2.0 +ndg-httpsclient>=0.4.2;python_version<'3.0' # BSD + +# this is required for the docs build jobs +sphinx>=1.6.2 # BSD +openstackdocstheme>=1.17.0 # Apache-2.0 +doc8>=0.6.0 # Apache-2.0 +reno>=2.5.0 # Apache-2.0 +sphinxmark>=0.1.14 # Apache-2.0 \ No newline at end of file diff --git a/tests/main.yml b/tests/main.yml new file mode 100644 index 0000000..15c6579 --- /dev/null +++ b/tests/main.yml @@ -0,0 +1 @@ +# tests \ No newline at end of file diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..90065ad --- /dev/null +++ b/tox.ini @@ -0,0 +1,113 @@ +[tox] +minversion = 2.0 +skipsdist = True +envlist = docs,linters,functional + + +[testenv] +usedevelop = True +install_command = + pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages} +deps = + -r{toxinidir}/test-requirements.txt +commands = + /usr/bin/find . -type f -name "*.pyc" -delete +passenv = + HOME + http_proxy + HTTP_PROXY + https_proxy + HTTPS_PROXY + no_proxy + NO_PROXY +whitelist_externals = + bash +setenv = + PYTHONUNBUFFERED=1 + ROLE_NAME=os_nova + TEST_IDEMPOTENCE=false + VIRTUAL_ENV={envdir} + WORKING_DIR={toxinidir} + + +[testenv:docs] +commands= + bash -c "rm -rf doc/build" + doc8 doc + python setup.py build_sphinx + + +[doc8] +# Settings for doc8: +extensions = .rst + + +[testenv:releasenotes] +commands = + sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html + + +# environment used by the -infra templated docs job +[testenv:venv] +commands = + {posargs} + + +[testenv:pep8] +commands = + bash -c "{toxinidir}/tests/tests-repo-clone.sh" + bash -c "{toxinidir}/tests/common/test-pep8.sh" + + +[flake8] +# Ignores the following rules due to how ansible modules work in general +# F403 'from ansible.module_utils.basic import *' used; +# unable to detect undefined names +ignore=F403 + + +[testenv:bashate] +commands = + bash -c "{toxinidir}/tests/tests-repo-clone.sh" + bash -c "{toxinidir}/tests/common/test-bashate.sh" + + +[testenv:ansible] +deps = + {[testenv]deps} + -rhttps://git.openstack.org/cgit/openstack/openstack-ansible/plain/global-requirement-pins.txt + -rhttps://git.openstack.org/cgit/openstack/openstack-ansible-tests/plain/test-ansible-deps.txt + + +[testenv:ansible-syntax] +deps = + {[testenv:ansible]deps} +commands = + bash -c "{toxinidir}/tests/tests-repo-clone.sh" + bash -c "{toxinidir}/tests/common/test-ansible-syntax.sh" + + +[testenv:ansible-lint] +deps = + {[testenv:ansible]deps} +commands = + bash -c "{toxinidir}/tests/tests-repo-clone.sh" + bash -c "{toxinidir}/tests/common/test-ansible-lint.sh" + + +[testenv:functional] +deps = + {[testenv:ansible]deps} +commands = + bash -c "{toxinidir}/tests/tests-repo-clone.sh" + bash -c "{toxinidir}/tests/common/test-ansible-functional.sh" + +[testenv:linters] +deps = + {[testenv:ansible]deps} +commands = + {[testenv:pep8]commands} + {[testenv:bashate]commands} + {[testenv:ansible-lint]commands} + {[testenv:ansible-syntax]commands} + {[testenv:docs]commands} \ No newline at end of file diff --git a/vars/main.yml b/vars/main.yml new file mode 100644 index 0000000..f989e9c --- /dev/null +++ b/vars/main.yml @@ -0,0 +1 @@ +# vars \ No newline at end of file