Implement base configuration for independent repository
This patch establishes the base repository configuration required for the role to pass CI checks and be usable in OpenStack-CI. It also implements a callback plugin to provide human readable logging for functional tests in order to aid the resolution of any functional testing failures. Change-Id: I6a9782ef185a263e1891d8dbfe15cb8bec10ef76
This commit is contained in:
parent
e18e50edf8
commit
0214f9bd41
62
.gitignore
vendored
Normal file
62
.gitignore
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
# 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
|
||||
|
||||
# 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
|
||||
|
||||
# Generated by pbr while building docs
|
||||
######################################
|
||||
AUTHORS
|
||||
ChangeLog
|
||||
|
||||
# Files created by releasenotes build
|
||||
releasenotes/build
|
||||
|
||||
# Test temp files
|
||||
tests/plugins
|
4
.gitreview
Normal file
4
.gitreview
Normal file
@ -0,0 +1,4 @@
|
||||
[gerrit]
|
||||
host=review.openstack.org
|
||||
port=29418
|
||||
project=openstack/openstack-ansible-os_keystone.git
|
22
readme.rst
22
readme.rst
@ -1,22 +0,0 @@
|
||||
os_keystone role
|
||||
#############
|
||||
:tags: openstack, cloud, ansible, os_keystone
|
||||
:category: \*nix
|
||||
|
||||
os_keystone Role
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
- name: os_keystone role
|
||||
hosts: "hosts"
|
||||
user: root
|
||||
roles:
|
||||
- { role: "os_keystone" }
|
||||
|
||||
|
||||
Note. The template role has the template name within it. Please change the name
|
||||
throughout the code base.
|
||||
|
||||
.. code-block:: bsah
|
||||
|
||||
find . -type f -exec sed -i 's/os_keystone/CHANGE_ME_PLEASE/g' {} \;
|
@ -1,5 +1,7 @@
|
||||
ansible-lint
|
||||
ansible>=1.9.1,<2.0.0
|
||||
bashate
|
||||
flake8
|
||||
|
||||
# this is required for the docs build jobs
|
||||
sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2
|
||||
|
@ -33,7 +33,13 @@
|
||||
- name: Playbook for pre-role testing 2of3
|
||||
hosts: localhost
|
||||
connection: local
|
||||
become: yes
|
||||
pre_tasks:
|
||||
# Make sure OS does not have a stale package cache.
|
||||
- name: Update apt cache.
|
||||
apt:
|
||||
update_cache: yes
|
||||
when: ansible_os_family == 'Debian'
|
||||
- name: Ensure root's new public ssh key is in authorized_keys
|
||||
authorized_key:
|
||||
user: root
|
||||
|
139
tox.ini
139
tox.ini
@ -7,9 +7,32 @@ envlist = docs,linters,functional
|
||||
[testenv]
|
||||
usedevelop = True
|
||||
install_command = pip install -U {opts} {packages}
|
||||
setenv = VIRTUAL_ENV={envdir}
|
||||
deps = -r{toxinidir}/test-requirements.txt
|
||||
commands = /usr/bin/find . -type f -name "*.pyc" -delete
|
||||
passenv =
|
||||
HOME
|
||||
whitelist_externals =
|
||||
bash
|
||||
git
|
||||
rm
|
||||
wget
|
||||
setenv =
|
||||
VIRTUAL_ENV={envdir}
|
||||
ANSIBLE_HOST_KEY_CHECKING = False
|
||||
ANSIBLE_SSH_CONTROL_PATH = /tmp/%%h-%%r
|
||||
# TODO (odyssey4me) These are only here as they are non-standard folder
|
||||
# names for Ansible 1.9.x. We are using the standard folder names for
|
||||
# Ansible v2.x. We can remove this when we move to Ansible 2.x.
|
||||
ANSIBLE_ACTION_PLUGINS = {homedir}/.ansible/plugins/action
|
||||
ANSIBLE_CALLBACK_PLUGINS = {homedir}/.ansible/plugins/callback
|
||||
ANSIBLE_FILTER_PLUGINS = {homedir}/.ansible/plugins/filter
|
||||
ANSIBLE_LOOKUP_PLUGINS = {homedir}/.ansible/plugins/lookup
|
||||
# This is required as the default is the current path or a path specified
|
||||
# in ansible.cfg
|
||||
ANSIBLE_LIBRARY = {homedir}/.ansible/plugins/library
|
||||
# This is required as the default is '/etc/ansible/roles' or a path
|
||||
# specified in ansible.cfg
|
||||
ANSIBLE_ROLES_PATH = {homedir}/.ansible/roles:{toxinidir}/..
|
||||
|
||||
|
||||
[testenv:docs]
|
||||
@ -24,10 +47,6 @@ commands = {posargs}
|
||||
|
||||
|
||||
[testenv:pep8]
|
||||
deps =
|
||||
flake8
|
||||
whitelist_externals =
|
||||
bash
|
||||
commands =
|
||||
# Run hacking/flake8 check for all python files
|
||||
bash -c "grep --recursive --binary-files=without-match \
|
||||
@ -48,10 +67,6 @@ ignore=F403,H303
|
||||
|
||||
|
||||
[testenv:bashate]
|
||||
deps =
|
||||
bashate
|
||||
whitelist_externals =
|
||||
bash
|
||||
commands =
|
||||
# Run bashate check for all bash scripts
|
||||
# Ignores the following rules:
|
||||
@ -69,30 +84,10 @@ commands =
|
||||
|
||||
|
||||
[testenv:ansible-syntax]
|
||||
passenv =
|
||||
HOME
|
||||
setenv =
|
||||
# TODO (odyssey4me) These are only here as they are non-standard folder
|
||||
# names for Ansible 1.9.x. We are using the standard folder names for
|
||||
# Ansible v2.x. We can remove this when we move to Ansible 2.x.
|
||||
ANSIBLE_ACTION_PLUGINS = {homedir}/.ansible/plugins/action
|
||||
ANSIBLE_CALLBACK_PLUGINS = {homedir}/.ansible/plugins/callback
|
||||
ANSIBLE_FILTER_PLUGINS = {homedir}/.ansible/plugins/filter
|
||||
ANSIBLE_LOOKUP_PLUGINS = {homedir}/.ansible/plugins/lookup
|
||||
# This is required as the default is the current path or a path specified in
|
||||
# ansible.cfg
|
||||
ANSIBLE_LIBRARY = {homedir}/.ansible/plugins/library
|
||||
# This is required as the default is '/etc/ansible/roles' or a path specified
|
||||
# in ansible.cfg
|
||||
ANSIBLE_ROLES_PATH = {homedir}/.ansible/roles:{toxinidir}/..
|
||||
deps =
|
||||
ansible>1.9,<2.0
|
||||
whitelist_externals =
|
||||
git
|
||||
rm
|
||||
commands =
|
||||
rm -rf {homedir}/.ansible
|
||||
git clone https://git.openstack.org/openstack/openstack-ansible-plugins {homedir}/.ansible/plugins
|
||||
git clone https://git.openstack.org/openstack/openstack-ansible-plugins \
|
||||
{homedir}/.ansible/plugins
|
||||
ansible-galaxy install \
|
||||
--role-file={toxinidir}/tests/ansible-role-requirements.yml \
|
||||
--ignore-errors \
|
||||
@ -105,80 +100,32 @@ commands =
|
||||
|
||||
|
||||
[testenv:ansible-lint]
|
||||
deps =
|
||||
ansible>1.9,<2.0
|
||||
ansible-lint
|
||||
whitelist_externals =
|
||||
bash
|
||||
commands =
|
||||
ansible-lint {toxinidir}/tests/test.yml
|
||||
|
||||
|
||||
[testenv:functional]
|
||||
passenv =
|
||||
HOME
|
||||
setenv =
|
||||
ANSIBLE_HOST_KEY_CHECKING = False
|
||||
# TODO (odyssey4me) These are only here as they are non-standard folder
|
||||
# names for Ansible 1.9.x. We are using the standard folder names for
|
||||
# Ansible v2.x. We can remove this when we move to Ansible 2.x.
|
||||
ANSIBLE_ACTION_PLUGINS = {homedir}/.ansible/plugins/action
|
||||
ANSIBLE_CALLBACK_PLUGINS = {homedir}/.ansible/plugins/callback
|
||||
ANSIBLE_FILTER_PLUGINS = {homedir}/.ansible/plugins/filter
|
||||
ANSIBLE_LOOKUP_PLUGINS = {homedir}/.ansible/plugins/lookup
|
||||
# This is required as the default is the current path or a path specified in
|
||||
# ansible.cfg
|
||||
ANSIBLE_LIBRARY = {homedir}/.ansible/plugins/library
|
||||
# This is required as the default is '/etc/ansible/roles' or a path specified
|
||||
# in ansible.cfg
|
||||
ANSIBLE_ROLES_PATH = {homedir}/.ansible/roles:{toxinidir}/..
|
||||
deps =
|
||||
ansible>1.9,<2.0
|
||||
whitelist_externals =
|
||||
git
|
||||
rm
|
||||
commands =
|
||||
rm -rf {homedir}/.ansible
|
||||
git clone https://git.openstack.org/openstack/openstack-ansible-plugins {homedir}/.ansible/plugins
|
||||
ansible-galaxy install \
|
||||
--role-file={toxinidir}/tests/ansible-role-requirements.yml \
|
||||
--ignore-errors \
|
||||
--force
|
||||
ansible-playbook -i {toxinidir}/tests/inventory \
|
||||
-e "rolename={toxinidir}" \
|
||||
{toxinidir}/tests/test.yml
|
||||
ansible-playbook -i {toxinidir}/tests/stand-alone \
|
||||
-e "rolename={toxinidir}" \
|
||||
{toxinidir}/tests/stand-alone.yml
|
||||
echo -e "\n *******************************************************\n" \
|
||||
"**** Functional Testing is still to be implemented ****\n" \
|
||||
"**** TODO: Write tests here ****\n" \
|
||||
"*******************************************************\n"
|
||||
# rm -rf {homedir}/.ansible
|
||||
# git clone https://git.openstack.org/openstack/openstack-ansible-plugins \
|
||||
# {homedir}/.ansible/plugins
|
||||
# This plugin makes the ansible-playbook output easier to read
|
||||
# wget -O {homedir}/.ansible/plugins/callback/human_log.py \
|
||||
# https://gist.githubusercontent.com/cliffano/9868180/raw/f360f306b3c6d689734a6aa8773a00edf16a0054/human_log.py
|
||||
# ansible-galaxy install \
|
||||
# --role-file={toxinidir}/tests/ansible-role-requirements.yml \
|
||||
# --ignore-errors \
|
||||
# --force
|
||||
# ansible-playbook -i {toxinidir}/tests/inventory \
|
||||
# -e "rolename={toxinidir}" \
|
||||
# {toxinidir}/tests/test.yml
|
||||
|
||||
|
||||
[testenv:linters]
|
||||
passenv =
|
||||
HOME
|
||||
setenv =
|
||||
# TODO (odyssey4me) These are only here as they are non-standard folder
|
||||
# names for Ansible 1.9.x. We are using the standard folder names for
|
||||
# Ansible v2.x. We can remove this when we move to Ansible 2.x.
|
||||
ANSIBLE_ACTION_PLUGINS = {homedir}/.ansible/plugins/action
|
||||
ANSIBLE_CALLBACK_PLUGINS = {homedir}/.ansible/plugins/callback
|
||||
ANSIBLE_FILTER_PLUGINS = {homedir}/.ansible/plugins/filter
|
||||
ANSIBLE_LOOKUP_PLUGINS = {homedir}/.ansible/plugins/lookup
|
||||
# This is required as the default is the current path or a path specified in
|
||||
# ansible.cfg
|
||||
ANSIBLE_LIBRARY = {homedir}/.ansible/plugins/library
|
||||
# This is required as the default is '/etc/ansible/roles' or a path specified
|
||||
# in ansible.cfg
|
||||
ANSIBLE_ROLES_PATH = {homedir}/.ansible/roles:{toxinidir}/..
|
||||
deps =
|
||||
{[testenv:pep8]deps}
|
||||
{[testenv:bashate]deps}
|
||||
{[testenv:ansible-lint]deps}
|
||||
# note that the ansible-syntax deps are omitted on purpose as the
|
||||
# ansible-lint env contains duplicate items in its dep list
|
||||
whitelist_externals =
|
||||
bash
|
||||
git
|
||||
rm
|
||||
commands =
|
||||
{[testenv:pep8]commands}
|
||||
{[testenv:bashate]commands}
|
||||
|
Loading…
Reference in New Issue
Block a user